From f7197ddbccc2ecddaf96923f9889cc9327492065 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Tue, 13 Jun 2017 14:39:33 +0200 Subject: [PATCH] Allow gather source classes to return SimpleRpmWrapper objects from pkgset phase directly. Signed-off-by: Jan Kaluza --- pungi/phases/gather/methods/method_deps.py | 7 ++++++- pungi/phases/gather/methods/method_nodeps.py | 9 +++++++-- pungi/phases/gather/sources/source_module.py | 3 ++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/pungi/phases/gather/methods/method_deps.py b/pungi/phases/gather/methods/method_deps.py index ec8f1e0b..3df830db 100644 --- a/pungi/phases/gather/methods/method_deps.py +++ b/pungi/phases/gather/methods/method_deps.py @@ -17,6 +17,7 @@ import os from kobo.shortcuts import run +from kobo.pkgset import SimpleRpmWrapper, RpmWrapper from pungi.util import rmtree, get_arch_variant_data from pungi.wrappers.pungi import PungiWrapper @@ -47,7 +48,11 @@ class GatherMethodDeps(pungi.phases.gather.method.GatherMethodBase): def _format_packages(pkgs): """Sort packages and merge name with arch.""" - for pkg_name, pkg_arch in sorted(pkgs): + for pkg, pkg_arch in sorted(pkgs): + if type(pkg) in [SimpleRpmWrapper, RpmWrapper]: + pkg_name = pkg.name + else: + pkg_name = pkg if pkg_arch: yield '%s.%s' % (pkg_name, pkg_arch) else: diff --git a/pungi/phases/gather/methods/method_nodeps.py b/pungi/phases/gather/methods/method_nodeps.py index 561c588d..bf881ae8 100644 --- a/pungi/phases/gather/methods/method_nodeps.py +++ b/pungi/phases/gather/methods/method_nodeps.py @@ -18,6 +18,7 @@ import pungi.arch from pungi.util import pkg_is_rpm, pkg_is_srpm, pkg_is_debug import pungi.phases.gather.method +from kobo.pkgset import SimpleRpmWrapper, RpmWrapper class GatherMethodNodeps(pungi.phases.gather.method.GatherMethodBase): @@ -43,10 +44,14 @@ class GatherMethodNodeps(pungi.phases.gather.method.GatherMethodBase): pkg = global_pkgset[i] if not pkg_is_rpm(pkg): continue - for pkg_name, pkg_arch in packages: + for gathered_pkg, pkg_arch in packages: if pkg.arch not in valid_arches: continue - if pkg.name != pkg_name: + if (type(gathered_pkg) in [str, unicode] + and pkg.name != gathered_pkg): + continue + elif (type(gathered_pkg) in [SimpleRpmWrapper, RpmWrapper] + and pkg.nevra != gathered_pkg.nevra): continue if pkg_arch is not None and pkg.arch != pkg_arch: continue diff --git a/pungi/phases/gather/sources/source_module.py b/pungi/phases/gather/sources/source_module.py index cf6cbe98..2845ea56 100644 --- a/pungi/phases/gather/sources/source_module.py +++ b/pungi/phases/gather/sources/source_module.py @@ -63,7 +63,8 @@ class GatherSourceModule(pungi.phases.gather.source.GatherSourceBase): srpm = kobo.rpmlib.parse_nvr(rpm_obj.sourcerpm)["name"] if (srpm in mmd.components.rpms.keys() and - rpm_obj.name not in mmd.filter.rpms): + rpm_obj.name not in mmd.filter.rpms and + rpm_obj.nevra in mmd.artifacts.rpms): packages.add((rpm_obj.name, None)) added_rpms.setdefault(mmd_id, []) added_rpms[mmd_id].append(str(rpm_obj.nevra))