Add matching multilib method to log

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-01-30 14:27:17 +01:00
parent 08fbdec494
commit 5c1d04eb00
2 changed files with 8 additions and 10 deletions

View File

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

View File

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