From 657ff50af9ab191a7b5d7b547ac1dd8068619a6e Mon Sep 17 00:00:00 2001 From: Martin Langhoff Date: Mon, 20 Apr 2009 18:50:03 +0200 Subject: [PATCH] creator: "-d" opt and matching setdebug() method that gets rpm in debug mode Useful to diagnose problems with %post scripts during the build. This patch adds the method to the ImageCreator class, and the corresponding options to image-creator and livecd-creator --- imgcreate/creator.py | 3 +++ tools/image-creator | 5 +++++ tools/livecd-creator | 6 ++++++ 3 files changed, 14 insertions(+), 0 deletions(-) diff --git a/imgcreate/creator.py b/imgcreate/creator.py index 132c044..fe87872 100644 --- a/imgcreate/creator.py +++ b/imgcreate/creator.py @@ -746,6 +746,9 @@ class ImageCreator(object): shutil.move(os.path.join(self._outdir, f), os.path.join(destdir, f)) + def setdebug(self): + rpm.setVerbosity(rpm.RPMLOG_DEBUG) + def create(self): """Install, configure and package an image. diff --git a/tools/image-creator b/tools/image-creator index aca9228..ce97f30 100755 --- a/tools/image-creator +++ b/tools/image-creator @@ -29,6 +29,8 @@ def parse_options(args): parser.add_option("-n", "--name", type="string", dest="name", help="Image name and filesystem label") + parser.add_option("-d", "--debug", action="store_true", dest="debug", + help="Enable debug mode") (options, args) = parser.parse_args() @@ -58,6 +60,9 @@ def main(): creator = imgcreate.LoopImageCreator(ks, name) + if options.debug: + creator.setdebug() + try: creator.create() except imgcreate.CreatorError, e: diff --git a/tools/livecd-creator b/tools/livecd-creator index 7c08323..bda6293 100755 --- a/tools/livecd-creator +++ b/tools/livecd-creator @@ -57,6 +57,9 @@ def parse_options(args): # Start a shell in the chroot for post-configuration. parser.add_option("-l", "--shell", action="store_true", dest="give_shell", help=optparse.SUPPRESS_HELP) + parser.add_option("-d", "--debug", action="store_true", dest="debug", + help="Enable debugging during the build") + # Don't compress the image. parser.add_option("-s", "--skip-compression", action="store_true", dest="skip_compression", help=optparse.SUPPRESS_HELP) @@ -110,6 +113,9 @@ def main(): creator.skip_compression = options.skip_compression creator.skip_minimize = options.skip_minimize + if options.debug: + creator.setdebug() + try: creator.mount(options.base_on, options.cachedir) creator.install() -- 1.6.0.6