auto selecting backend with 'pkgmgr=auto'
authorGui Chen <gui.chen@intel.com>
Tue, 21 Aug 2012 15:31:01 +0000 (23:31 +0800)
committerGui Chen <gui.chen@intel.com>
Tue, 21 Aug 2012 15:33:05 +0000 (23:33 +0800)
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/conf.py
mic/rt_util.py
plugins/imager/fs_plugin.py
plugins/imager/livecd_plugin.py
plugins/imager/liveusb_plugin.py
plugins/imager/loop_plugin.py
plugins/imager/raw_plugin.py

index c7d3317..5177480 100644 (file)
@@ -44,7 +44,7 @@ class ConfigMgr(object):
                     "outdir": './mic-output',
 
                     "arch": None, # None means auto-detect
-                    "pkgmgr": "yum",
+                    "pkgmgr": "auto",
                     "name": "output",
                     "ksfile": None,
                     "ks": None,
@@ -227,7 +227,7 @@ class ConfigMgr(object):
                 self.bootstrap['enable'] = parser.getboolean('main', 'enable')
             except:
                 self.bootstrap['enable'] = False
-        if self.bootstrap['distro_name']:
+        if not self.bootstrap['distro_name']:
             self.bootstrap['distro_name'] = self.common['distro_name']
 
 configmgr = ConfigMgr()
index f538271..16834f5 100644 (file)
@@ -149,10 +149,8 @@ def sync_mic(bootstrap, binpth = '/usr/bin/mic',
             raise errors.BootstrapError(err)
 
     # clean stuff:
-    # yum backend, not available in bootstrap;
     # bootstrap.conf, disable bootstrap mode inside bootstrap
-    clrpaths = [os.path.join(libpth, 'plugins/backend/yumpkgmgr.py'),
-                os.path.join(libpth, 'plugins/backend/yumpkgmgr.pyc'),
+    clrpaths = [
                 '/etc/mic/bootstrap.conf',
                ]
 
@@ -162,9 +160,9 @@ def sync_mic(bootstrap, binpth = '/usr/bin/mic',
         except:
             pass
 
-    # use default zypp backend
+    # auto select backend
     conf_str = file(_path(conf)).read()
-    conf_str = re.sub("pkgmgr\s*=\s*yum", "pkgmgr=zypp", conf_str)
+    conf_str = re.sub("pkgmgr\s*=\s*.*", "pkgmgr=auto", conf_str)
     with open(_path(conf), 'w') as wf:
         wf.write(conf_str)
 
index 03b3b1b..d972fe5 100644 (file)
@@ -67,7 +67,10 @@ class FsPlugin(ImagerPlugin):
         # try to find the pkgmgr
         pkgmgr = None
         for (key, pcls) in pluginmgr.get_plugins('backend').iteritems():
-            if key == creatoropts['pkgmgr']:
+            if 'auto' == creatoropts['pkgmgr']:
+                pkgmgr = pcls
+                break
+            elif key == creatoropts['pkgmgr']:
                 pkgmgr = pcls
                 break
 
index 680217e..424404f 100644 (file)
@@ -67,7 +67,10 @@ class LiveCDPlugin(ImagerPlugin):
         # try to find the pkgmgr
         pkgmgr = None
         for (key, pcls) in pluginmgr.get_plugins('backend').iteritems():
-            if key == creatoropts['pkgmgr']:
+            if 'auto' == creatoropts['pkgmgr']:
+                pkgmgr = pcls
+                break
+            elif key == creatoropts['pkgmgr']:
                 pkgmgr = pcls
                 break
 
index 4b357e4..01afcbb 100644 (file)
@@ -69,7 +69,10 @@ class LiveUSBPlugin(ImagerPlugin):
         # try to find the pkgmgr
         pkgmgr = None
         for (key, pcls) in pluginmgr.get_plugins('backend').iteritems():
-            if key == creatoropts['pkgmgr']:
+            if 'auto' == creatoropts['pkgmgr']:
+                pkgmgr = pcls
+                break
+            elif key == creatoropts['pkgmgr']:
                 pkgmgr = pcls
                 break
 
index 28171b7..6c22b82 100644 (file)
@@ -74,7 +74,10 @@ class LoopPlugin(ImagerPlugin):
         # try to find the pkgmgr
         pkgmgr = None
         for (key, pcls) in pluginmgr.get_plugins('backend').iteritems():
-            if key == creatoropts['pkgmgr']:
+            if 'auto' == creatoropts['pkgmgr']:
+                pkgmgr = pcls
+                break
+            elif key == creatoropts['pkgmgr']:
                 pkgmgr = pcls
                 break
 
index e536443..8f31c03 100644 (file)
@@ -72,7 +72,10 @@ class RawPlugin(ImagerPlugin):
         # try to find the pkgmgr
         pkgmgr = None
         for (key, pcls) in pluginmgr.get_plugins('backend').iteritems():
-            if key == creatoropts['pkgmgr']:
+            if 'auto' == creatoropts['pkgmgr']:
+                pkgmgr = pcls
+                break
+            elif key == creatoropts['pkgmgr']:
                 pkgmgr = pcls
                 break