Hide latest koji package via pkgset_koji_builds option

JIRA: COMPOSE-4010
Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
Haibo Lin 2019-12-20 13:56:06 +08:00 committed by lsedlar
parent aa6a213c8d
commit 01ab1d2e24

View File

@ -440,9 +440,18 @@ class KojiPackageSet(PackageSetBase):
rpms += extra_rpms rpms += extra_rpms
builds += extra_builds builds += extra_builds
extra_builds_by_name = {}
for build_info in extra_builds:
extra_builds_by_name[build_info['name']] = build_info['build_id']
builds_by_id = {} builds_by_id = {}
exclude_build_id = []
for build_info in builds: for build_info in builds:
builds_by_id.setdefault(build_info["build_id"], build_info) build_id, build_name = build_info['build_id'], build_info['name']
if build_name in extra_builds_by_name and build_id != extra_builds_by_name[build_name]:
exclude_build_id.append(build_id)
else:
builds_by_id.setdefault(build_id, build_info)
skipped_arches = [] skipped_arches = []
skipped_packages_count = 0 skipped_packages_count = 0
@ -454,6 +463,9 @@ class KojiPackageSet(PackageSetBase):
# ExclusiveArch for noarch packages. # ExclusiveArch for noarch packages.
for rpm_info in itertools.chain((rpm for rpm in rpms if not _is_src(rpm)), for rpm_info in itertools.chain((rpm for rpm in rpms if not _is_src(rpm)),
(rpm for rpm in rpms if _is_src(rpm))): (rpm for rpm in rpms if _is_src(rpm))):
if rpm_info['build_id'] in exclude_build_id:
continue
if self.arches and rpm_info["arch"] not in self.arches: if self.arches and rpm_info["arch"] not in self.arches:
if rpm_info["arch"] not in skipped_arches: if rpm_info["arch"] not in skipped_arches:
self.log_debug("Skipping packages for arch: %s" % rpm_info["arch"]) self.log_debug("Skipping packages for arch: %s" % rpm_info["arch"])