gather: Use comps for given variant

The file for variant is filtered to only contain relevant parts.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-04-05 13:17:12 +02:00
parent 064f922117
commit aab3b04b08
2 changed files with 6 additions and 6 deletions

View File

@ -45,7 +45,7 @@ class GatherMethodNodeps(pungi.phases.gather.method.GatherMethodBase):
"debuginfo": [], "debuginfo": [],
} }
group_packages = expand_groups(self.compose, arch, groups) group_packages = expand_groups(self.compose, arch, variant, groups)
packages = pkgs | group_packages packages = pkgs | group_packages
log.write('Requested packages:\n%s\n' % pformat(packages)) log.write('Requested packages:\n%s\n' % pformat(packages))
@ -117,9 +117,9 @@ class GatherMethodNodeps(pungi.phases.gather.method.GatherMethodBase):
return result return result
def expand_groups(compose, arch, groups): def expand_groups(compose, arch, variant, groups):
"""Read comps file filtered for given architecture and return all packages """Read comps file filtered for given architecture and variant and return
in given groups. all packages in given groups.
:returns: A set of tuples (pkg_name, arch) :returns: A set of tuples (pkg_name, arch)
""" """
@ -127,7 +127,7 @@ def expand_groups(compose, arch, groups):
# No groups, nothing to do (this also covers case when there is no # No groups, nothing to do (this also covers case when there is no
# comps file. # comps file.
return set() return set()
comps_file = compose.paths.work.comps(arch, create_dir=False) comps_file = compose.paths.work.comps(arch, variant, create_dir=False)
comps = CompsWrapper(comps_file) comps = CompsWrapper(comps_file)
packages = set() packages = set()

View File

@ -20,7 +20,7 @@ class TestWritePungiConfig(helpers.PungiTestCase):
self.compose.paths.work.comps = mock.Mock(return_value=COMPS_FILE) self.compose.paths.work.comps = mock.Mock(return_value=COMPS_FILE)
def test_expand_group(self): def test_expand_group(self):
packages = nodeps.expand_groups(self.compose, 'x86_64', ['core', 'text-internet']) packages = nodeps.expand_groups(self.compose, 'x86_64', None, ['core', 'text-internet'])
self.assertItemsEqual(packages, [('dummy-bash', 'x86_64'), self.assertItemsEqual(packages, [('dummy-bash', 'x86_64'),
('dummy-elinks', 'x86_64'), ('dummy-elinks', 'x86_64'),
('dummy-tftp', 'x86_64')]) ('dummy-tftp', 'x86_64')])