From e40995e569289598a1d9d71e19734402f2b54718 Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Tue, 29 May 2012 22:53:06 +0800 Subject: 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 Signed-off-by: Richard Purdie --- meta/classes/package_tar.bbclass | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'meta/classes/package_tar.bbclass') 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) } -- cgit v1.2.3-54-g00ecf