From a07d03cc6f67c88feb9813ae7deb6e4a93552dfe 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] Signed-off-by: Robert Yang Signed-off-by: Richard Purdie --- meta/classes/package_ipk.bbclass | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'meta/classes/package_ipk.bbclass') diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index 73ec0ee14e..c86ea0314d 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass @@ -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") -- cgit v1.2.3