1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 13:29:49 +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
+6 -3
View File
@@ -145,6 +145,7 @@ def sstate_install(ss, d):
def sstate_installpkg(ss, d):
import oe.path
import subprocess
def prepdir(dir):
# remove dir if it exists, ensure any parent directories do exist
@@ -195,7 +196,7 @@ def sstate_installpkg(ss, d):
sstate_hardcode_cmd = "sed -e 's:^:%s:g' %s | xargs %s" % (sstateinst, fixmefn, sstate_sed_cmd)
print "Replacing fixme paths in sstate package: %s" % (sstate_hardcode_cmd)
os.system(sstate_hardcode_cmd)
subprocess.call(sstate_hardcode_cmd, shell=True)
# Need to remove this or we'd copy it into the target directory and may
# conflict with another writer
@@ -309,6 +310,8 @@ python sstate_cleanall() {
}
def sstate_hardcode_path(d):
import subprocess
# Need to remove hardcoded paths and fix these when we install the
# staging packages.
#
@@ -343,14 +346,14 @@ def sstate_hardcode_path(d):
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)
print "Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd)
os.system(sstate_hardcode_cmd)
subprocess.call(sstate_hardcode_cmd, shell=True)
# If the fixmefn is empty, remove it..
if os.stat(fixmefn).st_size == 0:
os.remove(fixmefn)
else:
print "Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd)
os.system(sstate_filelist_relative_cmd)
subprocess.call(sstate_filelist_relative_cmd, shell=True)
def sstate_package(ss, d):
import oe.path