introduce '--check-pkgs' to check packages included
authorGui Chen <gui.chen@intel.com>
Thu, 27 Jun 2013 07:04:27 +0000 (03:04 -0400)
committerGui Chen <gui.chen@intel.com>
Thu, 27 Jun 2013 09:53:06 +0000 (05:53 -0400)
in some situation like pre-release image, they expect mic
not going on if there are some packages not going to include
in the image

Example: --check-pkgs=eglibc,bash
if either of eglibc and bash will not be present in the image,
mic should not go on the image creation

Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/conf.py
mic/creator.py

index e37334c..1de644f 100644 (file)
@@ -64,6 +64,7 @@ class ConfigMgr(object):
                     "no_proxy": None,
                     "copy_kernel": False,
                     "install_pkgs": None,
+                    "check_pkgs": [],
                     "repourl": {},
                     "localrepos": [],  # save localrepos
                     "runtime": "bootstrap",
index af5fb82..ecacf04 100644 (file)
@@ -112,6 +112,10 @@ class Creator(cmdln.Cmdln):
                              dest='install_pkgs', default=None,
                              help='Specify what type of packages to be installed,'
                                   ' valid: source, debuginfo, debugsource')
+        optparser.add_option('', '--check-pkgs', type='string', action='store',
+                             dest='check_pkgs', default=[],
+                             help='Check if given packages would be installed, '
+                                  'packages should be separated by comma')
         optparser.add_option('', '--tmpfs', action='store_true', dest='enabletmpfs',
                              help='Setup tmpdir as tmpfs to accelerate, experimental'
                                   ' feature, use it if you have more than 4G memory')
@@ -244,6 +248,10 @@ class Creator(cmdln.Cmdln):
 
                 configmgr.create['install_pkgs'].append(pkgtype)
 
+        if self.options.check_pkgs:
+            for pkg in self.options.check_pkgs.split(','):
+                configmgr.create['check_pkgs'].append(pkg)
+
         if self.options.enabletmpfs:
             configmgr.create['enabletmpfs'] = self.options.enabletmpfs