mirror of
https://git.yoctoproject.org/poky
synced 2026-05-09 05:29:32 +00:00
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>
This commit is contained in:
@@ -888,6 +888,7 @@ python fixup_perms () {
|
||||
|
||||
python split_and_strip_files () {
|
||||
import stat, errno
|
||||
import subprocess
|
||||
|
||||
dvar = d.getVar('PKGD')
|
||||
pn = d.getVar('PN')
|
||||
@@ -933,12 +934,7 @@ python split_and_strip_files () {
|
||||
# 16 - kernel module
|
||||
def isELF(path):
|
||||
type = 0
|
||||
ret, result = oe.utils.getstatusoutput("file -b '%s'" % path)
|
||||
|
||||
if ret:
|
||||
msg = "split_and_strip_files: 'file %s' failed" % path
|
||||
package_qa_handle_error("split-strip", msg, d)
|
||||
return type
|
||||
result = subprocess.check_output(["file", "-b", path], stderr=subprocess.STDOUT).decode("utf-8")
|
||||
|
||||
# Not stripped
|
||||
if "ELF" in result:
|
||||
|
||||
@@ -56,7 +56,7 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped=
|
||||
:param qa_already_stripped: Set to True if already-stripped' in ${INSANE_SKIP}
|
||||
This is for proper logging and messages only.
|
||||
"""
|
||||
import stat, errno, oe.path, oe.utils, mmap
|
||||
import stat, errno, oe.path, oe.utils, mmap, subprocess
|
||||
|
||||
# Detect .ko module by searching for "vermagic=" string
|
||||
def is_kernel_module(path):
|
||||
@@ -72,11 +72,7 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped=
|
||||
# 16 - kernel module
|
||||
def is_elf(path):
|
||||
exec_type = 0
|
||||
ret, result = oe.utils.getstatusoutput("file -b '%s'" % path)
|
||||
|
||||
if ret:
|
||||
bb.error("split_and_strip_files: 'file %s' failed" % path)
|
||||
return exec_type
|
||||
result = subprocess.check_output(["file", "-b", path], stderr=subprocess.STDOUT).decode("utf-8")
|
||||
|
||||
if "ELF" in result:
|
||||
exec_type |= 1
|
||||
|
||||
Reference in New Issue
Block a user