diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-20 08:29:12 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-24 11:52:27 +0100 |
commit | 0e6a662ba2d03d6339593880b1c21c5455b59316 (patch) | |
tree | 3997177feec5826704d41ecf7ea43ce15ef28b8e | |
parent | 29482de968e824bfa3edd5d7237cef22e85cf880 (diff) | |
download | poky-0e6a662ba2d03d6339593880b1c21c5455b59316.tar.gz |
package: Don't use subshell to execute file
We don't need any functionality from the shell here, its just extra fork
overhead. Therefore remove it and use subprocess directly.
(From OE-Core rev: bcc03ea19e103f6aa93bada2f49fcc5cc7bc0790)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/package.bbclass | 8 | ||||
-rw-r--r-- | meta/lib/oe/package.py | 8 |
2 files changed, 4 insertions, 12 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 7a49e4f351..02914b52bb 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -888,6 +888,7 @@ python fixup_perms () { | |||
888 | 888 | ||
889 | python split_and_strip_files () { | 889 | python split_and_strip_files () { |
890 | import stat, errno | 890 | import stat, errno |
891 | import subprocess | ||
891 | 892 | ||
892 | dvar = d.getVar('PKGD') | 893 | dvar = d.getVar('PKGD') |
893 | pn = d.getVar('PN') | 894 | pn = d.getVar('PN') |
@@ -933,12 +934,7 @@ python split_and_strip_files () { | |||
933 | # 16 - kernel module | 934 | # 16 - kernel module |
934 | def isELF(path): | 935 | def isELF(path): |
935 | type = 0 | 936 | type = 0 |
936 | ret, result = oe.utils.getstatusoutput("file -b '%s'" % path) | 937 | result = subprocess.check_output(["file", "-b", path], stderr=subprocess.STDOUT).decode("utf-8") |
937 | |||
938 | if ret: | ||
939 | msg = "split_and_strip_files: 'file %s' failed" % path | ||
940 | package_qa_handle_error("split-strip", msg, d) | ||
941 | return type | ||
942 | 938 | ||
943 | # Not stripped | 939 | # Not stripped |
944 | if "ELF" in result: | 940 | if "ELF" in result: |
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index 4f3e21ad40..8a303106a9 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py | |||
@@ -56,7 +56,7 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped= | |||
56 | :param qa_already_stripped: Set to True if already-stripped' in ${INSANE_SKIP} | 56 | :param qa_already_stripped: Set to True if already-stripped' in ${INSANE_SKIP} |
57 | This is for proper logging and messages only. | 57 | This is for proper logging and messages only. |
58 | """ | 58 | """ |
59 | import stat, errno, oe.path, oe.utils, mmap | 59 | import stat, errno, oe.path, oe.utils, mmap, subprocess |
60 | 60 | ||
61 | # Detect .ko module by searching for "vermagic=" string | 61 | # Detect .ko module by searching for "vermagic=" string |
62 | def is_kernel_module(path): | 62 | def is_kernel_module(path): |
@@ -72,11 +72,7 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped= | |||
72 | # 16 - kernel module | 72 | # 16 - kernel module |
73 | def is_elf(path): | 73 | def is_elf(path): |
74 | exec_type = 0 | 74 | exec_type = 0 |
75 | ret, result = oe.utils.getstatusoutput("file -b '%s'" % path) | 75 | result = subprocess.check_output(["file", "-b", path], stderr=subprocess.STDOUT).decode("utf-8") |
76 | |||
77 | if ret: | ||
78 | bb.error("split_and_strip_files: 'file %s' failed" % path) | ||
79 | return exec_type | ||
80 | 76 | ||
81 | if "ELF" in result: | 77 | if "ELF" in result: |
82 | exec_type |= 1 | 78 | exec_type |= 1 |