[oe-commits] [openembedded-core] 03/08: package: Drop subshell usage for dwarfsrcfile generation.

git at git.openembedded.org git at git.openembedded.org
Fri Jul 20 09:39:56 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 3cfd2662caa0ddf092c248baed5f5d8a83ffad58
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Thu Jul 19 20:59:05 2018 +0000

    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.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/package.bbclass | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 6f7015d..7a49e4f 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 "")

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list