aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/package.bbclass
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-07-02 13:19:10 +0100
committerSaul Wold <sgw@linux.intel.com>2013-07-02 07:58:10 -0700
commit34179cc78b730ecb8ff3f4feb4beee2d17498ce3 (patch)
tree6236046d3d6c32cbee9a27503d8a2512eb91157e /meta/classes/package.bbclass
parentb7c2e01753e4a09388a3282e534bcbd163cd6ef7 (diff)
downloadopenembedded-core-contrib-34179cc78b730ecb8ff3f4feb4beee2d17498ce3.tar.gz
classes/package: print command output when commands fail
When external commands such as debugedit fail, it can be useful to see their output, so use oe.utils.getstatusoutput() instead of subprocess.call() to capture this and print it on failure. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r--meta/classes/package.bbclass29
1 files changed, 14 insertions, 15 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 8e6029a0a3..5c2d1c6553 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -236,7 +236,7 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
#
# sourcefile is also generated containing a list of debugsources
- import stat, subprocess
+ import stat
dvar = d.getVar('PKGD', True)
objcopy = d.getVar("OBJCOPY", True)
@@ -257,22 +257,22 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
# We need to extract the debug src information here...
if debugsrcdir:
cmd = "'%s' -b '%s' -d '%s' -i -l '%s' '%s'" % (debugedit, workparentdir, debugsrcdir, sourcefile, file)
- retval = subprocess.call(cmd, shell=True)
+ (retval, output) = oe.utils.getstatusoutput(cmd)
if retval:
- bb.fatal("debugedit failed with exit code %s (cmd was %s)" % (retval, cmd))
+ bb.fatal("debugedit failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
bb.utils.mkdirhier(os.path.dirname(debugfile))
cmd = "'%s' --only-keep-debug '%s' '%s'" % (objcopy, file, debugfile)
- retval = subprocess.call(cmd, shell=True)
+ (retval, output) = oe.utils.getstatusoutput(cmd)
if retval:
- bb.fatal("objcopy failed with exit code %s (cmd was %s)" % (retval, cmd))
+ bb.fatal("objcopy failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
# Set the debuglink to have the view of the file path on the target
cmd = "'%s' --add-gnu-debuglink='%s' '%s'" % (objcopy, debugfile, file)
- retval = subprocess.call(cmd, shell=True)
+ (retval, output) = oe.utils.getstatusoutput(cmd)
if retval:
- bb.fatal("objcopy failed with exit code %s (cmd was %s)" % (retval, cmd))
+ bb.fatal("objcopy failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
if newmode:
os.chmod(file, origmode)
@@ -283,7 +283,7 @@ def copydebugsources(debugsrcdir, d):
# The debug src information written out to sourcefile is further procecessed
# and copied to the destination here.
- import stat, subprocess
+ import stat
sourcefile = d.expand("${WORKDIR}/debugsources.list")
if debugsrcdir and os.path.isfile(sourcefile):
@@ -311,7 +311,7 @@ def copydebugsources(debugsrcdir, d):
processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)"
cmd = processdebugsrc % (sourcefile, workbasedir, workparentdir, dvar, debugsrcdir)
- retval = subprocess.call(cmd, shell=True)
+ (retval, output) = oe.utils.getstatusoutput(cmd)
# Can "fail" if internal headers/transient sources are attempted
#if retval:
# bb.fatal("debug source copy failed with exit code %s (cmd was %s)" % (retval, cmd))
@@ -319,9 +319,9 @@ def copydebugsources(debugsrcdir, d):
# The copy by cpio may have resulted in some empty directories! Remove these
cmd = "find %s%s -empty -type d -delete" % (dvar, debugsrcdir)
- retval = subprocess.call(cmd, shell=True)
+ (retval, output) = oe.utils.getstatusoutput(cmd)
if retval:
- bb.fatal("empty directory removal failed with exit code %s (cmd was %s)" % (retval, cmd))
+ bb.fatal("empty directory removal failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
# Also remove debugsrcdir if its empty
for p in nosuchdir[::-1]:
@@ -446,7 +446,6 @@ python package_do_split_locales() {
}
python perform_packagecopy () {
- import subprocess
dest = d.getVar('D', True)
dvar = d.getVar('PKGD', True)
@@ -454,9 +453,9 @@ python perform_packagecopy () {
# files to operate on
# Preserve sparse files and hard links
cmd = 'tar -cf - -C %s -ps . | tar -xf - -C %s' % (dest, dvar)
- retval = subprocess.call(cmd, shell=True)
+ (retval, output) = oe.utils.getstatusoutput(cmd)
if retval:
- bb.fatal("file copy failed with exit code %s (cmd was %s)" % (retval, cmd))
+ bb.fatal("file copy failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
# replace RPATHs for the nativesdk binaries, to make them relocatable
if bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('cross-canadian', d):
@@ -916,7 +915,7 @@ python split_and_strip_files () {
}
python populate_packages () {
- import glob, re, subprocess
+ import glob, re
workdir = d.getVar('WORKDIR', True)
outdir = d.getVar('DEPLOY_DIR', True)