diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2012-05-29 22:53:06 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-30 12:04:45 +0100 |
commit | e40995e569289598a1d9d71e19734402f2b54718 (patch) | |
tree | 108328e272a149da0e27dec0e0f0bebe602b80b8 /meta/classes/sstate.bbclass | |
parent | e4c35790d6dc23a0933f188f52fa4434784e1d98 (diff) | |
download | poky-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/sstate.bbclass')
-rw-r--r-- | meta/classes/sstate.bbclass | 9 |
1 files changed, 6 insertions, 3 deletions
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 | ||
146 | def sstate_installpkg(ss, d): | 146 | def 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 | ||
311 | def sstate_hardcode_path(d): | 312 | def 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 | ||
355 | def sstate_package(ss, d): | 358 | def sstate_package(ss, d): |
356 | import oe.path | 359 | import oe.path |