gather: Honor module whitelist

If the modulemd contains a whitelist of packages (under buildopts), it
means the packages are possibly renamed, and we need to check that list
instead of components.rpms.

Multilib does not really work now, anything with non-native arch is
skipped.

JIRA: RCM-38019
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-07-31 16:32:02 +02:00
parent 6f527ae5b9
commit 03ee632cc8

View File

@ -80,9 +80,21 @@ class GatherSourceModule(pungi.phases.gather.source.GatherSourceBase):
for mmd in variant.mmds: for mmd in variant.mmds:
mmd_id = "%s-%s" % (mmd.get_name(), mmd.get_stream()) mmd_id = "%s-%s" % (mmd.get_name(), mmd.get_stream())
arch_mmd = variant.arch_mmds[arch][mmd_id] arch_mmd = variant.arch_mmds[arch][mmd_id]
# Skip this mmd if this RPM does not belong to it.
srpm = kobo.rpmlib.parse_nvr(rpm_obj.sourcerpm)["name"] srpm = kobo.rpmlib.parse_nvr(rpm_obj.sourcerpm)["name"]
filtered = False
buildopts = mmd.get_buildopts()
if buildopts:
whitelist = buildopts.get_rpm_whitelist()
if whitelist:
# We have whitelist, no filtering against components.
filtered = True
if srpm not in whitelist:
# Package is not on the list, skip it.
continue
if not filtered:
# Skip this mmd if this RPM does not belong to it.
if (srpm not in mmd.get_rpm_components().keys() or if (srpm not in mmd.get_rpm_components().keys() or
rpm_obj.nevra not in mmd.get_rpm_artifacts().get()): rpm_obj.nevra not in mmd.get_rpm_artifacts().get()):
continue continue
@ -96,11 +108,16 @@ class GatherSourceModule(pungi.phases.gather.source.GatherSourceBase):
# Skip the rpm_obj if it's built for multilib arch, but # Skip the rpm_obj if it's built for multilib arch, but
# multilib is not enabled for this srpm in MMD. # multilib is not enabled for this srpm in MMD.
try:
mmd_component = mmd.get_rpm_components()[srpm] mmd_component = mmd.get_rpm_components()[srpm]
multilib = mmd_component.get_multilib() multilib = mmd_component.get_multilib()
multilib = multilib.get() if multilib else set() multilib = multilib.get() if multilib else set()
if arch not in multilib and rpm_obj.arch in multilib_arches: if arch not in multilib and rpm_obj.arch in multilib_arches:
continue continue
except KeyError:
# No such component, disable any multilib
if rpm_obj.arch not in ("noarch", arch):
continue
# Add RPM to packages. # Add RPM to packages.
packages.add((rpm_obj, None)) packages.add((rpm_obj, None))