[gnome-continuous-yocto/gnomeostree-3.28-rocko: 4019/8267] wic: _exec_cmd: produce error if exit code is not 0



commit fae29ac08307c017b8e2875f65346e5cae431d40
Author: Ed Bartosh <ed bartosh linux intel com>
Date:   Tue Jan 10 19:46:09 2017 +0200

    wic: _exec_cmd: produce error if exit code is not 0
    
    Current code doesn't always show error output of the
    external command and even ignores non-zero exit code.
    
    Moved checking of exit code value to the lowest level
    possible: to _exec_cmd. This should make wic to always
    check exit code of the external command and issue
    an error if it's not 0.
    
    [YOCTO #10816]
    
    (From OE-Core rev: 7f68001579c08509332d633b27b5c2ea9386b6c9)
    
    Signed-off-by: Ed Bartosh <ed bartosh linux intel com>
    Signed-off-by: Ross Burton <ross burton intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 scripts/lib/wic/utils/oe/misc.py |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index 73d8c22..727d519 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -70,6 +70,10 @@ def _exec_cmd(cmd_and_args, as_shell=False, catch=3):
     else:
         ret, out = runner.runtool(args, catch)
     out = out.strip()
+    if ret != 0:
+        msger.error("_exec_cmd: %s returned '%s' instead of 0\noutput: %s" % \
+                    (cmd_and_args, ret, out))
+
     msger.debug("_exec_cmd: output for %s (rc = %d): %s" % \
                 (cmd_and_args, ret, out))
 
@@ -84,10 +88,6 @@ def exec_cmd(cmd_and_args, as_shell=False, catch=3):
     """
     ret, out = _exec_cmd(cmd_and_args, as_shell, catch)
 
-    if ret != 0:
-        msger.error("exec_cmd: %s returned '%s' instead of 0" % \
-                    (cmd_and_args, ret))
-
     return out
 
 def exec_native_cmd(cmd_and_args, native_sysroot, catch=3, pseudo=""):
@@ -131,12 +131,6 @@ def exec_native_cmd(cmd_and_args, native_sysroot, catch=3, pseudo=""):
             msg += "Wic failed to find a recipe to build native %s. Please "\
                    "file a bug against wic.\n" % prog
         msger.error(msg)
-    if out:
-        msger.debug('"%s" output: %s' % (args[0], out))
-
-    if ret != 0:
-        msger.error("exec_cmd: '%s' returned '%s' instead of 0" % \
-                    (cmd_and_args, ret))
 
     return ret, out
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]