]> code.ossystems Code Review - openembedded-core.git/commitdiff
uninative.bbclass: capture stdout/err from patchelf-uninative
authorPatrick Ohly <patrick.ohly@intel.com>
Thu, 11 Feb 2016 06:59:42 +0000 (07:59 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 11 Feb 2016 12:31:32 +0000 (12:31 +0000)
When patchelf-uninative fails, reporting only the exit code
as done by subprocess.check_call() is not enough to understand
the problem. We also need to capture and report the output
of the command.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/uninative.bbclass

index 580917b119277ffea0ff77f5b866f6818bc32412..0448cf6cdcb4c61f405d8c8ed5448acc2dca6843 100644 (file)
@@ -84,5 +84,11 @@ python uninative_changeinterp () {
                 continue
 
             #bb.warn("patchelf-uninative --set-interpreter %s %s" % (d.getVar("UNINATIVE_LOADER", True), f))
-            subprocess.check_call("patchelf-uninative --set-interpreter %s %s" % (d.getVar("UNINATIVE_LOADER", True), f), shell=True)
+            cmd = "patchelf-uninative --set-interpreter %s %s" % (d.getVar("UNINATIVE_LOADER", True), f)
+            p = subprocess.Popen(cmd, shell=True,
+                                 stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+            stdout, stderr = p.communicate()
+            if p.returncode:
+                bb.fatal("'%s' failed with exit code %d and the following output:\n%s" %
+                         (cmd, p.returncode, stdout))
 }