diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-01 14:08:08 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-01 23:58:49 +0100 |
commit | ce11cb449222bc47fea4f6d66ff1cc7cdc529ab9 (patch) | |
tree | 76aa797ad8c8b1ff299c7ed047408f02de2158ed /meta/lib/oe/package.py | |
parent | 66f7ec30a05639739208bb921b689e94b2c880a3 (diff) | |
download | openembedded-core-contrib-ce11cb449222bc47fea4f6d66ff1cc7cdc529ab9.tar.gz |
lib/oe/package: Improve filedeprunner subprocess handling
Currently the exit code of the spawned program isn't checked so it can
fail and the do_package task will continue merrily upon its way.
Use subprocess.check_output() to ensure we check the exit code and
redirect stderr to stdout so if it fails, we see the error output.
We can then drop the existing exception handling as the subprocess
exception gives a much better error.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/package.py')
-rw-r--r-- | meta/lib/oe/package.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index fcee389aa2f..1e5c3aa8e1d 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -176,8 +176,7 @@ def filedeprunner(arg): def process_deps(pipe, pkg, pkgdest, provides, requires): file = None - for line in pipe: - line = line.decode("utf-8") + for line in pipe.split("\n"): m = file_re.match(line) if m: @@ -226,12 +225,8 @@ def filedeprunner(arg): return provides, requires - try: - dep_popen = subprocess.Popen(shlex.split(rpmdeps) + pkgfiles, stdout=subprocess.PIPE) - provides, requires = process_deps(dep_popen.stdout, pkg, pkgdest, provides, requires) - except OSError as e: - bb.error("rpmdeps: '%s' command failed, '%s'" % (shlex.split(rpmdeps) + pkgfiles, e)) - raise e + output = subprocess.check_output(shlex.split(rpmdeps) + pkgfiles, stderr=subprocess.STDOUT).decode("utf-8") + provides, requires = process_deps(output, pkg, pkgdest, provides, requires) return (pkg, provides, requires) |