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 10:56:15 +0100 |
commit | a07d03cc6f67c88feb9813ae7deb6e4a93552dfe (patch) | |
tree | d95be4dce79dfdce785d92b18f82dfa656a529f4 /meta/classes/sanity.bbclass | |
parent | b1ea93143a473f006b31ab22f88baf41661971a7 (diff) | |
download | openembedded-core-contrib-a07d03cc6f67c88feb9813ae7deb6e4a93552dfe.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]
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): def check_sanity(sanity_data): from bb import note, error, data, __version__ + import subprocess try: from distutils.version import LooseVersion @@ -495,16 +496,16 @@ def check_sanity(sanity_data): f.write(current_abi) elif abi == "2" and current_abi == "3": bb.note("Converting staging from layout version 2 to layout version 3") - os.system(sanity_data.expand("mv ${TMPDIR}/staging ${TMPDIR}/sysroots")) - os.system(sanity_data.expand("ln -s sysroots ${TMPDIR}/staging")) - 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")) + subprocess.call(sanity_data.expand("mv ${TMPDIR}/staging ${TMPDIR}/sysroots"), shell=True) + subprocess.call(sanity_data.expand("ln -s sysroots ${TMPDIR}/staging"), shell=True) + 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) f = file(abifile, "w") f.write(current_abi) elif abi == "3" and current_abi == "4": bb.note("Converting staging layout from version 3 to layout version 4") if os.path.exists(sanity_data.expand("${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}")): - os.system(sanity_data.expand("mv ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS} ${STAGING_BINDIR_CROSS}")) - os.system(sanity_data.expand("ln -s ${STAGING_BINDIR_CROSS} ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}")) + subprocess.call(sanity_data.expand("mv ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS} ${STAGING_BINDIR_CROSS}"), shell=True) + subprocess.call(sanity_data.expand("ln -s ${STAGING_BINDIR_CROSS} ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}"), shell=True) f = file(abifile, "w") f.write(current_abi) @@ -512,7 +513,7 @@ def check_sanity(sanity_data): 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" elif abi == "5" and current_abi == "6": bb.note("Converting staging layout from version 5 to layout version 6") - os.system(sanity_data.expand("mv ${TMPDIR}/pstagelogs ${SSTATE_MANIFESTS}")) + subprocess.call(sanity_data.expand("mv ${TMPDIR}/pstagelogs ${SSTATE_MANIFESTS}"), shell=True) f = file(abifile, "w") f.write(current_abi) elif abi == "7" and current_abi == "8": |