Allow mash to export arbitrary packages in multilib repositories

Bill Nottingham notting at redhat.com
Thu Jul 14 21:07:15 UTC 2011


joaopfv at br.ibm.com (joaopfv at br.ibm.com) said: 
> In one of our project, we tried to use the 'multilib_method = file' in the 
> configuration_file.mash; however it seems like that the current version of 
> mash doesn't correctly supports it.
> 
> The constructor of FileMultilibMethod, implemented on multilib.py, demands 
> a valid path for a file containing a list o packages to be exported. 
> However the method detectMultilibMethod implemented on __init__.py doesn't 
> provide it; thus the program crashes.
> 
> I would like to know if I may suggest a modification that apparently fix 
> this issue. This would allow the user provide the file through the option 
> 'multilib_file = file_list.multilib', where file_list.multilib must be on 
> the same directory of the configuration_file.mash.

Patch 371/371? I'm curious what the first 370 patches are.

In any case, does this modified version work for you? I find it a little
cleaner.

Bill
-------------- next part --------------
diff --git a/mash/__init__.py b/mash/__init__.py
index 719f76b..9646248 100644
--- a/mash/__init__.py
+++ b/mash/__init__.py
@@ -441,7 +441,7 @@ class Mash:
                        'kernel'  : multilib.KernelMultilibMethod,
                        'all'     : multilib.AllMultilibMethod,
                        'none'    : multilib.NoMultilibMethod,
-                       'runtime' : multilib.RuntimeMultilibMethod}[self.config.multilib_method]()
+                       'runtime' : multilib.RuntimeMultilibMethod}[self.config.multilib_method](self.config.multilib_file)
         except KeyError:
             self.logger.error("Invalid multilib method %s" % (self.config.multilib_method,))
             do_multi = False
diff --git a/mash/config.py b/mash/config.py
index c94ea4a..e456146 100644
--- a/mash/config.py
+++ b/mash/config.py
@@ -28,6 +28,7 @@ class MashConfig(config.BaseConfig):
     debuginfo_path = config.Option('%(arch)s/debug')
     multilib = config.BoolOption(True)
     multilib_method = config.Option('devel')
+    multilib_file = config.Option()
     arches = config.ListOption()
     keys = config.ListOption()
     configdir = config.Option('/etc/mash')
@@ -62,10 +63,12 @@ class MashDistroConfig(config.BaseConfig):
     debuginfo_path = config.Inherit(MashConfig.debuginfo_path)
     multilib = config.Inherit(MashConfig.multilib)
     multilib_method = config.Inherit(MashConfig.multilib_method)
+    multilib_file = config.Inherit(MashConfig.multilib_file)
     arches = config.Inherit(MashConfig.arches)
     tag = config.Option()
     inherit = config.BoolOption(True)
     keys = config.Inherit(MashConfig.keys)
+    configdir = config.Inherit(MashConfig.configdir)
     strict_keys = config.Inherit(MashConfig.strict_keys)
     buildhost = config.Inherit(MashConfig.buildhost)
     repodir = config.Inherit(MashConfig.repodir)
@@ -122,6 +125,8 @@ def readMainConfig(conf):
                 if not thisdistro.repodata_path:
                     thisdistro.repodata_path = os.path.dirname(thisdistro.rpm_path)
                 thisdistro.keys = map(string.lower, thisdistro.keys)
+                if thisdistro.multilib_file and thisdistro.multilib_file[0] != '/':
+                    thisdistro.multilib_file = os.path.join(thisdistro.configdir, thisdistro.multilib_file)
                 if len(thisdistro.keys) == 0:
                     thisdistro.keys = ['']
                 config.distros.append(thisdistro)
diff --git a/mash/multilib.py b/mash/multilib.py
index 1c4e6cb..81fdf4a 100644
--- a/mash/multilib.py
+++ b/mash/multilib.py
@@ -14,7 +14,7 @@
 from fnmatch import fnmatch
 
 class MultilibMethod:
-    def __init__(self):
+    def __init__(self, dummy):
         self.name = 'base'
     def select(self, po):
         prefer_64 = [ 'gdb', 'frysk', 'systemtap', 'systemtap-runtime', 'ltrace', 'strace' ]
@@ -28,14 +28,14 @@ class MultilibMethod:
         return False
 
 class NoMultilibMethod:
-    def __init__(self):
+    def __init__(self, dummy):
         self.name = 'none'
         
     def select(self, po):
         return False
 
 class AllMultilibMethod(MultilibMethod):
-    def __init__(self):
+    def __init__(self, dummy):
         self.name = 'all'
     
     def select(self, po):
@@ -52,7 +52,7 @@ class FileMultilibMethod(MultilibMethod):
             for line in lines:
                 line = line.strip()
                 if not line.startswith('#'):
-                    list.append(line)
+                    self.list.append(line)
     
     def select(self, po):
         for item in self.list:
@@ -61,7 +61,7 @@ class FileMultilibMethod(MultilibMethod):
         return False
 
 class KernelMultilibMethod:
-    def __init__(self):
+    def __init__(self, dummy):
         self.name = 'base'
     def select(self, po):
         if po.arch.find('64') != -1:
@@ -72,7 +72,7 @@ class KernelMultilibMethod:
         return False
             
 class RuntimeMultilibMethod(MultilibMethod):
-    def __init__(self):
+    def __init__(self, dummy):
         self.name = 'runtime'
     
     def select(self, po):
@@ -160,7 +160,7 @@ class RuntimeMultilibMethod(MultilibMethod):
         return False
 
 class DevelMultilibMethod(RuntimeMultilibMethod):
-    def __init__(self):
+    def __init__(self, dummy):
         self.name = 'devel'
     
     def select(self, po):


More information about the buildsys mailing list