aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 17:43:40 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 23:30:44 +0000
commitad750dd1cc9d789abe723daddd098ce41d8547f5 (patch)
treea04de472a68fb60b1a783b3065cd06f6e096a44e
parentda58e27a0f8fc8200f1953f05888834abd79c9f8 (diff)
downloadopenembedded-core-contrib-ad750dd1cc9d789abe723daddd098ce41d8547f5.tar.gz
classes/oeqa: Replace subprocess.check_call() with check_output()
If you use subprocess.check_output() the traceback will contain the output when the command fails which is very useful for debugging. There is no good reason not to use this everywhere. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/sstate.bbclass4
-rw-r--r--meta/classes/staging.bbclass6
-rw-r--r--meta/classes/uninative.bbclass2
-rw-r--r--meta/lib/oe/rootfs.py6
-rw-r--r--meta/lib/oeqa/sdk/utils/sdkbuildproject.py2
-rw-r--r--meta/lib/oeqa/utils/buildproject.py2
-rw-r--r--meta/lib/oeqa/utils/targetbuild.py4
7 files changed, 13 insertions, 13 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index a767a0203b..0fdeb9dfe8 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -573,14 +573,14 @@ python sstate_hardcode_path () {
sstate_hardcode_cmd = "%s | xargs %s | %s | xargs %s %s" % (sstate_scan_cmd, sstate_grep_cmd, sstate_filelist_cmd, xargs_no_empty_run_cmd, sstate_sed_cmd)
bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd))
- subprocess.check_call(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir)
+ subprocess.check_output(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir)
# If the fixmefn is empty, remove it..
if os.stat(fixmefn).st_size == 0:
os.remove(fixmefn)
else:
bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd))
- subprocess.check_call(sstate_filelist_relative_cmd, shell=True)
+ subprocess.check_output(sstate_filelist_relative_cmd, shell=True)
}
def sstate_package(ss, d):
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index 1a4668e5d3..fc387eaf4b 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -290,7 +290,7 @@ def staging_processfixme(fixme, target, recipesysroot, recipesysrootnative, d):
fixme_path = d.getVar(fixmevar)
cmd += " -e 's:FIXME_%s:%s:g'" % (fixmevar, fixme_path)
bb.note(cmd)
- subprocess.check_call(cmd, shell=True)
+ subprocess.check_output(cmd, shell=True)
def staging_populate_sysroot_dir(targetsysroot, nativesysroot, native, d):
@@ -333,7 +333,7 @@ def staging_populate_sysroot_dir(targetsysroot, nativesysroot, native, d):
staging_processfixme(fixme, targetdir, targetsysroot, nativesysroot, d)
for p in postinsts:
- subprocess.check_call(p, shell=True)
+ subprocess.check_output(p, shell=True)
#
# Manifests here are complicated. The main sysroot area has the unpacked sstate
@@ -561,7 +561,7 @@ python extend_recipe_sysroot() {
staging_processfixme(fixme[f], multilibs[f].getVar("RECIPE_SYSROOT"), recipesysroot, recipesysrootnative, d)
for p in postinsts:
- subprocess.check_call(p, shell=True)
+ subprocess.check_output(p, shell=True)
for dep in configuredeps:
c = setscenedeps[dep][0]
diff --git a/meta/classes/uninative.bbclass b/meta/classes/uninative.bbclass
index ba7ca63b8f..410fb72d26 100644
--- a/meta/classes/uninative.bbclass
+++ b/meta/classes/uninative.bbclass
@@ -60,7 +60,7 @@ python uninative_event_fetchloader() {
os.symlink(localpath, tarballpath)
cmd = d.expand("mkdir -p ${UNINATIVE_STAGING_DIR}-uninative; cd ${UNINATIVE_STAGING_DIR}-uninative; tar -xjf ${UNINATIVE_DLDIR}/%s/${UNINATIVE_TARBALL}; ${UNINATIVE_STAGING_DIR}-uninative/relocate_sdk.py ${UNINATIVE_STAGING_DIR}-uninative/${BUILD_ARCH}-linux ${UNINATIVE_LOADER} ${UNINATIVE_LOADER} ${UNINATIVE_STAGING_DIR}-uninative/${BUILD_ARCH}-linux/${bindir_native}/patchelf-uninative ${UNINATIVE_STAGING_DIR}-uninative/${BUILD_ARCH}-linux${base_libdir_native}/libc*.so" % chksum)
- subprocess.check_call(cmd, shell=True)
+ subprocess.check_output(cmd, shell=True)
with open(loaderchksum, "w") as f:
f.write(chksum)
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 5b842ba46a..9c8a0ebb7e 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -303,10 +303,10 @@ class Rootfs(object, metaclass=ABCMeta):
bb.note("> Executing %s intercept ..." % script)
try:
- subprocess.check_call(script_full)
+ subprocess.check_output(script_full)
except subprocess.CalledProcessError as e:
- bb.warn("The postinstall intercept hook '%s' failed (exit code: %d)! See log for details!" %
- (script, e.returncode))
+ bb.warn("The postinstall intercept hook '%s' failed (exit code: %d)! See log for details! (Output: %s)" %
+ (script, e.returncode, e.output))
with open(script_full) as intercept:
registered_pkgs = None
diff --git a/meta/lib/oeqa/sdk/utils/sdkbuildproject.py b/meta/lib/oeqa/sdk/utils/sdkbuildproject.py
index cc34e0c9f5..4e4e5077c0 100644
--- a/meta/lib/oeqa/sdk/utils/sdkbuildproject.py
+++ b/meta/lib/oeqa/sdk/utils/sdkbuildproject.py
@@ -24,7 +24,7 @@ class SDKBuildProject(BuildProject):
self._download_archive()
cmd = 'tar xf %s%s -C %s' % (self.targetdir, self.archive, self.targetdir)
- subprocess.check_call(cmd, shell=True)
+ subprocess.check_output(cmd, shell=True)
#Change targetdir to project folder
self.targetdir = os.path.join(self.targetdir, self.fname)
diff --git a/meta/lib/oeqa/utils/buildproject.py b/meta/lib/oeqa/utils/buildproject.py
index 386a927881..b3c487b6c6 100644
--- a/meta/lib/oeqa/utils/buildproject.py
+++ b/meta/lib/oeqa/utils/buildproject.py
@@ -29,7 +29,7 @@ class BuildProject(metaclass=ABCMeta):
return
cmd = "wget -O %s %s" % (self.localarchive, self.uri)
- subprocess.check_call(cmd, shell=True)
+ subprocess.check_output(cmd, shell=True)
# This method should provide a way to run a command in the desired environment.
@abstractmethod
diff --git a/meta/lib/oeqa/utils/targetbuild.py b/meta/lib/oeqa/utils/targetbuild.py
index c001602b54..6f237b56f3 100644
--- a/meta/lib/oeqa/utils/targetbuild.py
+++ b/meta/lib/oeqa/utils/targetbuild.py
@@ -45,7 +45,7 @@ class BuildProject(metaclass=ABCMeta):
cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd)
cmd = cmd + "wget -O %s %s" % (self.localarchive, self.uri)
- subprocess.check_call(cmd, shell=True)
+ subprocess.check_output(cmd, shell=True)
# This method should provide a way to run a command in the desired environment.
@abstractmethod
@@ -114,7 +114,7 @@ class SDKBuildProject(BuildProject):
self._download_archive()
cmd = 'tar xf %s%s -C %s' % (self.targetdir, self.archive, self.targetdir)
- subprocess.check_call(cmd, shell=True)
+ subprocess.check_output(cmd, shell=True)
#Change targetdir to project folder
self.targetdir = os.path.join(self.targetdir, self.fname)
ef='#n500'>500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591