summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_ipk.bbclass
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2012-05-29 22:53:06 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-30 12:04:45 +0100
commite40995e569289598a1d9d71e19734402f2b54718 (patch)
tree108328e272a149da0e27dec0e0f0bebe602b80b8 /meta/classes/package_ipk.bbclass
parente4c35790d6dc23a0933f188f52fa4434784e1d98 (diff)
downloadpoky-e40995e569289598a1d9d71e19734402f2b54718.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] (From OE-Core rev: a07d03cc6f67c88feb9813ae7deb6e4a93552dfe) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_ipk.bbclass')
-rw-r--r--meta/classes/package_ipk.bbclass13
1 files changed, 8 insertions, 5 deletions
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 () {
15} 15}
16 16
17python package_ipk_install () { 17python package_ipk_install () {
18 import subprocess
19
18 pkg = d.getVar('PKG', True) 20 pkg = d.getVar('PKG', True)
19 pkgfn = d.getVar('PKGFN', True) 21 pkgfn = d.getVar('PKGFN', True)
20 rootfs = d.getVar('IMAGE_ROOTFS', True) 22 rootfs = d.getVar('IMAGE_ROOTFS', True)
@@ -52,14 +54,14 @@ python package_ipk_install () {
52 54
53 55
54 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): 56 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):
55 ret = os.system('opkg-make-index -p %s %s ' % (os.path.join(ipkdir, "Packages"), ipkdir)) 57 ret = subprocess.call('opkg-make-index -p %s %s ' % (os.path.join(ipkdir, "Packages"), ipkdir), shell=True)
56 if (ret != 0 ): 58 if (ret != 0 ):
57 raise bb.build.FuncFailed 59 raise bb.build.FuncFailed
58 f = open(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"),"w") 60 f = open(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"),"w")
59 f.close() 61 f.close()
60 62
61 ret = os.system('opkg-cl -o %s -f %s update' % (rootfs, conffile)) 63 ret = subprocess.call('opkg-cl -o %s -f %s update' % (rootfs, conffile), shell=True)
62 ret = os.system('opkg-cl -o %s -f %s install %s' % (rootfs, conffile, pkgfn)) 64 ret = subprocess.call('opkg-cl -o %s -f %s install %s' % (rootfs, conffile, pkgfn), shell=True)
63 if (ret != 0 ): 65 if (ret != 0 ):
64 raise bb.build.FuncFailed 66 raise bb.build.FuncFailed
65} 67}
@@ -262,6 +264,7 @@ package_generate_archlist () {
262python do_package_ipk () { 264python do_package_ipk () {
263 import re, copy 265 import re, copy
264 import textwrap 266 import textwrap
267 import subprocess
265 268
266 workdir = d.getVar('WORKDIR', True) 269 workdir = d.getVar('WORKDIR', True)
267 outdir = d.getVar('PKGWRITEDIRIPK', True) 270 outdir = d.getVar('PKGWRITEDIRIPK', True)
@@ -419,8 +422,8 @@ python do_package_ipk () {
419 conffiles.close() 422 conffiles.close()
420 423
421 os.chdir(basedir) 424 os.chdir(basedir)
422 ret = os.system("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH", True), 425 ret = subprocess.call("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH", True),
423 d.getVar("OPKGBUILDCMD",1), pkg, pkgoutdir)) 426 d.getVar("OPKGBUILDCMD",1), pkg, pkgoutdir), shell=True)
424 if ret != 0: 427 if ret != 0:
425 bb.utils.unlockfile(lf) 428 bb.utils.unlockfile(lf)
426 raise bb.build.FuncFailed("opkg-build execution failed") 429 raise bb.build.FuncFailed("opkg-build execution failed")