pkgset: Apply module filters on pkgset level

If a module says to filter a package out, we can do it immediately when
getting the build information from Koji.

This avoids a possible problem of something pulling the module package
in as a dependency, but it should also make the package set slightly
smaller.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-06-25 14:35:32 +02:00
parent 470c0ab3be
commit 98e7106f3e
3 changed files with 86 additions and 15 deletions

View file

@ -361,15 +361,19 @@ class KojiPackageSet(PackageSetBase):
% (rpm_info, self.sigkey_ordering, paths))
return None
def populate(self, tag, event=None, inherit=True, logfile=None):
def populate(
self, tag, event=None, inherit=True, logfile=None, exclude_packages=None
):
"""Populate the package set with packages from given tag.
: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 exclude_packages: an iterable of package names that should be ignored
"""
result_rpms = []
result_srpms = []
exclude_packages = set(exclude_packages or [])
if type(event) is dict:
event = event["id"]
@ -398,6 +402,12 @@ class KojiPackageSet(PackageSetBase):
skipped_arches.append(rpm_info["arch"])
continue
if exclude_packages and rpm_info["name"] in exclude_packages and rpm_info["arch"] != "src":
self.log_debug(
"Skipping %(name)s-%(version)s-%(release)s.%(arch)s" % rpm_info
)
continue
if (self.populate_only_packages and self.packages and
rpm_info['name'] not in self.packages):
skipped_packages_count += 1