summaryrefslogtreecommitdiffstats
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:57 +0000
commit6ab4c5033af72f102e7935de62e600b7ce247f34 (patch)
treedfc83f0cff8d54ce632b34be2e0c2257760ff226
parent0a30ae5e18cd1c1576da80c3b9d31e8d64cfcc01 (diff)
downloadpoky-6ab4c5033af72f102e7935de62e600b7ce247f34.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. (From OE-Core rev: ad750dd1cc9d789abe723daddd098ce41d8547f5) 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 () {
573 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) 573 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)
574 574
575 bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd)) 575 bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd))
576 subprocess.check_call(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir) 576 subprocess.check_output(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir)
577 577
578 # If the fixmefn is empty, remove it.. 578 # If the fixmefn is empty, remove it..
579 if os.stat(fixmefn).st_size == 0: 579 if os.stat(fixmefn).st_size == 0:
580 os.remove(fixmefn) 580 os.remove(fixmefn)
581 else: 581 else:
582 bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd)) 582 bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd))
583 subprocess.check_call(sstate_filelist_relative_cmd, shell=True) 583 subprocess.check_output(sstate_filelist_relative_cmd, shell=True)
584} 584}
585 585
586def sstate_package(ss, d): 586def 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):
290 fixme_path = d.getVar(fixmevar) 290 fixme_path = d.getVar(fixmevar)
291 cmd += " -e 's:FIXME_%s:%s:g'" % (fixmevar, fixme_path) 291 cmd += " -e 's:FIXME_%s:%s:g'" % (fixmevar, fixme_path)
292 bb.note(cmd) 292 bb.note(cmd)
293 subprocess.check_call(cmd, shell=True) 293 subprocess.check_output(cmd, shell=True)
294 294
295 295
296def staging_populate_sysroot_dir(targetsysroot, nativesysroot, native, d): 296def staging_populate_sysroot_dir(targetsysroot, nativesysroot, native, d):
@@ -333,7 +333,7 @@ def staging_populate_sysroot_dir(targetsysroot, nativesysroot, native, d):
333 333
334 staging_processfixme(fixme, targetdir, targetsysroot, nativesysroot, d) 334 staging_processfixme(fixme, targetdir, targetsysroot, nativesysroot, d)
335 for p in postinsts: 335 for p in postinsts:
336 subprocess.check_call(p, shell=True) 336 subprocess.check_output(p, shell=True)
337 337
338# 338#
339# Manifests here are complicated. The main sysroot area has the unpacked sstate 339# Manifests here are complicated. The main sysroot area has the unpacked sstate
@@ -561,7 +561,7 @@ python extend_recipe_sysroot() {
561 staging_processfixme(fixme[f], multilibs[f].getVar("RECIPE_SYSROOT"), recipesysroot, recipesysrootnative, d) 561 staging_processfixme(fixme[f], multilibs[f].getVar("RECIPE_SYSROOT"), recipesysroot, recipesysrootnative, d)
562 562
563 for p in postinsts: 563 for p in postinsts:
564 subprocess.check_call(p, shell=True) 564 subprocess.check_output(p, shell=True)
565 565
566 for dep in configuredeps: 566 for dep in configuredeps:
567 c = setscenedeps[dep][0] 567 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() {
60 os.symlink(localpath, tarballpath) 60 os.symlink(localpath, tarballpath)
61 61
62 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) 62 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)
63 subprocess.check_call(cmd, shell=True) 63 subprocess.check_output(cmd, shell=True)
64 64
65 with open(loaderchksum, "w") as f: 65 with open(loaderchksum, "w") as f:
66 f.write(chksum) 66 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):
303 bb.note("> Executing %s intercept ..." % script) 303 bb.note("> Executing %s intercept ..." % script)
304 304
305 try: 305 try:
306 subprocess.check_call(script_full) 306 subprocess.check_output(script_full)
307 except subprocess.CalledProcessError as e: 307 except subprocess.CalledProcessError as e:
308 bb.warn("The postinstall intercept hook '%s' failed (exit code: %d)! See log for details!" % 308 bb.warn("The postinstall intercept hook '%s' failed (exit code: %d)! See log for details! (Output: %s)" %
309 (script, e.returncode)) 309 (script, e.returncode, e.output))
310 310
311 with open(script_full) as intercept: 311 with open(script_full) as intercept:
312 registered_pkgs = None 312 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):
24 self._download_archive() 24 self._download_archive()
25 25
26 cmd = 'tar xf %s%s -C %s' % (self.targetdir, self.archive, self.targetdir) 26 cmd = 'tar xf %s%s -C %s' % (self.targetdir, self.archive, self.targetdir)
27 subprocess.check_call(cmd, shell=True) 27 subprocess.check_output(cmd, shell=True)
28 28
29 #Change targetdir to project folder 29 #Change targetdir to project folder
30 self.targetdir = os.path.join(self.targetdir, self.fname) 30 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):
29 return 29 return
30 30
31 cmd = "wget -O %s %s" % (self.localarchive, self.uri) 31 cmd = "wget -O %s %s" % (self.localarchive, self.uri)
32 subprocess.check_call(cmd, shell=True) 32 subprocess.check_output(cmd, shell=True)
33 33
34 # This method should provide a way to run a command in the desired environment. 34 # This method should provide a way to run a command in the desired environment.
35 @abstractmethod 35 @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):
45 cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd) 45 cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd)
46 46
47 cmd = cmd + "wget -O %s %s" % (self.localarchive, self.uri) 47 cmd = cmd + "wget -O %s %s" % (self.localarchive, self.uri)
48 subprocess.check_call(cmd, shell=True) 48 subprocess.check_output(cmd, shell=True)
49 49
50 # This method should provide a way to run a command in the desired environment. 50 # This method should provide a way to run a command in the desired environment.
51 @abstractmethod 51 @abstractmethod
@@ -114,7 +114,7 @@ class SDKBuildProject(BuildProject):
114 self._download_archive() 114 self._download_archive()
115 115
116 cmd = 'tar xf %s%s -C %s' % (self.targetdir, self.archive, self.targetdir) 116 cmd = 'tar xf %s%s -C %s' % (self.targetdir, self.archive, self.targetdir)
117 subprocess.check_call(cmd, shell=True) 117 subprocess.check_output(cmd, shell=True)
118 118
119 #Change targetdir to project folder 119 #Change targetdir to project folder
120 self.targetdir = os.path.join(self.targetdir, self.fname) 120 self.targetdir = os.path.join(self.targetdir, self.fname)