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/sanity.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/sanity.bbclass')
-rw-r--r-- | meta/classes/sanity.bbclass | 13 |
1 files changed, 7 insertions, 6 deletions
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 | ||
283 | def check_sanity(sanity_data): | 283 | def 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": |