summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-01-10 19:46:09 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-16 18:05:13 +0000
commitfae29ac08307c017b8e2875f65346e5cae431d40 (patch)
tree3235b4a7923f148e3e1ecd8e555c27366d2744b0
parentc1bb8c9b141c42473fc4895276677340bd898bef (diff)
downloadpoky-fae29ac08307c017b8e2875f65346e5cae431d40.tar.gz
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>
-rw-r--r--scripts/lib/wic/utils/oe/misc.py14
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 73d8c225ad..727d519840 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):
70 else: 70 else:
71 ret, out = runner.runtool(args, catch) 71 ret, out = runner.runtool(args, catch)
72 out = out.strip() 72 out = out.strip()
73 if ret != 0:
74 msger.error("_exec_cmd: %s returned '%s' instead of 0\noutput: %s" % \
75 (cmd_and_args, ret, out))
76
73 msger.debug("_exec_cmd: output for %s (rc = %d): %s" % \ 77 msger.debug("_exec_cmd: output for %s (rc = %d): %s" % \
74 (cmd_and_args, ret, out)) 78 (cmd_and_args, ret, out))
75 79
@@ -84,10 +88,6 @@ def exec_cmd(cmd_and_args, as_shell=False, catch=3):
84 """ 88 """
85 ret, out = _exec_cmd(cmd_and_args, as_shell, catch) 89 ret, out = _exec_cmd(cmd_and_args, as_shell, catch)
86 90
87 if ret != 0:
88 msger.error("exec_cmd: %s returned '%s' instead of 0" % \
89 (cmd_and_args, ret))
90
91 return out 91 return out
92 92
93def exec_native_cmd(cmd_and_args, native_sysroot, catch=3, pseudo=""): 93def 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=""):
131 msg += "Wic failed to find a recipe to build native %s. Please "\ 131 msg += "Wic failed to find a recipe to build native %s. Please "\
132 "file a bug against wic.\n" % prog 132 "file a bug against wic.\n" % prog
133 msger.error(msg) 133 msger.error(msg)
134 if out:
135 msger.debug('"%s" output: %s' % (args[0], out))
136
137 if ret != 0:
138 msger.error("exec_cmd: '%s' returned '%s' instead of 0" % \
139 (cmd_and_args, ret))
140 134
141 return ret, out 135 return ret, out
142 136