Am Mon, 20 Apr 2009 19:59:22 +0000 (UTC)
schrieb Jeremy Katz <katzj(a)fedoraproject.org>:
imgcreate/creator.py | 3 +++
tools/image-creator | 5 +++++
tools/livecd-creator | 6 ++++++
3 files changed, 14 insertions(+)
New commits:
commit 456c1682e5352a1b2277195d5c261d530a014d30
Author: Martin Langhoff <martin(a)laptop.org>
Date: Mon Apr 20 18:50:03 2009 +0200
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
diff --git a/imgcreate/creator.py b/imgcreate/creator.py
index 823afc5..a7c79c7 100644
--- a/imgcreate/creator.py
+++ b/imgcreate/creator.py
@@ -760,6 +760,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 6f2604c..51b2558 100755
--- a/tools/image-creator
+++ b/tools/image-creator
@@ -30,6 +30,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")
imgcreate.setup_logging(parser)
@@ -61,6 +63,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 39f7478..c534900 100755
--- a/tools/livecd-creator
+++ b/tools/livecd-creator
@@ -60,6 +60,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) @@ -118,6 +121,9 @@ def main():
if options.cachedir:
options.cachedir = os.path.abspath(options.cachedir)
+ if options.debug:
+ creator.setdebug()
+
try:
creator.mount(options.base_on, options.cachedir)
creator.install()
After this patch livecd-creator is broken:
# livecd-creator --help
Traceback (most recent call last):
File "/usr/bin/livecd-creator", line 146, in <module>
sys.exit(main())
File "/usr/bin/livecd-creator", line 86, in main
options = parse_options(sys.argv[1:])
File "/usr/bin/livecd-creator", line 64, in parse_options
help="Enable debugging during the build")
File "/usr/lib64/python2.6/optparse.py", line 1014, in add_option
self._check_conflict(option)
File "/usr/lib64/python2.6/optparse.py", line 989, in _check_conflict
option)
optparse.OptionConflictError: option -d/--debug: conflicting option
string(s): -d, --debug
Sebastian