comps: Filter comps groups for optional variants

The optional variant can defined by just adding has_optional=True into
variant xml. In such case it has no comps groups and Pungi would copy
the original file unmodified. This leads to extra packages being pulled
into the optional variant.

In this case the correct solution is to filter the comps and remove all
groups.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-02-21 15:34:04 +01:00
parent d9ab899920
commit 8bc65a8be5
2 changed files with 10 additions and 3 deletions

View file

@ -24,6 +24,7 @@ class TestInitPhase(PungiTestCase):
def test_run(self, write_prepopulate, write_variant, create_comps, write_arch, write_global):
compose = DummyCompose(self.topdir, {})
compose.has_comps = True
compose.setup_optional()
phase = init.InitPhase(compose)
phase.run()
@ -38,7 +39,8 @@ class TestInitPhase(PungiTestCase):
mock.call(compose, 'amd64', compose.variants['Server']),
mock.call(compose, 'amd64', compose.variants['Client']),
mock.call(compose, 'x86_64', compose.variants['Everything']),
mock.call(compose, 'amd64', compose.variants['Everything'])])
mock.call(compose, 'amd64', compose.variants['Everything']),
mock.call(compose, 'x86_64', compose.all_variants['Server-optional'])])
@mock.patch('pungi.phases.init.copy_variant_comps')
@mock.patch('pungi.phases.init.write_global_comps')