mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
e4c35790d6
commit
e40995e569
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user