Skip to content

Commit

Permalink
test/generate-ostree-bc: filter configs on architecture
Browse files Browse the repository at this point in the history
As with the previous commit, consider the arches filter for configs with
dependencies as well as the distros when creating the new config map.
  • Loading branch information
achilleas-k committed Nov 17, 2023
1 parent 43c6de3 commit 5813daa
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/scripts/generate-ostree-build-config
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ def read_config_map():
return json.load(config_map_file)


def configs_with_deps(configs, distro=None):
def configs_with_deps(configs, distro=None, arch=None):
"""
Return a config map with only the config files that have dependencies.
Filter on distro and arch if specified.
"""
with_deps: dict[str, str] = {}
config_map_dir = os.path.abspath(os.path.dirname(testlib.CONFIG_MAP))
Expand All @@ -46,8 +47,13 @@ def configs_with_deps(configs, distro=None):
data = json.load(config_file)
if not data.get("depends"):
continue
config_distro = filters.get("distros", [])
if config_distro and distro and distro not in config_distro:

# filter on distro and arch
distro_filters = filters.get("distros", [])
if distro_filters and distro and distro not in distro_filters:
continue
arch_filters = filters.get("arches", [])
if arch_filters and arch and arch not in arch_filters:
continue

with_deps[config_path] = filters
Expand Down Expand Up @@ -320,7 +326,7 @@ def main():

testlib.check_config_names()

config_map = configs_with_deps(read_config_map(), distro) # filtered config map: only configs with deps
config_map = configs_with_deps(read_config_map(), distro, arch) # filtered config map: only configs with deps

with TemporaryDirectory() as cache_root:
dep_manifest_dir = os.path.join(cache_root, "dependencies")
Expand Down

0 comments on commit 5813daa

Please sign in to comment.