summaryrefslogtreecommitdiffstats
path: root/meta/classes
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
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')
-rw-r--r--meta/classes/archiver.bbclass3
-rw-r--r--meta/classes/distrodata.bbclass5
-rw-r--r--meta/classes/imagetest-qemu.bbclass9
-rw-r--r--meta/classes/insane.bbclass15
-rw-r--r--meta/classes/kernel.bbclass4
-rw-r--r--meta/classes/package.bbclass33
-rw-r--r--meta/classes/package_deb.bbclass3
-rw-r--r--meta/classes/package_ipk.bbclass13
-rw-r--r--meta/classes/package_tar.bbclass6
-rw-r--r--meta/classes/sanity.bbclass13
-rw-r--r--meta/classes/sstate.bbclass9
11 files changed, 66 insertions, 47 deletions
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index ac8aa957e3..67eac84314 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -362,6 +362,7 @@ def dumpdata(d):
362def create_diff_gz(d): 362def create_diff_gz(d):
363 '''creating .diff.gz in ${DEPLOY_DIR_SRC}/${P}-${PR}.diff.g gz for mapping all content in 's' including patches to xxx.diff.gz''' 363 '''creating .diff.gz in ${DEPLOY_DIR_SRC}/${P}-${PR}.diff.g gz for mapping all content in 's' including patches to xxx.diff.gz'''
364 import shutil 364 import shutil
365 import subprocess
365 366
366 work_dir = d.getVar('WORKDIR', True) 367 work_dir = d.getVar('WORKDIR', True)
367 exclude_from = d.getVar('ARCHIVE_EXCLUDE_FROM', True).split() 368 exclude_from = d.getVar('ARCHIVE_EXCLUDE_FROM', True).split()
@@ -387,7 +388,7 @@ def create_diff_gz(d):
387 try: 388 try:
388 shutil.copy(i, dest) 389 shutil.copy(i, dest)
389 except IOError: 390 except IOError:
390 os.system('fakeroot cp -rf ' + i + " " + dest ) 391 subprocess.call('fakeroot cp -rf ' + i + " " + dest, shell=True)
391 392
392 bb.note("Creating .diff.gz in ${DEPLOY_DIR_SRC}/${P}-${PR}.diff.gz") 393 bb.note("Creating .diff.gz in ${DEPLOY_DIR_SRC}/${P}-${PR}.diff.gz")
393 cmd = "LC_ALL=C TZ=UTC0 diff --exclude-from=" + work_dir + "/temp/exclude-from-file -Naur " + s + '.org' + ' ' + s + " | gzip -c > " + diff_file 394 cmd = "LC_ALL=C TZ=UTC0 diff --exclude-from=" + work_dir + "/temp/exclude-from-file -Naur " + s + '.org' + ' ' + s + " | gzip -c > " + diff_file
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass
index 4b2dee5b10..df6d300666 100644
--- a/meta/classes/distrodata.bbclass
+++ b/meta/classes/distrodata.bbclass
@@ -231,6 +231,7 @@ python do_checkpkg() {
231 import sys 231 import sys
232 import re 232 import re
233 import tempfile 233 import tempfile
234 import subprocess
234 235
235 """ 236 """
236 sanity check to ensure same name and type. Match as many patterns as possible 237 sanity check to ensure same name and type. Match as many patterns as possible
@@ -373,7 +374,7 @@ python do_checkpkg() {
373 f.close() 374 f.close()
374 if status != "ErrHostNoDir" and re.match("Err", status): 375 if status != "ErrHostNoDir" and re.match("Err", status):
375 logpath = d.getVar('LOG_DIR', True) 376 logpath = d.getVar('LOG_DIR', True)
376 os.system("cp %s %s/" % (f.name, logpath)) 377 subprocess.call("cp %s %s/" % (f.name, logpath), shell=True)
377 os.unlink(f.name) 378 os.unlink(f.name)
378 return status 379 return status
379 380
@@ -432,7 +433,7 @@ python do_checkpkg() {
432 """if host hasn't directory information, no need to save tmp file""" 433 """if host hasn't directory information, no need to save tmp file"""
433 if status != "ErrHostNoDir" and re.match("Err", status): 434 if status != "ErrHostNoDir" and re.match("Err", status):
434 logpath = d.getVar('LOG_DIR', True) 435 logpath = d.getVar('LOG_DIR', True)
435 os.system("cp %s %s/" % (f.name, logpath)) 436 subprocess.call("cp %s %s/" % (f.name, logpath), shell=True)
436 os.unlink(f.name) 437 os.unlink(f.name)
437 return status 438 return status
438 439
diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass
index d56b44b5c4..f51eeba98c 100644
--- a/meta/classes/imagetest-qemu.bbclass
+++ b/meta/classes/imagetest-qemu.bbclass
@@ -28,6 +28,7 @@ def qemuimagetest_main(d):
28 import re 28 import re
29 import os 29 import os
30 import shutil 30 import shutil
31 import subprocess
31 32
32 """ 33 """
33 Test Controller for automated testing. 34 Test Controller for automated testing.
@@ -58,7 +59,7 @@ def qemuimagetest_main(d):
58 logpath = d.getVar('TEST_LOG', True) 59 logpath = d.getVar('TEST_LOG', True)
59 bb.utils.mkdirhier("%s/%s" % (logpath, scen)) 60 bb.utils.mkdirhier("%s/%s" % (logpath, scen))
60 caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, d.getVar('DATETIME', True))) 61 caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, d.getVar('DATETIME', True)))
61 os.system("touch %s" % caselog) 62 subprocess.call("touch %s" % caselog, shell=True)
62 63
63 """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH""" 64 """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH"""
64 os.environ["PATH"] = d.getVar("PATH", True) 65 os.environ["PATH"] = d.getVar("PATH", True)
@@ -78,7 +79,7 @@ def qemuimagetest_main(d):
78 79
79 """run Test Case""" 80 """run Test Case"""
80 bb.note("Run %s test in scenario %s" % (case, scen)) 81 bb.note("Run %s test in scenario %s" % (case, scen))
81 os.system("%s" % fulltestpath) 82 subprocess.call("%s" % fulltestpath, shell=True)
82 83
83 """function to check testcase list and remove inappropriate cases""" 84 """function to check testcase list and remove inappropriate cases"""
84 def check_list(list): 85 def check_list(list):
@@ -168,7 +169,7 @@ def qemuimagetest_main(d):
168 test_status = d.getVar('TEST_STATUS', True) 169 test_status = d.getVar('TEST_STATUS', True)
169 if os.path.exists(test_status): 170 if os.path.exists(test_status):
170 os.remove(test_status) 171 os.remove(test_status)
171 os.system("touch %s" % test_status) 172 subprocess.call("touch %s" % test_status, shell=True)
172 173
173 """initialize result file""" 174 """initialize result file"""
174 resultpath = d.getVar('TEST_RESULT', True) 175 resultpath = d.getVar('TEST_RESULT', True)
@@ -180,7 +181,7 @@ def qemuimagetest_main(d):
180 181
181 if os.path.exists(sresultfile): 182 if os.path.exists(sresultfile):
182 os.remove(sresultfile) 183 os.remove(sresultfile)
183 os.system("touch %s" % resultfile) 184 subprocess.call("touch %s" % resultfile, shell=True)
184 os.symlink(resultfile, sresultfile) 185 os.symlink(resultfile, sresultfile)
185 f = open(sresultfile, "a") 186 f = open(sresultfile, "a")
186 f.write("\tTest Result for %s %s\n" % (machine, pname)) 187 f.write("\tTest Result for %s %s\n" % (machine, pname))
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 49e904a27f..4d139e813f 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -267,6 +267,7 @@ def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages):
267 267
268 if not elf: 268 if not elf:
269 import stat 269 import stat
270 import subprocess
270 pn = d.getVar('PN', True) 271 pn = d.getVar('PN', True)
271 272
272 # Ensure we're checking an executable script 273 # Ensure we're checking an executable script
@@ -275,7 +276,7 @@ def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages):
275 # grep shell scripts for possible references to /exec_prefix/ 276 # grep shell scripts for possible references to /exec_prefix/
276 exec_prefix = d.getVar('exec_prefix', True) 277 exec_prefix = d.getVar('exec_prefix', True)
277 statement = "grep -e '%s/' %s > /dev/null" % (exec_prefix, path) 278 statement = "grep -e '%s/' %s > /dev/null" % (exec_prefix, path)
278 if os.system(statement) == 0: 279 if subprocess.call(statement, shell=True) == 0:
279 error_msg = pn + ": Found a reference to %s/ in %s" % (exec_prefix, path) 280 error_msg = pn + ": Found a reference to %s/ in %s" % (exec_prefix, path)
280 package_qa_handle_error("unsafe-references-in-scripts", error_msg, d) 281 package_qa_handle_error("unsafe-references-in-scripts", error_msg, d)
281 error_msg = "Shell scripts in base_bindir and base_sbindir should not reference anything in exec_prefix" 282 error_msg = "Shell scripts in base_bindir and base_sbindir should not reference anything in exec_prefix"
@@ -609,6 +610,8 @@ def package_qa_check_rdepends(pkg, pkgdest, skip, d):
609 610
610# The PACKAGE FUNC to scan each package 611# The PACKAGE FUNC to scan each package
611python do_package_qa () { 612python do_package_qa () {
613 import subprocess
614
612 bb.note("DO PACKAGE QA") 615 bb.note("DO PACKAGE QA")
613 616
614 logdir = d.getVar('T', True) 617 logdir = d.getVar('T', True)
@@ -619,7 +622,7 @@ python do_package_qa () {
619 622
620 if os.path.exists(compilelog): 623 if os.path.exists(compilelog):
621 statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % compilelog 624 statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % compilelog
622 if os.system(statement) == 0: 625 if subprocess.call(statement, shell=True) == 0:
623 bb.warn("%s: The compile log indicates that host include and/or library paths were used.\n \ 626 bb.warn("%s: The compile log indicates that host include and/or library paths were used.\n \
624 Please check the log '%s' for more information." % (pkg, compilelog)) 627 Please check the log '%s' for more information." % (pkg, compilelog))
625 628
@@ -628,7 +631,7 @@ python do_package_qa () {
628 631
629 if os.path.exists(installlog): 632 if os.path.exists(installlog):
630 statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % installlog 633 statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % installlog
631 if os.system(statement) == 0: 634 if subprocess.call(statement, shell=True) == 0:
632 bb.warn("%s: The install log indicates that host include and/or library paths were used.\n \ 635 bb.warn("%s: The install log indicates that host include and/or library paths were used.\n \
633 Please check the log '%s' for more information." % (pkg, installlog)) 636 Please check the log '%s' for more information." % (pkg, installlog))
634 637
@@ -684,6 +687,8 @@ python do_qa_staging() {
684} 687}
685 688
686python do_qa_configure() { 689python do_qa_configure() {
690 import subprocess
691
687 configs = [] 692 configs = []
688 workdir = d.getVar('WORKDIR', True) 693 workdir = d.getVar('WORKDIR', True)
689 bb.note("Checking autotools environment for common misconfiguration") 694 bb.note("Checking autotools environment for common misconfiguration")
@@ -691,7 +696,7 @@ python do_qa_configure() {
691 statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % \ 696 statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % \
692 os.path.join(root,"config.log") 697 os.path.join(root,"config.log")
693 if "config.log" in files: 698 if "config.log" in files:
694 if os.system(statement) == 0: 699 if subprocess.call(statement, shell=True) == 0:
695 bb.fatal("""This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities. 700 bb.fatal("""This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities.
696Rerun configure task after fixing this. The path was '%s'""" % root) 701Rerun configure task after fixing this. The path was '%s'""" % root)
697 702
@@ -713,7 +718,7 @@ Rerun configure task after fixing this. The path was '%s'""" % root)
713 if gt not in deps: 718 if gt not in deps:
714 for config in configs: 719 for config in configs:
715 gnu = "grep \"^[[:space:]]*AM_GNU_GETTEXT\" %s >/dev/null" % config 720 gnu = "grep \"^[[:space:]]*AM_GNU_GETTEXT\" %s >/dev/null" % config
716 if os.system(gnu) == 0: 721 if subprocess.call(gnu, shell=True) == 0:
717 bb.fatal("""%s required but not in DEPENDS for file %s. 722 bb.fatal("""%s required but not in DEPENDS for file %s.
718Missing inherit gettext?""" % (gt, config)) 723Missing inherit gettext?""" % (gt, config))
719 724
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 90af59712c..116e10b9de 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -313,12 +313,12 @@ module_conf_rfcomm = "alias bt-proto-3 rfcomm"
313 313
314python populate_packages_prepend () { 314python populate_packages_prepend () {
315 def extract_modinfo(file): 315 def extract_modinfo(file):
316 import tempfile, re 316 import tempfile, re, subprocess
317 tempfile.tempdir = d.getVar("WORKDIR", True) 317 tempfile.tempdir = d.getVar("WORKDIR", True)
318 tf = tempfile.mkstemp() 318 tf = tempfile.mkstemp()
319 tmpfile = tf[1] 319 tmpfile = tf[1]
320 cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("PATH", True), d.getVar("HOST_PREFIX", True) or "", file, tmpfile) 320 cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("PATH", True), d.getVar("HOST_PREFIX", True) or "", file, tmpfile)
321 os.system(cmd) 321 subprocess.call(cmd, shell=True)
322 f = open(tmpfile) 322 f = open(tmpfile)
323 l = f.read().split("\000") 323 l = f.read().split("\000")
324 f.close() 324 f.close()
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 58320dd7ef..41139ef921 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -183,7 +183,7 @@ def splitfile(file, debugfile, debugsrcdir, d):
183 # The debug information is then processed for src references. These 183 # The debug information is then processed for src references. These
184 # references are copied to debugsrcdir, if defined. 184 # references are copied to debugsrcdir, if defined.
185 185
186 import commands, stat 186 import commands, stat, subprocess
187 187
188 dvar = d.getVar('PKGD', True) 188 dvar = d.getVar('PKGD', True)
189 pathprefix = "export PATH=%s; " % d.getVar('PATH', True) 189 pathprefix = "export PATH=%s; " % d.getVar('PATH', True)
@@ -205,14 +205,14 @@ def splitfile(file, debugfile, debugsrcdir, d):
205 205
206 # We need to extract the debug src information here... 206 # We need to extract the debug src information here...
207 if debugsrcdir: 207 if debugsrcdir:
208 os.system("%s'%s' -b '%s' -d '%s' -i -l '%s' '%s'" % (pathprefix, debugedit, workparentdir, debugsrcdir, sourcefile, file)) 208 subprocess.call("%s'%s' -b '%s' -d '%s' -i -l '%s' '%s'" % (pathprefix, debugedit, workparentdir, debugsrcdir, sourcefile, file), shell=True)
209 209
210 bb.mkdirhier(os.path.dirname(debugfile)) 210 bb.mkdirhier(os.path.dirname(debugfile))
211 211
212 os.system("%s'%s' --only-keep-debug '%s' '%s'" % (pathprefix, objcopy, file, debugfile)) 212 subprocess.call("%s'%s' --only-keep-debug '%s' '%s'" % (pathprefix, objcopy, file, debugfile), shell=True)
213 213
214 # Set the debuglink to have the view of the file path on the target 214 # Set the debuglink to have the view of the file path on the target
215 os.system("%s'%s' --add-gnu-debuglink='%s' '%s'" % (pathprefix, objcopy, debugfile, file)) 215 subprocess.call("%s'%s' --add-gnu-debuglink='%s' '%s'" % (pathprefix, objcopy, debugfile, file), shell=True)
216 216
217 if newmode: 217 if newmode:
218 os.chmod(file, origmode) 218 os.chmod(file, origmode)
@@ -225,7 +225,7 @@ def splitfile2(debugsrcdir, d):
225 # The debug src information processed in the splitfile2 is further procecessed 225 # The debug src information processed in the splitfile2 is further procecessed
226 # and copied to the destination here. 226 # and copied to the destination here.
227 227
228 import commands, stat 228 import commands, stat, subprocess
229 229
230 sourcefile = d.expand("${WORKDIR}/debugsources.list") 230 sourcefile = d.expand("${WORKDIR}/debugsources.list")
231 if debugsrcdir and os.path.isfile(sourcefile): 231 if debugsrcdir and os.path.isfile(sourcefile):
@@ -252,14 +252,14 @@ def splitfile2(debugsrcdir, d):
252 processdebugsrc += "fgrep -z '%s' | " 252 processdebugsrc += "fgrep -z '%s' | "
253 processdebugsrc += "(cd '%s' ; cpio -pd0mL --no-preserve-owner '%s%s' 2>/dev/null)" 253 processdebugsrc += "(cd '%s' ; cpio -pd0mL --no-preserve-owner '%s%s' 2>/dev/null)"
254 254
255 os.system(processdebugsrc % (sourcefile, workbasedir, workparentdir, dvar, debugsrcdir)) 255 subprocess.call(processdebugsrc % (sourcefile, workbasedir, workparentdir, dvar, debugsrcdir), shell=True)
256 256
257 # The copy by cpio may have resulted in some empty directories! Remove these 257 # The copy by cpio may have resulted in some empty directories! Remove these
258 for root, dirs, files in os.walk("%s%s" % (dvar, debugsrcdir)): 258 for root, dirs, files in os.walk("%s%s" % (dvar, debugsrcdir)):
259 for d in dirs: 259 for d in dirs:
260 dir = os.path.join(root, d) 260 dir = os.path.join(root, d)
261 #bb.note("rmdir -p %s" % dir) 261 #bb.note("rmdir -p %s" % dir)
262 os.system("rmdir -p %s 2>/dev/null" % dir) 262 subprocess.call("rmdir -p %s 2>/dev/null" % dir, shell=True)
263 263
264 # Also remove debugsrcdir if its empty 264 # Also remove debugsrcdir if its empty
265 for p in nosuchdir[::-1]: 265 for p in nosuchdir[::-1]:
@@ -275,14 +275,14 @@ def runstrip(file, elftype, d):
275 # 4 - executable 275 # 4 - executable
276 # 8 - shared library 276 # 8 - shared library
277 277
278 import commands, stat 278 import commands, stat, subprocess
279 279
280 pathprefix = "export PATH=%s; " % d.getVar('PATH', True) 280 pathprefix = "export PATH=%s; " % d.getVar('PATH', True)
281 strip = d.getVar("STRIP", True) 281 strip = d.getVar("STRIP", True)
282 282
283 # Handle kernel modules specifically - .debug directories here are pointless 283 # Handle kernel modules specifically - .debug directories here are pointless
284 if file.find("/lib/modules/") != -1 and file.endswith(".ko"): 284 if file.find("/lib/modules/") != -1 and file.endswith(".ko"):
285 return os.system("%s'%s' --strip-debug --remove-section=.comment --remove-section=.note --preserve-dates '%s'" % (pathprefix, strip, file)) 285 return subprocess.call("%s'%s' --strip-debug --remove-section=.comment --remove-section=.note --preserve-dates '%s'" % (pathprefix, strip, file), shell=True)
286 286
287 newmode = None 287 newmode = None
288 if not os.access(file, os.W_OK) or os.access(file, os.R_OK): 288 if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
@@ -301,7 +301,7 @@ def runstrip(file, elftype, d):
301 stripcmd = "'%s' %s '%s'" % (strip, extraflags, file) 301 stripcmd = "'%s' %s '%s'" % (strip, extraflags, file)
302 bb.debug(1, "runstrip: %s" % stripcmd) 302 bb.debug(1, "runstrip: %s" % stripcmd)
303 303
304 ret = os.system("%s%s" % (pathprefix, stripcmd)) 304 ret = subprocess.call("%s%s" % (pathprefix, stripcmd), shell=True)
305 305
306 if newmode: 306 if newmode:
307 os.chmod(file, origmode) 307 os.chmod(file, origmode)
@@ -427,6 +427,7 @@ python package_do_split_locales() {
427} 427}
428 428
429python perform_packagecopy () { 429python perform_packagecopy () {
430 import subprocess
430 dest = d.getVar('D', True) 431 dest = d.getVar('D', True)
431 dvar = d.getVar('PKGD', True) 432 dvar = d.getVar('PKGD', True)
432 433
@@ -434,9 +435,9 @@ python perform_packagecopy () {
434 435
435 # Start by package population by taking a copy of the installed 436 # Start by package population by taking a copy of the installed
436 # files to operate on 437 # files to operate on
437 os.system('rm -rf %s/*' % (dvar)) 438 subprocess.call('rm -rf %s/*' % (dvar), shell=True)
438 # Preserve sparse files and hard links 439 # Preserve sparse files and hard links
439 os.system('tar -cf - -C %s -ps . | tar -xf - -C %s' % (dest, dvar)) 440 subprocess.call('tar -cf - -C %s -ps . | tar -xf - -C %s' % (dest, dvar), shell=True)
440} 441}
441 442
442# We generate a master list of directories to process, we start by 443# We generate a master list of directories to process, we start by
@@ -668,7 +669,7 @@ python fixup_perms () {
668} 669}
669 670
670python split_and_strip_files () { 671python split_and_strip_files () {
671 import commands, stat, errno 672 import commands, stat, errno, subprocess
672 673
673 dvar = d.getVar('PKGD', True) 674 dvar = d.getVar('PKGD', True)
674 pn = d.getVar('PN', True) 675 pn = d.getVar('PN', True)
@@ -838,7 +839,7 @@ python split_and_strip_files () {
838 os.unlink(fpath) 839 os.unlink(fpath)
839 # This could leave an empty debug directory laying around 840 # This could leave an empty debug directory laying around
840 # take care of the obvious case... 841 # take care of the obvious case...
841 os.system("rmdir %s 2>/dev/null" % os.path.dirname(fpath)) 842 subprocess.call("rmdir %s 2>/dev/null" % os.path.dirname(fpath), shell=True)
842 843
843 # Process the debugsrcdir if requested... 844 # Process the debugsrcdir if requested...
844 # This copies and places the referenced sources for later debugging... 845 # This copies and places the referenced sources for later debugging...
@@ -870,7 +871,7 @@ python split_and_strip_files () {
870} 871}
871 872
872python populate_packages () { 873python populate_packages () {
873 import glob, stat, errno, re 874 import glob, stat, errno, re, subprocess
874 875
875 workdir = d.getVar('WORKDIR', True) 876 workdir = d.getVar('WORKDIR', True)
876 outdir = d.getVar('DEPLOY_DIR', True) 877 outdir = d.getVar('DEPLOY_DIR', True)
@@ -896,7 +897,7 @@ python populate_packages () {
896 package_list.append(pkg) 897 package_list.append(pkg)
897 d.setVar('PACKAGES', ' '.join(package_list)) 898 d.setVar('PACKAGES', ' '.join(package_list))
898 pkgdest = d.getVar('PKGDEST', True) 899 pkgdest = d.getVar('PKGDEST', True)
899 os.system('rm -rf %s' % pkgdest) 900 subprocess.call('rm -rf %s' % pkgdest, shell=True)
900 901
901 seen = [] 902 seen = []
902 903
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index 4096fa2b89..0a3e976ff7 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -205,6 +205,7 @@ deb_log_check() {
205python do_package_deb () { 205python do_package_deb () {
206 import re, copy 206 import re, copy
207 import textwrap 207 import textwrap
208 import subprocess
208 209
209 workdir = d.getVar('WORKDIR', True) 210 workdir = d.getVar('WORKDIR', True)
210 if not workdir: 211 if not workdir:
@@ -384,7 +385,7 @@ python do_package_deb () {
384 conffiles.close() 385 conffiles.close()
385 386
386 os.chdir(basedir) 387 os.chdir(basedir)
387 ret = os.system("PATH=\"%s\" dpkg-deb -b %s %s" % (localdata.getVar("PATH", True), root, pkgoutdir)) 388 ret = subprocess.call("PATH=\"%s\" dpkg-deb -b %s %s" % (localdata.getVar("PATH", True), root, pkgoutdir), shell=True)
388 if ret != 0: 389 if ret != 0:
389 bb.utils.prunedir(controldir) 390 bb.utils.prunedir(controldir)
390 bb.utils.unlockfile(lf) 391 bb.utils.unlockfile(lf)
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")
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 () {
9} 9}
10 10
11python package_tar_install () { 11python package_tar_install () {
12 import subprocess
12 pkg = d.getVar('PKG', True) 13 pkg = d.getVar('PKG', True)
13 pkgfn = d.getVar('PKGFN', True) 14 pkgfn = d.getVar('PKGFN', True)
14 rootfs = d.getVar('IMAGE_ROOTFS', True) 15 rootfs = d.getVar('IMAGE_ROOTFS', True)
@@ -29,12 +30,13 @@ python package_tar_install () {
29 bb.debug(1, "%s does not exist, skipping" % pkgfn) 30 bb.debug(1, "%s does not exist, skipping" % pkgfn)
30 raise bb.build.FuncFailed 31 raise bb.build.FuncFailed
31 32
32 ret = os.system('zcat %s | tar -xf -' % pkgfn) 33 ret = subprocess.call('zcat %s | tar -xf -' % pkgfn, shell=True)
33 if ret != 0: 34 if ret != 0:
34 raise bb.build.FuncFailed 35 raise bb.build.FuncFailed
35} 36}
36 37
37python do_package_tar () { 38python do_package_tar () {
39 import subprocess
38 workdir = d.getVar('WORKDIR', True) 40 workdir = d.getVar('WORKDIR', True)
39 if not workdir: 41 if not workdir:
40 bb.error("WORKDIR not defined, unable to package") 42 bb.error("WORKDIR not defined, unable to package")
@@ -85,7 +87,7 @@ python do_package_tar () {
85 if not glob('*'): 87 if not glob('*'):
86 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', True), localdata.getVar('PKGR', True))) 88 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', True), localdata.getVar('PKGR', True)))
87 continue 89 continue
88 ret = os.system("tar -czf %s %s" % (tarfn, '.')) 90 ret = subprocess.call("tar -czf %s %s" % (tarfn, '.'), shell=True)
89 if ret != 0: 91 if ret != 0:
90 bb.error("Creation of tar %s failed." % tarfn) 92 bb.error("Creation of tar %s failed." % tarfn)
91} 93}
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index a2b45bcda9..df4cd0bf28 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -282,6 +282,7 @@ def check_sanity_validmachine(sanity_data):
282 282
283def check_sanity(sanity_data): 283def check_sanity(sanity_data):
284 from bb import note, error, data, __version__ 284 from bb import note, error, data, __version__
285 import subprocess
285 286
286 try: 287 try:
287 from distutils.version import LooseVersion 288 from distutils.version import LooseVersion
@@ -495,16 +496,16 @@ def check_sanity(sanity_data):
495 f.write(current_abi) 496 f.write(current_abi)
496 elif abi == "2" and current_abi == "3": 497 elif abi == "2" and current_abi == "3":
497 bb.note("Converting staging from layout version 2 to layout version 3") 498 bb.note("Converting staging from layout version 2 to layout version 3")
498 os.system(sanity_data.expand("mv ${TMPDIR}/staging ${TMPDIR}/sysroots")) 499 subprocess.call(sanity_data.expand("mv ${TMPDIR}/staging ${TMPDIR}/sysroots"), shell=True)
499 os.system(sanity_data.expand("ln -s sysroots ${TMPDIR}/staging")) 500 subprocess.call(sanity_data.expand("ln -s sysroots ${TMPDIR}/staging"), shell=True)
500 os.system(sanity_data.expand("cd ${TMPDIR}/stamps; for i in */*do_populate_staging; do new=`echo $i | sed -e 's/do_populate_staging/do_populate_sysroot/'`; mv $i $new; done")) 501 subprocess.call(sanity_data.expand("cd ${TMPDIR}/stamps; for i in */*do_populate_staging; do new=`echo $i | sed -e 's/do_populate_staging/do_populate_sysroot/'`; mv $i $new; done"), shell=True)
501 f = file(abifile, "w") 502 f = file(abifile, "w")
502 f.write(current_abi) 503 f.write(current_abi)
503 elif abi == "3" and current_abi == "4": 504 elif abi == "3" and current_abi == "4":
504 bb.note("Converting staging layout from version 3 to layout version 4") 505 bb.note("Converting staging layout from version 3 to layout version 4")
505 if os.path.exists(sanity_data.expand("${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}")): 506 if os.path.exists(sanity_data.expand("${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}")):
506 os.system(sanity_data.expand("mv ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS} ${STAGING_BINDIR_CROSS}")) 507 subprocess.call(sanity_data.expand("mv ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS} ${STAGING_BINDIR_CROSS}"), shell=True)
507 os.system(sanity_data.expand("ln -s ${STAGING_BINDIR_CROSS} ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}")) 508 subprocess.call(sanity_data.expand("ln -s ${STAGING_BINDIR_CROSS} ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}"), shell=True)
508 509
509 f = file(abifile, "w") 510 f = file(abifile, "w")
510 f.write(current_abi) 511 f.write(current_abi)
@@ -512,7 +513,7 @@ def check_sanity(sanity_data):
512 messages = messages + "Staging layout has changed. The cross directory has been deprecated and cross packages are now built under the native sysroot.\nThis requires a rebuild.\n" 513 messages = messages + "Staging layout has changed. The cross directory has been deprecated and cross packages are now built under the native sysroot.\nThis requires a rebuild.\n"
513 elif abi == "5" and current_abi == "6": 514 elif abi == "5" and current_abi == "6":
514 bb.note("Converting staging layout from version 5 to layout version 6") 515 bb.note("Converting staging layout from version 5 to layout version 6")
515 os.system(sanity_data.expand("mv ${TMPDIR}/pstagelogs ${SSTATE_MANIFESTS}")) 516 subprocess.call(sanity_data.expand("mv ${TMPDIR}/pstagelogs ${SSTATE_MANIFESTS}"), shell=True)
516 f = file(abifile, "w") 517 f = file(abifile, "w")
517 f.write(current_abi) 518 f.write(current_abi)
518 elif abi == "7" and current_abi == "8": 519 elif abi == "7" and current_abi == "8":
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index ae019379bd..4242f88544 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -145,6 +145,7 @@ def sstate_install(ss, d):
145 145
146def sstate_installpkg(ss, d): 146def sstate_installpkg(ss, d):
147 import oe.path 147 import oe.path
148 import subprocess
148 149
149 def prepdir(dir): 150 def prepdir(dir):
150 # remove dir if it exists, ensure any parent directories do exist 151 # remove dir if it exists, ensure any parent directories do exist
@@ -195,7 +196,7 @@ def sstate_installpkg(ss, d):
195 sstate_hardcode_cmd = "sed -e 's:^:%s:g' %s | xargs %s" % (sstateinst, fixmefn, sstate_sed_cmd) 196 sstate_hardcode_cmd = "sed -e 's:^:%s:g' %s | xargs %s" % (sstateinst, fixmefn, sstate_sed_cmd)
196 197
197 print "Replacing fixme paths in sstate package: %s" % (sstate_hardcode_cmd) 198 print "Replacing fixme paths in sstate package: %s" % (sstate_hardcode_cmd)
198 os.system(sstate_hardcode_cmd) 199 subprocess.call(sstate_hardcode_cmd, shell=True)
199 200
200 # Need to remove this or we'd copy it into the target directory and may 201 # Need to remove this or we'd copy it into the target directory and may
201 # conflict with another writer 202 # conflict with another writer
@@ -309,6 +310,8 @@ python sstate_cleanall() {
309} 310}
310 311
311def sstate_hardcode_path(d): 312def sstate_hardcode_path(d):
313 import subprocess
314
312 # Need to remove hardcoded paths and fix these when we install the 315 # Need to remove hardcoded paths and fix these when we install the
313 # staging packages. 316 # staging packages.
314 # 317 #
@@ -343,14 +346,14 @@ def sstate_hardcode_path(d):
343 sstate_hardcode_cmd = "%s | xargs %s | %s | xargs --no-run-if-empty %s" % (sstate_scan_cmd, sstate_grep_cmd, sstate_filelist_cmd, sstate_sed_cmd) 346 sstate_hardcode_cmd = "%s | xargs %s | %s | xargs --no-run-if-empty %s" % (sstate_scan_cmd, sstate_grep_cmd, sstate_filelist_cmd, sstate_sed_cmd)
344 347
345 print "Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd) 348 print "Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd)
346 os.system(sstate_hardcode_cmd) 349 subprocess.call(sstate_hardcode_cmd, shell=True)
347 350
348 # If the fixmefn is empty, remove it.. 351 # If the fixmefn is empty, remove it..
349 if os.stat(fixmefn).st_size == 0: 352 if os.stat(fixmefn).st_size == 0:
350 os.remove(fixmefn) 353 os.remove(fixmefn)
351 else: 354 else:
352 print "Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd) 355 print "Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd)
353 os.system(sstate_filelist_relative_cmd) 356 subprocess.call(sstate_filelist_relative_cmd, shell=True)
354 357
355def sstate_package(ss, d): 358def sstate_package(ss, d):
356 import oe.path 359 import oe.path