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/insane.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/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): | |||
267 | 267 | ||
268 | if not elf: | 268 | if not elf: |
269 | import stat | 269 | import stat |
270 | import subprocess | ||
270 | pn = d.getVar('PN', True) | 271 | pn = d.getVar('PN', True) |
271 | 272 | ||
272 | # Ensure we're checking an executable script | 273 | # Ensure we're checking an executable script |
@@ -275,7 +276,7 @@ def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages): | |||
275 | # grep shell scripts for possible references to /exec_prefix/ | 276 | # grep shell scripts for possible references to /exec_prefix/ |
276 | exec_prefix = d.getVar('exec_prefix', True) | 277 | exec_prefix = d.getVar('exec_prefix', True) |
277 | statement = "grep -e '%s/' %s > /dev/null" % (exec_prefix, path) | 278 | statement = "grep -e '%s/' %s > /dev/null" % (exec_prefix, path) |
278 | if os.system(statement) == 0: | 279 | if subprocess.call(statement, shell=True) == 0: |
279 | error_msg = pn + ": Found a reference to %s/ in %s" % (exec_prefix, path) | 280 | error_msg = pn + ": Found a reference to %s/ in %s" % (exec_prefix, path) |
280 | package_qa_handle_error("unsafe-references-in-scripts", error_msg, d) | 281 | package_qa_handle_error("unsafe-references-in-scripts", error_msg, d) |
281 | error_msg = "Shell scripts in base_bindir and base_sbindir should not reference anything in exec_prefix" | 282 | 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): | |||
609 | 610 | ||
610 | # The PACKAGE FUNC to scan each package | 611 | # The PACKAGE FUNC to scan each package |
611 | python do_package_qa () { | 612 | python do_package_qa () { |
613 | import subprocess | ||
614 | |||
612 | bb.note("DO PACKAGE QA") | 615 | bb.note("DO PACKAGE QA") |
613 | 616 | ||
614 | logdir = d.getVar('T', True) | 617 | logdir = d.getVar('T', True) |
@@ -619,7 +622,7 @@ python do_package_qa () { | |||
619 | 622 | ||
620 | if os.path.exists(compilelog): | 623 | if os.path.exists(compilelog): |
621 | statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % compilelog | 624 | statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % compilelog |
622 | if os.system(statement) == 0: | 625 | if subprocess.call(statement, shell=True) == 0: |
623 | bb.warn("%s: The compile log indicates that host include and/or library paths were used.\n \ | 626 | bb.warn("%s: The compile log indicates that host include and/or library paths were used.\n \ |
624 | Please check the log '%s' for more information." % (pkg, compilelog)) | 627 | Please check the log '%s' for more information." % (pkg, compilelog)) |
625 | 628 | ||
@@ -628,7 +631,7 @@ python do_package_qa () { | |||
628 | 631 | ||
629 | if os.path.exists(installlog): | 632 | if os.path.exists(installlog): |
630 | statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % installlog | 633 | statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % installlog |
631 | if os.system(statement) == 0: | 634 | if subprocess.call(statement, shell=True) == 0: |
632 | bb.warn("%s: The install log indicates that host include and/or library paths were used.\n \ | 635 | bb.warn("%s: The install log indicates that host include and/or library paths were used.\n \ |
633 | Please check the log '%s' for more information." % (pkg, installlog)) | 636 | Please check the log '%s' for more information." % (pkg, installlog)) |
634 | 637 | ||
@@ -684,6 +687,8 @@ python do_qa_staging() { | |||
684 | } | 687 | } |
685 | 688 | ||
686 | python do_qa_configure() { | 689 | python do_qa_configure() { |
690 | import subprocess | ||
691 | |||
687 | configs = [] | 692 | configs = [] |
688 | workdir = d.getVar('WORKDIR', True) | 693 | workdir = d.getVar('WORKDIR', True) |
689 | bb.note("Checking autotools environment for common misconfiguration") | 694 | bb.note("Checking autotools environment for common misconfiguration") |
@@ -691,7 +696,7 @@ python do_qa_configure() { | |||
691 | statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % \ | 696 | statement = "grep -e 'CROSS COMPILE Badness:' -e 'is unsafe for cross-compilation' %s > /dev/null" % \ |
692 | os.path.join(root,"config.log") | 697 | os.path.join(root,"config.log") |
693 | if "config.log" in files: | 698 | if "config.log" in files: |
694 | if os.system(statement) == 0: | 699 | if subprocess.call(statement, shell=True) == 0: |
695 | bb.fatal("""This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities. | 700 | bb.fatal("""This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities. |
696 | Rerun configure task after fixing this. The path was '%s'""" % root) | 701 | Rerun configure task after fixing this. The path was '%s'""" % root) |
697 | 702 | ||
@@ -713,7 +718,7 @@ Rerun configure task after fixing this. The path was '%s'""" % root) | |||
713 | if gt not in deps: | 718 | if gt not in deps: |
714 | for config in configs: | 719 | for config in configs: |
715 | gnu = "grep \"^[[:space:]]*AM_GNU_GETTEXT\" %s >/dev/null" % config | 720 | gnu = "grep \"^[[:space:]]*AM_GNU_GETTEXT\" %s >/dev/null" % config |
716 | if os.system(gnu) == 0: | 721 | if subprocess.call(gnu, shell=True) == 0: |
717 | bb.fatal("""%s required but not in DEPENDS for file %s. | 722 | bb.fatal("""%s required but not in DEPENDS for file %s. |
718 | Missing inherit gettext?""" % (gt, config)) | 723 | Missing inherit gettext?""" % (gt, config)) |
719 | 724 | ||