summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-07-02 13:19:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-07-02 22:26:57 +0100
commit74a1426551c7451d2a990fa0eb5225dc02251764 (patch)
tree9c191d472e62fca3a0bb9869683c8ebbecb9a36e /meta
parent209f92b68fd4bded350525ea5df70c2df9484bd9 (diff)
downloadpoky-74a1426551c7451d2a990fa0eb5225dc02251764.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. (From OE-Core rev: 34179cc78b730ecb8ff3f4feb4beee2d17498ce3) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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):
236 # 236 #
237 # sourcefile is also generated containing a list of debugsources 237 # sourcefile is also generated containing a list of debugsources
238 238
239 import stat, subprocess 239 import stat
240 240
241 dvar = d.getVar('PKGD', True) 241 dvar = d.getVar('PKGD', True)
242 objcopy = d.getVar("OBJCOPY", True) 242 objcopy = d.getVar("OBJCOPY", True)
@@ -257,22 +257,22 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
257 # We need to extract the debug src information here... 257 # We need to extract the debug src information here...
258 if debugsrcdir: 258 if debugsrcdir:
259 cmd = "'%s' -b '%s' -d '%s' -i -l '%s' '%s'" % (debugedit, workparentdir, debugsrcdir, sourcefile, file) 259 cmd = "'%s' -b '%s' -d '%s' -i -l '%s' '%s'" % (debugedit, workparentdir, debugsrcdir, sourcefile, file)
260 retval = subprocess.call(cmd, shell=True) 260 (retval, output) = oe.utils.getstatusoutput(cmd)
261 if retval: 261 if retval:
262 bb.fatal("debugedit failed with exit code %s (cmd was %s)" % (retval, cmd)) 262 bb.fatal("debugedit failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
263 263
264 bb.utils.mkdirhier(os.path.dirname(debugfile)) 264 bb.utils.mkdirhier(os.path.dirname(debugfile))
265 265
266 cmd = "'%s' --only-keep-debug '%s' '%s'" % (objcopy, file, debugfile) 266 cmd = "'%s' --only-keep-debug '%s' '%s'" % (objcopy, file, debugfile)
267 retval = subprocess.call(cmd, shell=True) 267 (retval, output) = oe.utils.getstatusoutput(cmd)
268 if retval: 268 if retval:
269 bb.fatal("objcopy failed with exit code %s (cmd was %s)" % (retval, cmd)) 269 bb.fatal("objcopy failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
270 270
271 # Set the debuglink to have the view of the file path on the target 271 # Set the debuglink to have the view of the file path on the target
272 cmd = "'%s' --add-gnu-debuglink='%s' '%s'" % (objcopy, debugfile, file) 272 cmd = "'%s' --add-gnu-debuglink='%s' '%s'" % (objcopy, debugfile, file)
273 retval = subprocess.call(cmd, shell=True) 273 (retval, output) = oe.utils.getstatusoutput(cmd)
274 if retval: 274 if retval:
275 bb.fatal("objcopy failed with exit code %s (cmd was %s)" % (retval, cmd)) 275 bb.fatal("objcopy failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
276 276
277 if newmode: 277 if newmode:
278 os.chmod(file, origmode) 278 os.chmod(file, origmode)
@@ -283,7 +283,7 @@ def copydebugsources(debugsrcdir, d):
283 # The debug src information written out to sourcefile is further procecessed 283 # The debug src information written out to sourcefile is further procecessed
284 # and copied to the destination here. 284 # and copied to the destination here.
285 285
286 import stat, subprocess 286 import stat
287 287
288 sourcefile = d.expand("${WORKDIR}/debugsources.list") 288 sourcefile = d.expand("${WORKDIR}/debugsources.list")
289 if debugsrcdir and os.path.isfile(sourcefile): 289 if debugsrcdir and os.path.isfile(sourcefile):
@@ -311,7 +311,7 @@ def copydebugsources(debugsrcdir, d):
311 processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)" 311 processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)"
312 312
313 cmd = processdebugsrc % (sourcefile, workbasedir, workparentdir, dvar, debugsrcdir) 313 cmd = processdebugsrc % (sourcefile, workbasedir, workparentdir, dvar, debugsrcdir)
314 retval = subprocess.call(cmd, shell=True) 314 (retval, output) = oe.utils.getstatusoutput(cmd)
315 # Can "fail" if internal headers/transient sources are attempted 315 # Can "fail" if internal headers/transient sources are attempted
316 #if retval: 316 #if retval:
317 # bb.fatal("debug source copy failed with exit code %s (cmd was %s)" % (retval, cmd)) 317 # bb.fatal("debug source copy failed with exit code %s (cmd was %s)" % (retval, cmd))
@@ -319,9 +319,9 @@ def copydebugsources(debugsrcdir, d):
319 319
320 # The copy by cpio may have resulted in some empty directories! Remove these 320 # The copy by cpio may have resulted in some empty directories! Remove these
321 cmd = "find %s%s -empty -type d -delete" % (dvar, debugsrcdir) 321 cmd = "find %s%s -empty -type d -delete" % (dvar, debugsrcdir)
322 retval = subprocess.call(cmd, shell=True) 322 (retval, output) = oe.utils.getstatusoutput(cmd)
323 if retval: 323 if retval:
324 bb.fatal("empty directory removal failed with exit code %s (cmd was %s)" % (retval, cmd)) 324 bb.fatal("empty directory removal failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
325 325
326 # Also remove debugsrcdir if its empty 326 # Also remove debugsrcdir if its empty
327 for p in nosuchdir[::-1]: 327 for p in nosuchdir[::-1]:
@@ -446,7 +446,6 @@ python package_do_split_locales() {
446} 446}
447 447
448python perform_packagecopy () { 448python perform_packagecopy () {
449 import subprocess
450 dest = d.getVar('D', True) 449 dest = d.getVar('D', True)
451 dvar = d.getVar('PKGD', True) 450 dvar = d.getVar('PKGD', True)
452 451
@@ -454,9 +453,9 @@ python perform_packagecopy () {
454 # files to operate on 453 # files to operate on
455 # Preserve sparse files and hard links 454 # Preserve sparse files and hard links
456 cmd = 'tar -cf - -C %s -ps . | tar -xf - -C %s' % (dest, dvar) 455 cmd = 'tar -cf - -C %s -ps . | tar -xf - -C %s' % (dest, dvar)
457 retval = subprocess.call(cmd, shell=True) 456 (retval, output) = oe.utils.getstatusoutput(cmd)
458 if retval: 457 if retval:
459 bb.fatal("file copy failed with exit code %s (cmd was %s)" % (retval, cmd)) 458 bb.fatal("file copy failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
460 459
461 # replace RPATHs for the nativesdk binaries, to make them relocatable 460 # replace RPATHs for the nativesdk binaries, to make them relocatable
462 if bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('cross-canadian', d): 461 if bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('cross-canadian', d):
@@ -916,7 +915,7 @@ python split_and_strip_files () {
916} 915}
917 916
918python populate_packages () { 917python populate_packages () {
919 import glob, re, subprocess 918 import glob, re
920 919
921 workdir = d.getVar('WORKDIR', True) 920 workdir = d.getVar('WORKDIR', True)
922 outdir = d.getVar('DEPLOY_DIR', True) 921 outdir = d.getVar('DEPLOY_DIR', True)