diff --git a/doc/configuration.rst b/doc/configuration.rst index 481eeea4..b7f8f863 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -141,10 +141,6 @@ Options (*bool*) -- When set to ``False``, the comps files for variants will not have their environments filtered to match the variant. -**keep_original_comps** [optional] - (*list*) -- List of variants for which the original comps file will be - copied without any modifications. Overwrites `comps_filter_environments`. - **tree_arches** ([*str*]) -- list of architectures which should be included; if undefined, all architectures from variants.xml will be included diff --git a/pungi/checks.py b/pungi/checks.py index 2726826b..fe8caab8 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -577,8 +577,7 @@ def _make_schema(): "default": True, }, "keep_original_comps": { - "$ref": "#/definitions/list_of_strings", - "default": [] + "deprecated": "no tag for respective variant in variants XML" }, "link_type": { diff --git a/pungi/phases/init.py b/pungi/phases/init.py index 64d9b1a2..eaa856b0 100644 --- a/pungi/phases/init.py +++ b/pungi/phases/init.py @@ -47,12 +47,14 @@ class InitPhase(PhaseBase): # write variant comps for variant in self.compose.get_variants(): - should_preserve = variant.uid in self.compose.conf['keep_original_comps'] for arch in variant.arches: - if should_preserve: - copy_variant_comps(self.compose, arch, variant) - else: + if variant.groups: + # The variant lists only some groups, run filter. write_variant_comps(self.compose, arch, variant) + else: + # The variant does not mention any groups, copy + # original file. + copy_variant_comps(self.compose, arch, variant) # download variants.xml / product.xml? diff --git a/tests/test_config.py b/tests/test_config.py index 31d2f3f9..17bf5c6e 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -369,22 +369,8 @@ class LiveMediaConfigTestCase(unittest.TestCase): self.assertEqual(checks.validate(cfg), []) -class InitConfigTestCase(unittest.TestCase): - def test_validate_keep_original_comps_empty(self): - cfg = load_config(PKGSET_REPOS, - keep_original_comps=[]) - - self.assertEqual(checks.validate(cfg), []) - - def test_validate_keep_original_comps_filled_in(self): - cfg = load_config(PKGSET_REPOS, - keep_original_comps=['Everything']) - - self.assertEqual(checks.validate(cfg), []) - - class TestSuggestions(unittest.TestCase): - def test_validate_keep_original_comps_empty(self): + def test_with_a_typo(self): cfg = load_config(PKGSET_REPOS, product_pid=None) diff --git a/tests/test_initphase.py b/tests/test_initphase.py index 0401c825..e7f4eff3 100755 --- a/tests/test_initphase.py +++ b/tests/test_initphase.py @@ -48,10 +48,9 @@ class TestInitPhase(PungiTestCase): @mock.patch('pungi.phases.init.write_prepopulate_file') def test_run_with_preserve(self, write_prepopulate, write_variant, create_comps, write_arch, write_global, copy_comps): - compose = DummyCompose(self.topdir, { - 'keep_original_comps': ['Everything'], - }) + compose = DummyCompose(self.topdir, {}) compose.has_comps = True + compose.variants['Everything'].groups = [] phase = init.InitPhase(compose) phase.run() @@ -90,6 +89,20 @@ class TestInitPhase(PungiTestCase): self.assertItemsEqual(copy_comps.mock_calls, []) +class TestCopyVariantComps(PungiTestCase): + + @mock.patch('shutil.copy') + def test_run(self, copy): + compose = DummyCompose(self.topdir, {}) + variant = compose.variants['Server'] + + init.copy_variant_comps(compose, 'x86_64', variant) + + self.assertEqual(copy.mock_calls, + [mock.call(self.topdir + '/work/global/comps/comps-global.xml', + self.topdir + '/work/x86_64/comps/comps-Server.x86_64.xml')]) + + class TestWriteArchComps(PungiTestCase): @mock.patch('pungi.phases.init.run') @@ -222,19 +235,5 @@ class TestWriteVariantComps(PungiTestCase): self.assertEqual(comps.write_comps.mock_calls, []) -class TestCopyVariantComps(PungiTestCase): - - @mock.patch('shutil.copy') - def test_run(self, copy): - compose = DummyCompose(self.topdir, {}) - variant = compose.variants['Server'] - - init.copy_variant_comps(compose, 'x86_64', variant) - - self.assertEqual(copy.mock_calls, - [mock.call(self.topdir + '/work/global/comps/comps-global.xml', - self.topdir + '/work/x86_64/comps/comps-Server.x86_64.xml')]) - - if __name__ == "__main__": unittest.main()