[oe-commits] Tom Zanussi : wic: Make exec_native_command() fail if a command isn' t found

git at git.openembedded.org git at git.openembedded.org
Mon Feb 24 16:14:35 UTC 2014


Module: openembedded-core.git
Branch: master-next
Commit: 43ac6e3216c5d985d6f90a28e727e397df616267
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=43ac6e3216c5d985d6f90a28e727e397df616267

Author: Tom Zanussi <tom.zanussi at linux.intel.com>
Date:   Wed Feb 19 14:53:37 2014 -0600

wic: Make exec_native_command() fail if a command isn't found

Because exec_cmd() return values can in certain cases be non-zero yet
non-fatal, we don't want to automatically make them fatal (though
there should at least be a warning in such cases, which this patch
also does); non-zero return values are definitely fatal however if
they mean that a native command wasn't found, so have
exec_native_cmd() check the return value of exec_cmd() for that case,
and bail out if so.

[YOCTO #5835]

Signed-off-by: Tom Zanussi <tom.zanussi at linux.intel.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>

---

 scripts/lib/mic/utils/oe/misc.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/mic/utils/oe/misc.py b/scripts/lib/mic/utils/oe/misc.py
index d65b77a..7ad3aa9 100644
--- a/scripts/lib/mic/utils/oe/misc.py
+++ b/scripts/lib/mic/utils/oe/misc.py
@@ -51,7 +51,7 @@ def exec_cmd(cmd_and_args, as_shell = False, catch = 3):
         # parted always fails to reload part table with loop devices. This
         # prevents us from distinguishing real errors based on return
         # code.
-        msger.debug("WARNING: %s returned '%s' instead of 0" % (args[0], rc))
+        msger.warning("WARNING: %s returned '%s' instead of 0" % (cmd_and_args, rc))
 
     return (rc, out)
 
@@ -82,7 +82,14 @@ def exec_native_cmd(cmd_and_args, native_sysroot, catch = 3):
     args = cmd_and_args.split()
     msger.debug(args)
 
-    return exec_cmd(native_cmd_and_args, True, catch)
+    rc, out = exec_cmd(native_cmd_and_args, True, catch)
+
+    if rc == 127: # shell command-not-found
+        msger.error("A native (host) program required to build the image "
+                    "was not found (see details above). Please make sure "
+                    "it's installed and try again.")
+
+    return (rc, out)
 
 
 def exec_native_cmd_quiet(cmd_and_args, native_sysroot):



More information about the Openembedded-commits mailing list