gather: Early exit for non-comps sources

When getting list of initial packages, only run the source and do
nothing else. Additional package, system-release etc. will be added only
to comps.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-07-17 14:40:07 +02:00
parent 0b9652f2d6
commit 9ca454007a

View File

@ -610,26 +610,22 @@ def get_variant_packages(compose, arch, variant, source_name, package_sets=None)
When system-release packages should be filtered, the ``package_sets`` When system-release packages should be filtered, the ``package_sets``
argument is required. argument is required.
""" """
packages, groups, filter_packages = set(), set(), set() filter_packages = set()
GatherSource = get_gather_source(source_name) GatherSource = get_gather_source(source_name)
source = GatherSource(compose) source = GatherSource(compose)
p, g = source(arch, variant) packages, groups = source(arch, variant)
if source_name != "comps" and not p and not g: if source_name != "comps":
# For modules and json source, if the source did not return anything, # For modules and json source we want just the explicit packages.
# we should skip all further work. Additional packages and possibly # Additional packages and possibly system-release will be added to
# system-release will be added to comps source. # comps source.
return packages, groups, filter_packages return packages, groups, filter_packages
packages |= p
groups |= g
if variant is None: if variant is None:
# no variant -> no parent -> we have everything we need # no variant -> no parent -> we have everything we need
# doesn't make sense to do any package filtering # doesn't make sense to do any package filtering
return packages, groups, filter_packages return packages, groups, filter_packages
if source_name == 'comps':
packages |= get_additional_packages(compose, arch, variant) packages |= get_additional_packages(compose, arch, variant)
filter_packages |= get_filter_packages(compose, arch, variant) filter_packages |= get_filter_packages(compose, arch, variant)