Add the option to pass a custom path for the multilib config files
The default is /usr/share/pungi/multilib/, pass --multilibconf to override this. This also adds multilib.init() so that an import of multilib doesn't immediately setup the classes. (cherry picked from commit 234524296fd53871aed64690cf6a7d5849ca154a)
This commit is contained in:
parent
13526d1c49
commit
320724ed98
@ -275,6 +275,9 @@ if __name__ == '__main__':
|
||||
parser.add_option("-i", "--installpkgs", default=[],
|
||||
action="append", metavar="STRING",
|
||||
help="Package glob for lorax to install before runtime-install.tmpl runs. (may be listed multiple times)")
|
||||
parser.add_option("--multilibconf", default=None, type="string",
|
||||
action="callback", callback=set_config, callback_args=(config, ),
|
||||
help="Path to multilib conf files. Default is /usr/share/pungi/multilib/")
|
||||
|
||||
parser.add_option("-c", "--config", dest="config",
|
||||
help='Path to kickstart config file')
|
||||
|
@ -33,6 +33,7 @@ class Config(SafeConfigParser):
|
||||
self.set('pungi', 'sourcedir', 'source')
|
||||
self.set('pungi', 'debugdir', 'debug')
|
||||
self.set('pungi', 'isodir', 'iso')
|
||||
self.set('pungi', 'multilibconf', '/usr/share/pungi/multilib/')
|
||||
self.set('pungi', 'relnotefilere', 'LICENSE README-BURNING-ISOS-en_US.txt ^RPM-GPG')
|
||||
self.set('pungi', 'relnotedirre', '')
|
||||
self.set('pungi', 'relnotepkgs', 'fedora-repos fedora-release fedora-release-notes')
|
||||
|
@ -106,6 +106,7 @@ class PungiBase(object):
|
||||
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
multilib.init(self.config.get('pungi', 'multilibconf'))
|
||||
|
||||
# ARCH setup
|
||||
self.tree_arch = self.config.get('pungi', 'arch')
|
||||
|
@ -92,6 +92,9 @@ class MultilibMethodBase(object):
|
||||
"""a base class for multilib methods"""
|
||||
name = "base"
|
||||
|
||||
def __init__(self, config_path):
|
||||
self.config_path = config_path
|
||||
|
||||
def select(self, po):
|
||||
raise NotImplementedError
|
||||
|
||||
@ -141,10 +144,11 @@ class RuntimeMultilibMethod(MultilibMethodBase):
|
||||
"""pre-defined paths to libs"""
|
||||
name = "runtime"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.blacklist = read_lines_from_file("/usr/share/pungi/multilib/runtime-blacklist.conf")
|
||||
self.whitelist = read_lines_from_file("/usr/share/pungi/multilib/runtime-whitelist.conf")
|
||||
self.patterns = expand_runtime_patterns(read_runtime_patterns_from_file("/usr/share/pungi/multilib/runtime-patterns.conf"))
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(RuntimeMultilibMethod, self).__init__(*args, **kwargs)
|
||||
self.blacklist = read_lines_from_file(self.config_path+"runtime-blacklist.conf")
|
||||
self.whitelist = read_lines_from_file(self.config_path+"runtime-whitelist.conf")
|
||||
self.patterns = expand_runtime_patterns(read_runtime_patterns_from_file(self.config_path+"runtime-patterns.conf"))
|
||||
|
||||
def select(self, po):
|
||||
if self.skip(po):
|
||||
@ -186,8 +190,10 @@ class RuntimeMultilibMethod(MultilibMethodBase):
|
||||
|
||||
class FileMultilibMethod(MultilibMethodBase):
|
||||
"""explicitely defined whitelist and blacklist"""
|
||||
def __init__(self, **kwargs):
|
||||
self.name = "file"
|
||||
name = "file"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(FileMultilibMethod, self).__init__(*args, **kwargs)
|
||||
whitelist = kwargs.pop("whitelist", None)
|
||||
blacklist = kwargs.pop("blacklist", None)
|
||||
self.whitelist = self.read_file(whitelist)
|
||||
@ -212,8 +218,10 @@ class FileMultilibMethod(MultilibMethodBase):
|
||||
|
||||
class KernelMultilibMethod(MultilibMethodBase):
|
||||
"""kernel and kernel-devel"""
|
||||
def __init__(self, **kwargs):
|
||||
self.name = "kernel"
|
||||
name = "kernel"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(KernelMultilibMethod, self).__init__(*args, **kwargs)
|
||||
|
||||
def select(self, po):
|
||||
if self.is_kernel_or_kernel_devel(po):
|
||||
@ -223,8 +231,10 @@ class KernelMultilibMethod(MultilibMethodBase):
|
||||
|
||||
class YabootMultilibMethod(MultilibMethodBase):
|
||||
"""yaboot on ppc"""
|
||||
def __init__(self, **kwargs):
|
||||
self.name = "yaboot"
|
||||
name = "yaboot"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(YabootMultilibMethod, self).__init__(*args, **kwargs)
|
||||
|
||||
def select(self, po):
|
||||
if po.arch in ["ppc"]:
|
||||
@ -237,9 +247,10 @@ class DevelMultilibMethod(MultilibMethodBase):
|
||||
"""all -devel and -static packages"""
|
||||
name = "devel"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.blacklist = read_lines_from_file("/usr/share/pungi/multilib/devel-blacklist.conf")
|
||||
self.whitelist = read_lines_from_file("/usr/share/pungi/multilib/devel-whitelist.conf")
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(DevelMultilibMethod, self).__init__(*args, **kwargs)
|
||||
self.blacklist = read_lines_from_file(self.config_path+"devel-blacklist.conf")
|
||||
self.whitelist = read_lines_from_file(self.config_path+"devel-whitelist.conf")
|
||||
|
||||
def select(self, po):
|
||||
if self.skip(po):
|
||||
@ -267,9 +278,17 @@ class DevelMultilibMethod(MultilibMethodBase):
|
||||
|
||||
DEFAULT_METHODS = ["devel", "runtime"]
|
||||
METHOD_MAP = {}
|
||||
for cls in (AllMultilibMethod, DevelMultilibMethod, FileMultilibMethod, KernelMultilibMethod, NoneMultilibMethod, RuntimeMultilibMethod, YabootMultilibMethod):
|
||||
method = cls()
|
||||
METHOD_MAP[method.name] = method
|
||||
|
||||
def init(config_path="/usr/share/pungi/multilib/"):
|
||||
global METHOD_MAP
|
||||
|
||||
if not config_path.endswith("/"):
|
||||
config_path += "/"
|
||||
|
||||
for cls in (AllMultilibMethod, DevelMultilibMethod, FileMultilibMethod, KernelMultilibMethod,
|
||||
NoneMultilibMethod, RuntimeMultilibMethod, YabootMultilibMethod):
|
||||
method = cls(config_path)
|
||||
METHOD_MAP[method.name] = method
|
||||
|
||||
|
||||
def po_is_multilib(po, methods):
|
||||
@ -384,6 +403,7 @@ def main():
|
||||
if not opts.tmpdir:
|
||||
tmpdir = tempfile.mkdtemp(prefix="multilib_")
|
||||
|
||||
init()
|
||||
nvra_list = do_multilib(opts.arch, opts.method, opts.repos, tmpdir, opts.logfile)
|
||||
for nvra, method in nvra_list:
|
||||
print "MULTILIB(%s): %s" % (method, nvra)
|
||||
|
Loading…
Reference in New Issue
Block a user