diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-19 20:59:05 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-24 11:52:27 +0100 |
| commit | 29482de968e824bfa3edd5d7237cef22e85cf880 (patch) | |
| tree | 527c8c63eb5f3e654fbac32a08a33899ac781c9d | |
| parent | 3fa835d9bcc6802390cefda266b25856178c553f (diff) | |
| download | poky-29482de968e824bfa3edd5d7237cef22e85cf880.tar.gz | |
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>
| -rw-r--r-- | meta/classes/package.bbclass | 12 |
1 files changed, 10 insertions, 2 deletions
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): | |||
| 345 | return debugfiles.keys() | 345 | return debugfiles.keys() |
| 346 | 346 | ||
| 347 | def append_source_info(file, sourcefile, d, fatal=True): | 347 | def append_source_info(file, sourcefile, d, fatal=True): |
| 348 | cmd = "'dwarfsrcfiles' '%s'" % (file) | 348 | import subprocess |
| 349 | (retval, output) = oe.utils.getstatusoutput(cmd) | 349 | |
| 350 | cmd = ["dwarfsrcfiles", file] | ||
| 351 | try: | ||
| 352 | output = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.STDOUT) | ||
| 353 | retval = 0 | ||
| 354 | except subprocess.CalledProcessError as exc: | ||
| 355 | output = exc.output | ||
| 356 | retval = exc.returncode | ||
| 357 | |||
| 350 | # 255 means a specific file wasn't fully parsed to get the debug file list, which is not a fatal failure | 358 | # 255 means a specific file wasn't fully parsed to get the debug file list, which is not a fatal failure |
| 351 | if retval != 0 and retval != 255: | 359 | if retval != 0 and retval != 255: |
| 352 | msg = "dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else "") | 360 | msg = "dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else "") |
