add debuginfo rpm install option
authorGui Chen <gui.chen@intel.com>
Mon, 21 Jan 2013 13:52:51 +0000 (21:52 +0800)
committerGui Chen <gui.chen@intel.com>
Mon, 21 Jan 2013 17:38:02 +0000 (01:38 +0800)
make this option flexible to include 'debuginfo',
and enable '--install-pkgs=debuginfo' to work well.
later mic should add 'source' and 'debugsource' to
this option

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

index 37a4672118343d80e04f46dc7fe25ee5c2e1ba25..1d7a6e26ebd3531183d3c3ef80b7e9962c12b62b 100644 (file)
@@ -61,6 +61,7 @@ class ConfigMgr(object):
                     "proxy": None,
                     "no_proxy": None,
                     "copy_kernel": False,
+                    "install_pkgs": None,
                     "repourl": {},
                     "localrepos": [],  # save localrepos
                     "runtime": "bootstrap",
index 26c44a82a8134c16621dd292c226a1a55539e22c..b23cad222e6e0ae1a6a7b93a69be7113e6b7f725 100644 (file)
@@ -107,6 +107,10 @@ class Creator(cmdln.Cmdln):
                              dest='copy_kernel',
                              help='Copy kernel files from image /boot directory'
                                   ' to the image output directory.')
+        optparser.add_option('', '--install-pkgs', type='string', action='store',
+                             dest='install_pkgs', default=None,
+                             help='Specify what type of packages to be installed,'
+                                  ' valid: source, debuginfo, debugsource')
         optparser.add_option('', '--repourl', action='append',
                              dest='repourl', default=[],
                              help=SUPPRESS_HELP)
@@ -226,6 +230,16 @@ class Creator(cmdln.Cmdln):
         if self.options.copy_kernel:
             configmgr.create['copy_kernel'] = self.options.copy_kernel
 
+        if self.options.install_pkgs:
+            configmgr.create['install_pkgs'] = []
+            for pkgtype in self.options.install_pkgs.split(','):
+                if pkgtype not in ('source', 'debuginfo'):
+                    raise errors.Usage('Invalid parameter specified: "%s", '
+                                       'valid values: source, debuginfo, '
+                                       'debusource' % pkgtype)
+
+                configmgr.create['install_pkgs'].append(pkgtype)
+
         if self.options.repourl:
             for item in self.options.repourl:
                 try:
index 05a6fb2db32127e1b15b876eddc81ed88d26b031..0438cbb85e9885a172fa96cd6bf63a14934b5a2f 100644 (file)
@@ -902,6 +902,10 @@ class BaseImageCreator(object):
         pkg_manager = self.get_pkg_manager()
         pkg_manager.setup()
 
+        if hasattr(self, 'install_pkgs') and self.install_pkgs:
+            if 'debuginfo' in self.install_pkgs:
+                pkg_manager.install_debuginfo = True
+
         for repo in kickstart.get_repos(self.ks, repo_urls):
             (name, baseurl, mirrorlist, inc, exc,
              proxy, proxy_username, proxy_password, debuginfo,