From 5c1d04eb00434e3c3b981f8fe3a68a20e5fc329d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 30 Jan 2017 14:27:17 +0100 Subject: [PATCH] Add matching multilib method to log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lubomír Sedlář --- pungi/gather_dnf.py | 2 +- pungi/multilib_dnf.py | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pungi/gather_dnf.py b/pungi/gather_dnf.py index d28e5d86..299cc374 100644 --- a/pungi/gather_dnf.py +++ b/pungi/gather_dnf.py @@ -714,7 +714,7 @@ class Gather(GatherBase): multilib_pkgs.append(i) added.add(i) self._set_flag(i, PkgFlag.multilib) - self._add_packages([i], reason='multilib') + self._add_packages([i], reason='multilib:%s' % is_multilib) self.finished_add_multilib_packages[pkg] = i # TODO: ^^^ may get multiple results; i686, i586, etc. diff --git a/pungi/multilib_dnf.py b/pungi/multilib_dnf.py index 950119d6..235db14b 100644 --- a/pungi/multilib_dnf.py +++ b/pungi/multilib_dnf.py @@ -25,14 +25,12 @@ RE_SONAME = re.compile(r"^.*\.so\.\d+.*$") class Multilib(object): def __init__(self, sack, methods, blacklist=None, whitelist=None): self.sack = sack - self.methods = [] + self.methods = {} self.blacklist = blacklist or [] self.whitelist = whitelist or [] - for i in methods: - name = "method_%s" % i - func = getattr(self, name) - self.methods.append(func) + for method in methods: + self.methods[method] = getattr(self, "method_%s" % method) def _match_one(self, pkg, pattern): return fnmatch.fnmatch(pkg.name, pattern) @@ -74,8 +72,8 @@ class Multilib(object): if self._match_any(pkg, self.blacklist): return False if self._match_any(pkg, self.whitelist): - return True - for i in self.methods: - if i(pkg): - return True + return 'whitelist' + for method, func in self.methods.iteritems(): + if func(pkg): + return method return False