1
0
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:
Robert Yang
2012-05-29 22:53:06 +08:00
committed by Richard Purdie
parent e4c35790d6
commit e40995e569
14 changed files with 74 additions and 52 deletions
+8 -5
View File
@@ -15,6 +15,8 @@ python package_ipk_fn () {
}
python package_ipk_install () {
import subprocess
pkg = d.getVar('PKG', True)
pkgfn = d.getVar('PKGFN', True)
rootfs = d.getVar('IMAGE_ROOTFS', True)
@@ -52,14 +54,14 @@ python package_ipk_install () {
if not os.access(os.path.join(ipkdir,"Packages"), os.R_OK) or not os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"),os.R_OK):
ret = os.system('opkg-make-index -p %s %s ' % (os.path.join(ipkdir, "Packages"), ipkdir))
ret = subprocess.call('opkg-make-index -p %s %s ' % (os.path.join(ipkdir, "Packages"), ipkdir), shell=True)
if (ret != 0 ):
raise bb.build.FuncFailed
f = open(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"),"w")
f.close()
ret = os.system('opkg-cl -o %s -f %s update' % (rootfs, conffile))
ret = os.system('opkg-cl -o %s -f %s install %s' % (rootfs, conffile, pkgfn))
ret = subprocess.call('opkg-cl -o %s -f %s update' % (rootfs, conffile), shell=True)
ret = subprocess.call('opkg-cl -o %s -f %s install %s' % (rootfs, conffile, pkgfn), shell=True)
if (ret != 0 ):
raise bb.build.FuncFailed
}
@@ -262,6 +264,7 @@ package_generate_archlist () {
python do_package_ipk () {
import re, copy
import textwrap
import subprocess
workdir = d.getVar('WORKDIR', True)
outdir = d.getVar('PKGWRITEDIRIPK', True)
@@ -419,8 +422,8 @@ python do_package_ipk () {
conffiles.close()
os.chdir(basedir)
ret = os.system("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH", True),
d.getVar("OPKGBUILDCMD",1), pkg, pkgoutdir))
ret = subprocess.call("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH", True),
d.getVar("OPKGBUILDCMD",1), pkg, pkgoutdir), shell=True)
if ret != 0:
bb.utils.unlockfile(lf)
raise bb.build.FuncFailed("opkg-build execution failed")