summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_tar.bbclass
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2012-05-29 22:53:06 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-30 12:04:45 +0100
commite40995e569289598a1d9d71e19734402f2b54718 (patch)
tree108328e272a149da0e27dec0e0f0bebe602b80b8 /meta/classes/package_tar.bbclass
parente4c35790d6dc23a0933f188f52fa4434784e1d98 (diff)
downloadpoky-e40995e569289598a1d9d71e19734402f2b54718.tar.gz
meta: replace os.system with subprocess.call
Replace os.system with subprocess.call since the older function would fail (more or less) silently if the executed program cannot be found More info: http://docs.python.org/library/subprocess.html#subprocess-replacements [YOCTO #2454] (From OE-Core rev: a07d03cc6f67c88feb9813ae7deb6e4a93552dfe) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_tar.bbclass')
-rw-r--r--meta/classes/package_tar.bbclass6
1 files changed, 4 insertions, 2 deletions
diff --git a/meta/classes/package_tar.bbclass b/meta/classes/package_tar.bbclass
index 68b1bf0fed..332fa3f230 100644
--- a/meta/classes/package_tar.bbclass
+++ b/meta/classes/package_tar.bbclass
@@ -9,6 +9,7 @@ python package_tar_fn () {
9} 9}
10 10
11python package_tar_install () { 11python package_tar_install () {
12 import subprocess
12 pkg = d.getVar('PKG', True) 13 pkg = d.getVar('PKG', True)
13 pkgfn = d.getVar('PKGFN', True) 14 pkgfn = d.getVar('PKGFN', True)
14 rootfs = d.getVar('IMAGE_ROOTFS', True) 15 rootfs = d.getVar('IMAGE_ROOTFS', True)
@@ -29,12 +30,13 @@ python package_tar_install () {
29 bb.debug(1, "%s does not exist, skipping" % pkgfn) 30 bb.debug(1, "%s does not exist, skipping" % pkgfn)
30 raise bb.build.FuncFailed 31 raise bb.build.FuncFailed
31 32
32 ret = os.system('zcat %s | tar -xf -' % pkgfn) 33 ret = subprocess.call('zcat %s | tar -xf -' % pkgfn, shell=True)
33 if ret != 0: 34 if ret != 0:
34 raise bb.build.FuncFailed 35 raise bb.build.FuncFailed
35} 36}
36 37
37python do_package_tar () { 38python do_package_tar () {
39 import subprocess
38 workdir = d.getVar('WORKDIR', True) 40 workdir = d.getVar('WORKDIR', True)
39 if not workdir: 41 if not workdir:
40 bb.error("WORKDIR not defined, unable to package") 42 bb.error("WORKDIR not defined, unable to package")
@@ -85,7 +87,7 @@ python do_package_tar () {
85 if not glob('*'): 87 if not glob('*'):
86 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', True), localdata.getVar('PKGR', True))) 88 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', True), localdata.getVar('PKGR', True)))
87 continue 89 continue
88 ret = os.system("tar -czf %s %s" % (tarfn, '.')) 90 ret = subprocess.call("tar -czf %s %s" % (tarfn, '.'), shell=True)
89 if ret != 0: 91 if ret != 0:
90 bb.error("Creation of tar %s failed." % tarfn) 92 bb.error("Creation of tar %s failed." % tarfn)
91} 93}