package: Drop subshell usage for dwarfsrcfile generation.

The command for running dwarfsrcfiles is simple and does not need a subshell
for each execution. By expanding out this function to use check_output()
from subprocess and a list of arguments, the shell overhead can be dropped.

For recipes with lots of files this gives a significant saving.

(From OE-Core rev: 6334129dfbe266602fab70ce445641053a05be6c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2018-07-19 20:59:05 +00:00
parent 3fa835d9bc
commit 29482de968

View File

@@ -345,8 +345,16 @@ def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output):
return debugfiles.keys()
def append_source_info(file, sourcefile, d, fatal=True):
cmd = "'dwarfsrcfiles' '%s'" % (file)
(retval, output) = oe.utils.getstatusoutput(cmd)
import subprocess
cmd = ["dwarfsrcfiles", file]
try:
output = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.STDOUT)
retval = 0
except subprocess.CalledProcessError as exc:
output = exc.output
retval = exc.returncode
# 255 means a specific file wasn't fully parsed to get the debug file list, which is not a fatal failure
if retval != 0 and retval != 255:
msg = "dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else "")