Patchwork [7/7] wic: Hook up --debug option

login
register
mail settings
Submitter tom.zanussi@linux.intel.com
Date Feb. 4, 2014, 1:17 a.m.
Message ID <47e3ea316f19e10f8c3574def2b0d807c574e4ba.1391476329.git.tom.zanussi@linux.intel.com>
Download mbox | patch
Permalink /patch/66293/
State New
Headers show

Comments

tom.zanussi@linux.intel.com - Feb. 4, 2014, 1:17 a.m.
Hook up the existing --debug option to toggle the wic debug loglevel,
which is indispensible when things go wrong, and make it easy to use
from the command-line.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/image/engine.py |  5 ++++-
 scripts/wic                 | 11 +++--------
 2 files changed, 7 insertions(+), 9 deletions(-)

Patch

diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py
index 2dd98b9..6cf6169 100644
--- a/scripts/lib/image/engine.py
+++ b/scripts/lib/image/engine.py
@@ -175,7 +175,7 @@  def list_canned_image_help(scripts_path, fullpath):
 
 def wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir,
                native_sysroot, hdddir, staging_data_dir, scripts_path,
-               image_output_dir, properties_file, properties=None):
+               image_output_dir, debug, properties_file, properties=None):
     """
     Create image
 
@@ -235,6 +235,9 @@  def wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir,
     direct_args.insert(0, staging_data_dir)
     direct_args.insert(0, "direct")
 
+    if debug:
+        msger.set_loglevel('debug')
+
     cr = creator.Creator()
 
     cr.main(direct_args)
diff --git a/scripts/wic b/scripts/wic
index 4ea5569..824acae 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -69,6 +69,8 @@  def wic_create_subcommand(args, usage_str):
                       action = "store", help = "path to the native sysroot containing the tools to use to build the image")
     parser.add_option("-p", "--skip-build-check", dest = "build_check",
                       action = "store_false", default = True, help = "skip the build check")
+    parser.add_option("-D", "--debug", dest = "debug", action = "store_true",
+                      default = False, help = "output debug information")
 
     (options, args) = parser.parse_args(args)
 
@@ -162,7 +164,7 @@  def wic_create_subcommand(args, usage_str):
 
     wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir,
                native_sysroot, hdddir, staging_data_dir, scripts_path,
-               image_output_dir, options.properties_file)
+               image_output_dir, options.debug, options.properties_file)
 
 
 def wic_list_subcommand(args, usage_str):
@@ -203,16 +205,9 @@  def main():
                                    usage = wic_usage)
 
     parser.disable_interspersed_args()
-    parser.add_option("-D", "--debug", dest = "debug", action = "store_true",
-                      default = False, help = "output debug information")
 
     (options, args) = parser.parse_args()
 
-    loglevel = logging.INFO
-    if options.debug:
-        loglevel = logging.DEBUG
-    start_logging(loglevel)
-
     if len(args):
         if args[0] == "help":
             if len(args) == 1: