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-02 00:52:10 +0100 |
commit | 55f0493e26881123c6317edfb9dc7af738d3d2d5 (patch) | |
tree | 91ef0e1e209bfb79015edcc487a217889bca1780 /meta/lib | |
parent | d69a8766521c0cdac509cde61f5c201c92a9f8ba (diff) | |
download | poky-55f0493e26881123c6317edfb9dc7af738d3d2d5.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.
(From OE-Core rev: ce11cb449222bc47fea4f6d66ff1cc7cdc529ab9)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-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 fcee389aa2..1e5c3aa8e1 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py | |||
@@ -176,8 +176,7 @@ def filedeprunner(arg): | |||
176 | 176 | ||
177 | def process_deps(pipe, pkg, pkgdest, provides, requires): | 177 | def process_deps(pipe, pkg, pkgdest, provides, requires): |
178 | file = None | 178 | file = None |
179 | for line in pipe: | 179 | for line in pipe.split("\n"): |
180 | line = line.decode("utf-8") | ||
181 | 180 | ||
182 | m = file_re.match(line) | 181 | m = file_re.match(line) |
183 | if m: | 182 | if m: |
@@ -226,12 +225,8 @@ def filedeprunner(arg): | |||
226 | 225 | ||
227 | return provides, requires | 226 | return provides, requires |
228 | 227 | ||
229 | try: | 228 | output = subprocess.check_output(shlex.split(rpmdeps) + pkgfiles, stderr=subprocess.STDOUT).decode("utf-8") |
230 | dep_popen = subprocess.Popen(shlex.split(rpmdeps) + pkgfiles, stdout=subprocess.PIPE) | 229 | provides, requires = process_deps(output, pkg, pkgdest, provides, requires) |
231 | provides, requires = process_deps(dep_popen.stdout, pkg, pkgdest, provides, requires) | ||
232 | except OSError as e: | ||
233 | bb.error("rpmdeps: '%s' command failed, '%s'" % (shlex.split(rpmdeps) + pkgfiles, e)) | ||
234 | raise e | ||
235 | 230 | ||
236 | return (pkg, provides, requires) | 231 | return (pkg, provides, requires) |
237 | 232 | ||