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/insane.bbclass | |
parent | b1ea93143a473f006b31ab22f88baf41661971a7 (diff) | |
download | openembedded-core-a07d03cc6f67c88feb9813ae7deb6e4a93552dfe.tar.gz openembedded-core-a07d03cc6f67c88feb9813ae7deb6e4a93552dfe.tar.bz2 openembedded-core-a07d03cc6f67c88feb9813ae7deb6e4a93552dfe.zip |
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/insane.bbclass')
-rw-r--r-- | meta/classes/insane.bbclass | 15 |
1 files changed, 10 insertions, 5 deletions
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): if not elf: import stat + import subprocess pn = d.getVar('PN', True) # Ensure we're checking an executable script @@ -275,7 +276,7 @@ def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages): # grep shell scripts for possible references to /exec_prefix/ exec_prefix = d.getVar('exec_prefix', True) statement = "grep -e '%s/' %s > /dev/null" % (exec_prefix, path) - if os.system(statement) == 0: + if subprocess.call(statement, shell=True) == 0: error_msg = pn + ": Found a reference to %s/ in %s" % (exec_prefix, path) package_qa_handle_error("unsafe-references-in-scripts", error_msg, d) 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): # The PACKAGE FUNC to scan each package python do_package_qa () { + import subprocess + bb.note("DO PACKAGE QA") logdir = d.getVar('T', True) @@ -619,7 +622,7 @@ python do_package_qa () { if os.path.exists(compilelog): statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % compilelog - if os.system(statement) == 0: + if subprocess.call(statement, shell=True) == 0: bb.warn("%s: The compile log indicates that host include and/or library paths were used.\n \ Please check the log '%s' for more information." % (pkg, compilelog)) @@ -628,7 +631,7 @@ python do_package_qa () { if os.path.exists(installlog): statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % installlog - if os.system(statement) == 0: + if subprocess.call(statement, shell=True) == 0: bb.warn("%s: The install log indicates that host include and/or library paths were used.\n \ Please check the log '%s' for more information." % (pkg, installlog)) @@ -684,6 +687,8 @@ python do_qa_staging() { } python do_qa_configure() { + import subprocess + configs = [] workdir = d.getVar('WORKDIR', True) bb.note("Checking autotools environment for common misconfiguration") @@ -691,7 +696,7 @@ python do_qa_configure() { statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % \ os.path.join(root,"config.log") if "config.log" in files: - if os.system(statement) == 0: + if subprocess.call(statement, shell=True) == 0: bb.fatal("""This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities. Rerun configure task after fixing this. The path was '%s'""" % root) @@ -713,7 +718,7 @@ Rerun configure task after fixing this. The path was '%s'""" % root) if gt not in deps: for config in configs: gnu = "grep \"^[[:space:]]*AM_GNU_GETTEXT\" %s >/dev/null" % config - if os.system(gnu) == 0: + if subprocess.call(gnu, shell=True) == 0: bb.fatal("""%s required but not in DEPENDS for file %s. Missing inherit gettext?""" % (gt, config)) |