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 c7d3317a069528e28358c1f6f2072343161ac0c7..51774800372bf3c673511a5a1ab8e9d104245d7f 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 f5382711274c0f058055586aad9a7e8dadc5478a..16834f53a525b5f688f3f62fa29a8c9689a84d78 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 03b3b1b30f3fe4c208ecd495a336ae7c00e81323..d972fe5a77d1683367a9790e1472dc38da303ba6 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 680217ec92be0a3bf3fb03136d5e6d2b3a22b516..424404fd23c94d9e84831d2d16549c104ec2c79b 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 4b357e458eb65b4c3b52a1056fcb94d0d9d7e574..01afcbb27290c0c3d3697494f51dce9273c29ec0 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 28171b7206885125419c03b8727e9ada530b40f7..6c22b8272d98f5bfecce81b6928451b3d43e7b69 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 e5364438b92a7d9790b592a5953e046fa07b21d8..8f31c0391b4fa3594f167ca26bba72bb8e158071 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