From 2ae742af04305ae936ee5f5d5715bb732bdb9008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 2 May 2019 13:22:13 +0200 Subject: [PATCH] pkgset: Fix filtering excluded modular packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For modular tags we only include packages that are included in the module. Originally the filter was taking package names from rpms.artifacts section of MMD. This however does not work correctly, as there can easily be module which lists foo.src but does not want to include foo.x86_64 or other arches. This patch fixes this particular problem by included arch in the set of packages to be kept. JIRA: COMPOSE-3543 Signed-off-by: Lubomír Sedlář --- pungi/phases/pkgset/pkgsets.py | 10 +++++++--- pungi/phases/pkgset/sources/source_koji.py | 8 ++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pungi/phases/pkgset/pkgsets.py b/pungi/phases/pkgset/pkgsets.py index 028cfddb..ca4f7fc6 100644 --- a/pungi/phases/pkgset/pkgsets.py +++ b/pungi/phases/pkgset/pkgsets.py @@ -417,8 +417,8 @@ class KojiPackageSet(PackageSetBase): :param event: the Koji event to query at (or latest if not given) :param inherit: whether to enable tag inheritance :param logfile: path to file where package source tags should be logged - :param include_packages: an iterable of package names that should be - included, all others are skipped. + :param include_packages: an iterable of tuples (package name, arch) that should + be included, all others are skipped. """ result_rpms = [] result_srpms = [] @@ -454,7 +454,11 @@ class KojiPackageSet(PackageSetBase): skipped_arches.append(rpm_info["arch"]) continue - if include_packages and rpm_info["name"] not in include_packages and rpm_info["arch"] != "src": + if ( + include_packages + and (rpm_info["name"], rpm_info["arch"]) not in include_packages + and rpm_info["arch"] != "src" + ): self.log_debug( "Skipping %(name)s-%(version)s-%(release)s.%(arch)s" % rpm_info ) diff --git a/pungi/phases/pkgset/sources/source_koji.py b/pungi/phases/pkgset/sources/source_koji.py index 2e305397..6f9a6432 100644 --- a/pungi/phases/pkgset/sources/source_koji.py +++ b/pungi/phases/pkgset/sources/source_koji.py @@ -21,6 +21,7 @@ import re from itertools import groupby import threading +from kobo.rpmlib import parse_nvra from kobo.shortcuts import force_list, relative_path import pungi.wrappers.kojiwrapper @@ -638,10 +639,9 @@ def populate_global_pkgset(compose, koji_wrapper, path_prefix, event): for arch_modules in variant.arch_mmds.values(): arch_mmd = arch_modules[nsvc] if arch_mmd: - modular_packages.update( - nevra.rsplit("-", 2)[0] - for nevra in arch_mmd.get_rpm_artifacts().get() - ) + for rpm_nevra in arch_mmd.get_rpm_artifacts().get(): + nevra = parse_nvra(rpm_nevra) + modular_packages.add((nevra["name"], nevra["arch"])) pkgset.populate( compose_tag,