pkgset: Fix filtering excluded modular packages

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ář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-05-02 13:22:13 +02:00
parent f858cea466
commit 2ae742af04
2 changed files with 11 additions and 7 deletions

View File

@ -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
)

View File

@ -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,