Merge release-0.28.17 from 'tools/mic'
[platform/upstream/mic.git] / mic / bootstrap.py
index c3e8471..e2ea8f1 100644 (file)
@@ -23,6 +23,7 @@ import shutil
 import subprocess
 import rpm
 import glob
+import errno
 
 from mic import msger
 from mic.utils import errors, proxy, misc
@@ -161,7 +162,7 @@ class MiniBackend(object):
         # list means some errors happened in the transaction and non-empty 
         # list that there were errors preventing the ts from starting...
         if errs is not None:
-             raise errors.BootstrapError("Transaction couldn't start: %s" % '\n'.join(errs))
+             raise errors.BootstrapError("Transaction couldn't start: %s" % errs)
 
     def run_pkg_script(self, pkg, prog, script, arg):
         mychroot = lambda: os.chroot(self.rootdir)
@@ -179,12 +180,12 @@ class MiniBackend(object):
         script = script.replace('\r', '')
         os.write(tmpfd, script)
         os.close(tmpfd)
-        os.chmod(tmpfp, 0700)
+        os.chmod(tmpfp, 0o700)
 
         try:
             script_fp = os.path.join('/tmp', os.path.basename(tmpfp))
             subprocess.call([prog, script_fp, arg], preexec_fn=mychroot)
-        except (OSError, IOError), err:
+        except (OSError, IOError) as err:
             msger.warning(str(err))
         finally:
             os.unlink(tmpfp)
@@ -238,7 +239,7 @@ class Bootstrap(object):
             pkgmgr.optionals = list(optlist)
             map(pkgmgr.selectPackage, pkglist + list(optlist))
             pkgmgr.runInstall()
-        except (OSError, IOError, errors.CreatorError), err:
+        except (OSError, IOError, errors.CreatorError) as err:
             raise errors.BootstrapError("%s" % err)
 
     def run(self, cmd, chdir, rootdir=None, bindmounts=None):
@@ -312,7 +313,8 @@ class Bootstrap(object):
         gloablmounts = None
         try:
             proxy.set_proxy_environ()
-            gloablmounts = setup_chrootenv(rootdir, bindmounts)
+            #globalmounts is no useless, remove it, currently function always return none.
+            setup_chrootenv(rootdir, bindmounts)
             sync_timesetting(rootdir)
             sync_passwdfile(rootdir)
             sync_hostfile(rootdir)
@@ -326,7 +328,7 @@ class Bootstrap(object):
             # add additional information to original exception
             value, tb = sys.exc_info()[1:]
             value = '%s: %s' % (value, ' '.join(cmd))
-            raise RuntimeError, value, tb
+            raise RuntimeError (value, tb)
         finally:
             #if self.logfile and os.path.isfile(self.logfile):
             #    msger.log(file(self.logfile).read())