From 29482de968e824bfa3edd5d7237cef22e85cf880 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 19 Jul 2018 20:59:05 +0000 Subject: 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 --- meta/classes/package.bbclass | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'meta') diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 6f7015d912..7a49e4f351 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass @@ -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 "") -- cgit v1.2.3-54-g00ecf