diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2012-05-29 22:53:06 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-30 10:56:15 +0100 |
commit | a07d03cc6f67c88feb9813ae7deb6e4a93552dfe (patch) | |
tree | d95be4dce79dfdce785d92b18f82dfa656a529f4 /meta/classes/package_tar.bbclass | |
parent | b1ea93143a473f006b31ab22f88baf41661971a7 (diff) | |
download | openembedded-core-contrib-a07d03cc6f67c88feb9813ae7deb6e4a93552dfe.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]
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.bbclass | 6 |
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 () { } python package_tar_install () { + import subprocess pkg = d.getVar('PKG', True) pkgfn = d.getVar('PKGFN', True) rootfs = d.getVar('IMAGE_ROOTFS', True) @@ -29,12 +30,13 @@ python package_tar_install () { bb.debug(1, "%s does not exist, skipping" % pkgfn) raise bb.build.FuncFailed - ret = os.system('zcat %s | tar -xf -' % pkgfn) + ret = subprocess.call('zcat %s | tar -xf -' % pkgfn, shell=True) if ret != 0: raise bb.build.FuncFailed } python do_package_tar () { + import subprocess workdir = d.getVar('WORKDIR', True) if not workdir: bb.error("WORKDIR not defined, unable to package") @@ -85,7 +87,7 @@ python do_package_tar () { if not glob('*'): bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', True), localdata.getVar('PKGR', True))) continue - ret = os.system("tar -czf %s %s" % (tarfn, '.')) + ret = subprocess.call("tar -czf %s %s" % (tarfn, '.'), shell=True) if ret != 0: bb.error("Creation of tar %s failed." % tarfn) } |