From 060edb32bc03be2188b1c21f8f3a0f98eec6de86 Mon Sep 17 00:00:00 2001 From: Gui Chen Date: Mon, 21 Jan 2013 21:52:51 +0800 Subject: [PATCH] add debuginfo rpm install option 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 --- mic/conf.py | 1 + mic/creator.py | 14 ++++++++++++++ mic/imager/baseimager.py | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/mic/conf.py b/mic/conf.py index 37a4672..1d7a6e2 100644 --- a/mic/conf.py +++ b/mic/conf.py @@ -61,6 +61,7 @@ class ConfigMgr(object): "proxy": None, "no_proxy": None, "copy_kernel": False, + "install_pkgs": None, "repourl": {}, "localrepos": [], # save localrepos "runtime": "bootstrap", diff --git a/mic/creator.py b/mic/creator.py index 26c44a8..b23cad2 100644 --- a/mic/creator.py +++ b/mic/creator.py @@ -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: diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py index 05a6fb2..0438cbb 100644 --- a/mic/imager/baseimager.py +++ b/mic/imager/baseimager.py @@ -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, -- 2.7.4