projects
/
platform
/
upstream
/
mic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
725a53a
)
add strict_mode(MHA-1115)
author
Andrii Boichuk
<andrii.boichuk@globallogic.com>
Wed, 23 Jul 2014 13:35:36 +0000
(16:35 +0300)
committer
admin
<yuhuan.yang@samsung.com>
Thu, 4 Feb 2016 10:20:20 +0000
(18:20 +0800)
mic/conf.py
patch
|
blob
|
history
mic/creator.py
patch
|
blob
|
history
mic/imager/baseimager.py
patch
|
blob
|
history
plugins/backend/yumpkgmgr.py
patch
|
blob
|
history
plugins/backend/zypppkgmgr.py
patch
|
blob
|
history
diff --git
a/mic/conf.py
b/mic/conf.py
index
9816245
..
139660a
100644
(file)
--- a/
mic/conf.py
+++ b/
mic/conf.py
@@
-74,6
+74,7
@@
class ConfigMgr(object):
"runtime": "bootstrap",
"extrarepos": {},
"ignore_ksrepo": False,
"runtime": "bootstrap",
"extrarepos": {},
"ignore_ksrepo": False,
+ "strict_mode": False,
},
'chroot': {
"saveto": None,
},
'chroot': {
"saveto": None,
diff --git
a/mic/creator.py
b/mic/creator.py
index
dde1013
..
be4773b
100644
(file)
--- a/
mic/creator.py
+++ b/
mic/creator.py
@@
-129,6
+129,10
@@
class Creator(cmdln.Cmdln):
optparser.add_option('', '--ignore-ksrepo', action='store_true',
dest='ignore_ksrepo', default=False,
help=SUPPRESS_HELP)
optparser.add_option('', '--ignore-ksrepo', action='store_true',
dest='ignore_ksrepo', default=False,
help=SUPPRESS_HELP)
+ optparser.add_option('', '--strict_mode', action='store_true',
+ dest='strict_mode', default=False,
+ help='Abort creation of image, if there are some errors'
+ ' during rpm installation. ')
return optparser
def preoptparse(self, argv):
return optparser
def preoptparse(self, argv):
@@
-226,6
+230,8
@@
class Creator(cmdln.Cmdln):
configmgr.create['record_pkgs'].append(infotype)
configmgr.create['record_pkgs'].append(infotype)
+ if self.options.strict_mode:
+ configmgr.create['strict_mode'] = self.options.strict_mode
if self.options.arch is not None:
supported_arch = sorted(rpmmisc.archPolicies.keys(), reverse=True)
if self.options.arch in supported_arch:
if self.options.arch is not None:
supported_arch = sorted(rpmmisc.archPolicies.keys(), reverse=True)
if self.options.arch in supported_arch:
diff --git
a/mic/imager/baseimager.py
b/mic/imager/baseimager.py
index
10af5f9
..
63ac3b9
100644
(file)
--- a/
mic/imager/baseimager.py
+++ b/
mic/imager/baseimager.py
@@
-82,6
+82,7
@@
class BaseImageCreator(object):
self.destdir = "."
self.installerfw_prefix = "INSTALLERFW_"
self.target_arch = "noarch"
self.destdir = "."
self.installerfw_prefix = "INSTALLERFW_"
self.target_arch = "noarch"
+ self.strict_mode = False
self._local_pkgs_path = None
self.pack_to = None
self.repourl = {}
self._local_pkgs_path = None
self.pack_to = None
self.repourl = {}
@@
-97,6
+98,7
@@
class BaseImageCreator(object):
"arch" : "target_arch",
"local_pkgs_path" : "_local_pkgs_path",
"copy_kernel" : "_need_copy_kernel",
"arch" : "target_arch",
"local_pkgs_path" : "_local_pkgs_path",
"copy_kernel" : "_need_copy_kernel",
+ "strict_mode" : "strict_mode",
}
# update setting from createopts
}
# update setting from createopts
@@
-1358,7
+1360,8
@@
class BaseImageCreator(object):
def get_pkg_manager(self):
return self.pkgmgr(target_arch = self.target_arch,
instroot = self._instroot,
def get_pkg_manager(self):
return self.pkgmgr(target_arch = self.target_arch,
instroot = self._instroot,
- cachedir = self.cachedir)
+ cachedir = self.cachedir,
+ strict_mode = self.strict_mode)
def create_manifest(self):
def get_pack_suffix():
def create_manifest(self):
def get_pack_suffix():
diff --git
a/plugins/backend/yumpkgmgr.py
b/plugins/backend/yumpkgmgr.py
index
05f4dba
..
8603da3
100644
(file)
--- a/
plugins/backend/yumpkgmgr.py
+++ b/
plugins/backend/yumpkgmgr.py
@@
-112,12
+112,13
@@
from mic.pluginbase import BackendPlugin
class Yum(BackendPlugin, yum.YumBase):
name = 'yum'
class Yum(BackendPlugin, yum.YumBase):
name = 'yum'
- def __init__(self, target_arch, instroot, cachedir):
+ def __init__(self, target_arch, instroot, cachedir
, strict_mode = False
):
yum.YumBase.__init__(self)
self.cachedir = cachedir
self.instroot = instroot
self.target_arch = target_arch
yum.YumBase.__init__(self)
self.cachedir = cachedir
self.instroot = instroot
self.target_arch = target_arch
+ self.strict_mode = strict_mode
if self.target_arch:
if not rpmUtils.arch.arches.has_key(self.target_arch):
if self.target_arch:
if not rpmUtils.arch.arches.has_key(self.target_arch):
@@
-438,7
+439,9
@@
class Yum(BackendPlugin, yum.YumBase):
installlogfile = "%s/__catched_stderr.buf" % (self.instroot)
msger.enable_logstderr(installlogfile)
installlogfile = "%s/__catched_stderr.buf" % (self.instroot)
msger.enable_logstderr(installlogfile)
- self.runTransaction(cb)
+ transactionResult = self.runTransaction(cb)
+ if transactionResult.return_code != 0 and self.strict_mode:
+ raise CreatorError("mic failes to install some packages")
self._cleanupRpmdbLocks(self.conf.installroot)
except rpmUtils.RpmUtilsError, e:
self._cleanupRpmdbLocks(self.conf.installroot)
except rpmUtils.RpmUtilsError, e:
diff --git
a/plugins/backend/zypppkgmgr.py
b/plugins/backend/zypppkgmgr.py
index
e1c7641
..
4a41bea
100644
(file)
--- a/
plugins/backend/zypppkgmgr.py
+++ b/
plugins/backend/zypppkgmgr.py
@@
-54,7
+54,8
@@
from mic.pluginbase import BackendPlugin
class Zypp(BackendPlugin):
name = 'zypp'
class Zypp(BackendPlugin):
name = 'zypp'
- def __init__(self, target_arch, instroot, cachedir):
+ #strict_mode not used in zypp yet(yum only)
+ def __init__(self, target_arch, instroot, cachedir, strict_mode = False):
self.cachedir = cachedir
self.instroot = instroot
self.target_arch = target_arch
self.cachedir = cachedir
self.instroot = instroot
self.target_arch = target_arch