Implement %multilib-blacklist and %multilib-whitelist config sections.

This commit is contained in:
Daniel Mach 2013-08-30 03:59:48 -04:00
parent e1f1231bb1
commit cb6f1dbe17
2 changed files with 41 additions and 0 deletions

View File

@ -415,6 +415,9 @@ class Pungi(pypungi.PungiBase):
name, arch = arch_module.split_name_arch(i)
excludes.append((name, arch, pattern, multilib))
for name in self.ksparser.handler.multilib_blacklist:
excludes.append((name, None, "multilib-blacklist: %s" % name, True))
for pkg in pkg_sack[:]:
for name, arch, exclude_pattern, multilib in excludes:
if fnmatch(pkg.name, name):
@ -564,6 +567,14 @@ class Pungi(pypungi.PungiBase):
match = self.ayum._bestPackageFromList(matches)
if not match:
continue
if po.name in self.ksparser.handler.multilib_whitelist:
msg = "Added multilib package %s.%s (repo: %s) for package %s.%s (method: %s)" % (match.name, match.arch, match.repoid, po.name, po.arch, "multilib-whitelist")
self.add_package(match, msg)
self.completed_multilib.add(match)
added.add(match)
continue
method = multilib.po_is_multilib(po, self.multilib_methods)
if not method:
continue

View File

@ -32,10 +32,38 @@ class FulltreeExcludesSection(pykickstart.sections.Section):
self.handler.fulltree_excludes.add(line)
class MultilibBlacklistSection(pykickstart.sections.Section):
sectionOpen = "%multilib-blacklist"
def handleLine(self, line):
if not self.handler:
return
(h, s, t) = line.partition('#')
line = h.rstrip()
self.handler.multilib_blacklist.add(line)
class MultilibWhitelistSection(pykickstart.sections.Section):
sectionOpen = "%multilib-whitelist"
def handleLine(self, line):
if not self.handler:
return
(h, s, t) = line.partition('#')
line = h.rstrip()
self.handler.multilib_whitelist.add(line)
class KickstartParser(pykickstart.parser.KickstartParser):
def setupSections(self):
pykickstart.parser.KickstartParser.setupSections(self)
self.registerSection(FulltreeExcludesSection(self.handler))
self.registerSection(MultilibBlacklistSection(self.handler))
self.registerSection(MultilibWhitelistSection(self.handler))
HandlerClass = pykickstart.version.returnClassForVersion()
@ -43,6 +71,8 @@ class PungiHandler(HandlerClass):
def __init__(self, *args, **kwargs):
HandlerClass.__init__(self, *args, **kwargs)
self.fulltree_excludes = set()
self.multilib_blacklist = set()
self.multilib_whitelist = set()
def get_ksparser(ks_path=None):