1
0
mirror of https://github.com/ARMmbed/mbedtls.git synced 2025-05-09 16:41:19 +08:00

Add support for common dependencies in exclusive groups

When elements of an exclusive group have dependencies in common turning them off
breaks the elements build. Support added to handle and ignore these dependencies
when only one of the elements is enabled.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
Gabor Mezei 2024-10-30 17:21:49 +01:00
parent e191c0358e
commit 95be5fb18b
No known key found for this signature in database
GPG Key ID: 6310BD29B0BFF98C

View File

@ -387,19 +387,33 @@ defines to be altered. """
dep = dep[1:] dep = dep[1:]
config_settings[dep] = not unset config_settings[dep] = not unset
def turn_off_dependencies(config_settings): def turn_off_dependencies(config_settings, exclude=None):
"""For every option turned off config_settings, also turn off what depends on it. """For every option turned off config_settings, also turn off what depends on it.
An option O is turned off if config_settings[O] is False. An option O is turned off if config_settings[O] is False.
Handle the dependencies recursively. Handle the dependencies recursively.
If 'exclude' is a symbol, do not process it's dependencies. It is usefull when
two symbol has dependencies is common but need to be switched separately.
""" """
# Recursively determine the excludable dependencies
excludes = set()
if exclude:
rev_excludes = set(REVERSE_DEPENDENCIES.get(exclude, []))
while rev_excludes:
dep = rev_excludes.pop()
excludes.add(dep)
rev_excludes.update(set(REVERSE_DEPENDENCIES.get(dep, [])) - excludes)
for key, value in sorted(config_settings.items()): for key, value in sorted(config_settings.items()):
if value is not False: if value is not False:
continue continue
# Save the processed settings to handle cross referencies # Save the processed settings to handle cross referencies.
revdep = set(REVERSE_DEPENDENCIES.get(key, [])) # Mark the excluded dependencies as already processed to skip it.
history = set() history = excludes.copy()
revdep = set(REVERSE_DEPENDENCIES.get(key, [])) - excludes
while revdep: while revdep:
dep = revdep.pop() dep = revdep.pop()
history.add(dep) history.add(dep)
@ -435,7 +449,7 @@ would match this regular expression."""
config_settings = base_config_settings.copy() config_settings = base_config_settings.copy()
config_settings[symbol] = True config_settings[symbol] = True
handle_exclusive_groups(config_settings, symbol) handle_exclusive_groups(config_settings, symbol)
turn_off_dependencies(config_settings) turn_off_dependencies(config_settings, symbol)
job = Job(description, config_settings, commands) job = Job(description, config_settings, commands)
self.jobs.append(job) self.jobs.append(job)