diff --git a/bin/pungi-koji b/bin/pungi-koji index f77808ae..1b149225 100755 --- a/bin/pungi-koji +++ b/bin/pungi-koji @@ -366,7 +366,7 @@ def run_compose(compose, create_latest_link=True): pungi.metadata.write_tree_info(compose, arch, variant) # write .discinfo and media.repo before ISOs are created - for variant in compose.get_variants(recursive=True): + for variant in compose.get_variants(): if variant.type == "addon" or variant.is_empty: continue for arch in variant.arches + ["src"]: diff --git a/pungi/compose.py b/pungi/compose.py index 48a47a10..b3a967a2 100644 --- a/pungi/compose.py +++ b/pungi/compose.py @@ -229,13 +229,13 @@ class Compose(kobo.log.LoggingBase): #### or if it is at all self.ci_base = compose_to_composeinfo(self) - def get_variants(self, types=None, arch=None, recursive=False): + def get_variants(self, types=None, arch=None): result = [] types = types or ["variant", "optional", "addon", "layered-product"] for i in self.variants.itervalues(): if i.type in types and (not arch or arch in i.arches): result.append(i) - result.extend(i.get_variants(types=types, arch=arch, recursive=recursive)) + result.extend(i.get_variants(types=types, arch=arch)) return sorted(set(result)) def get_arches(self): diff --git a/pungi/phases/createiso.py b/pungi/phases/createiso.py index d90b45f8..0a7f0ff1 100644 --- a/pungi/phases/createiso.py +++ b/pungi/phases/createiso.py @@ -65,7 +65,7 @@ class CreateisoPhase(PhaseBase): deliverables = [] commands = [] - for variant in self.compose.get_variants(types=["variant", "layered-product", "optional"], recursive=True): + for variant in self.compose.get_variants(types=["variant", "layered-product", "optional"]): for arch in variant.arches + ["src"]: skip_iso = get_arch_variant_data(self.compose.conf, "createiso_skip", arch, variant) if skip_iso == [True]: diff --git a/pungi/phases/gather/__init__.py b/pungi/phases/gather/__init__.py index 71a7b243..4eab85db 100644 --- a/pungi/phases/gather/__init__.py +++ b/pungi/phases/gather/__init__.py @@ -307,7 +307,7 @@ def gather_wrapper(compose, package_sets, path_prefix): # write packages (package lists) for all variants for arch in compose.get_arches(): - for variant in compose.get_variants(arch=arch, recursive=True): + for variant in compose.get_variants(arch=arch): pkg_map = result[arch][variant.uid] write_packages(compose, arch, variant, pkg_map, path_prefix=path_prefix) diff --git a/tests/helpers.py b/tests/helpers.py index a05373f5..53828a7f 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -60,10 +60,6 @@ class DummyCompose(object): type='variant', is_empty=False), } self.all_variants = self.variants.copy() - self.all_variants['Server-optional'] = mock.Mock( - uid='Server-optional', arches=['x86_64'], type='optional', is_empty=False, - parent=self.variants['Server']) - self.variants['Server'].variants = {'optional': self.all_variants['Server-optional']} self.log_info = mock.Mock() self.log_error = mock.Mock() self.log_debug = mock.Mock() @@ -78,8 +74,14 @@ class DummyCompose(object): self.fail_deliverable = mock.Mock() self.require_deliverable = mock.Mock() - def get_variants(self, arch=None, types=None, recursive=None): - return [v for v in self.variants.values() if not arch or arch in v.arches] + def setup_optional(self): + self.all_variants['Server-optional'] = mock.Mock( + uid='Server-optional', arches=['x86_64'], type='optional', is_empty=False, + parent=self.variants['Server']) + self.variants['Server'].variants = {'optional': self.all_variants['Server-optional']} + + def get_variants(self, arch=None, types=None): + return [v for v in self.all_variants.values() if not arch or arch in v.arches] def can_fail(self, variant, arch, deliverable): failable = get_arch_variant_data(self.conf, 'failable_deliverables', arch, variant) diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 15491c56..7144685e 100644 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -28,6 +28,7 @@ class BuildInstallCompose(DummyCompose): type='variant', buildinstallpackages=[], is_empty=False), } + self.all_variants = self.variants.copy() class TestBuildinstallPhase(PungiTestCase): diff --git a/tests/test_imagebuildphase.py b/tests/test_imagebuildphase.py index 08c3ca5f..2fad381f 100644 --- a/tests/test_imagebuildphase.py +++ b/tests/test_imagebuildphase.py @@ -284,6 +284,7 @@ class TestImageBuildPhase(PungiTestCase): }, 'koji_profile': 'koji', }) + compose.setup_optional() self.assertEqual(validate(compose.conf), []) @@ -347,6 +348,7 @@ class TestImageBuildPhase(PungiTestCase): }, 'koji_profile': 'koji', }) + compose.setup_optional() self.assertEqual(validate(compose.conf), []) diff --git a/tests/test_liveimagesphase.py b/tests/test_liveimagesphase.py index f3bacdb7..6f383164 100644 --- a/tests/test_liveimagesphase.py +++ b/tests/test_liveimagesphase.py @@ -31,6 +31,7 @@ class TestLiveImagesPhase(PungiTestCase): }) ], }) + compose.setup_optional() self.assertEqual(validate(compose.conf), []) diff --git a/tests/test_livemediaphase.py b/tests/test_livemediaphase.py index 92b078fe..6d577de0 100644 --- a/tests/test_livemediaphase.py +++ b/tests/test_livemediaphase.py @@ -338,6 +338,7 @@ class TestLiveMediaPhase(PungiTestCase): ] } }) + compose.setup_optional() self.assertEqual(validate(compose.conf), [])