diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-25 14:51:42 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-26 10:09:08 +0100 |
commit | 244cbcce0ecc4691a9ddfb0a44dc487ff7af0670 (patch) | |
tree | 458fc77e5134104dafff1e9e5aacef430f484401 | |
parent | 38e01f8b940571eba51cf8c41e92ca922969fe44 (diff) | |
download | poky-244cbcce0ecc4691a9ddfb0a44dc487ff7af0670.tar.gz |
utils/multiprocess_launch: Improve failing subprocess output
Output before this patch:
ERROR: bash-4.4.18-r0 do_package_write_ipk: Fatal errors occurred in subprocesses:
Command 'PATH="X" opkg-build -Z xz -a "--memlimit=50% --threads=88" Foobar /media/build1/poky/build/nodistro-glibc/work/core2-64-oe-linux/bash/4.4.18-r0/deploy-ipks/core2-64' returned non-zero exit status 1.: Traceback (most recent call last):
File "/media/build1/poky/meta/lib/oe/utils.py", line 272, in run
ret = self._target(*self._args, **self._kwargs)
File "/media/build1/poky/meta/classes/package_ipk.bbclass", line 230, in ipk_write_pkg
shell=True)
File "/usr/lib/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/usr/lib/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'PATH="X" opkg-build -Z xz -a "--memlimit=50% --threads=88" Foobar /media/build1/poky/build/nodistro-glibc/work/core2-64-oe-linux/bash/4.4.18-r0/deploy-ipks/core2-64' returned non-zero exit status 1.
Note how stdout/stderr from the failing command isn't shown.
After this patch:
ERROR: bash-4.4.18-r0 do_package_write_ipk: Fatal errors occurred in subprocesses:
Command 'PATH="X" opkg-build -Z xz -a "--memlimit=50% --threads=88" Foobar /media/build1/poky/build/nodistro-glibc/work/core2-64-oe-linux/bash/4.4.18-r0/deploy-ipks/core2-64' returned non-zero exit status 1.
Subprocess output:Foobar
*** Error: Package name Foobar contains illegal characters, (other than [a-z0-9.+-])
opkg-build: Please fix the above errors and try again.
We suddenly get a much more usable error message. The traceback is supressed
as its distracting from the real problem in this case.
Ideally python itself would handle this but it doesn't so we have to
wrap the exception. We already do this in bitbake itself for the same reason.
(From OE-Core rev: 09276dc76a8bda237b0b0b6d117a1980ae9dbfcc)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oe/utils.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index a4fd79ccb2..59251810d4 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
@@ -324,7 +324,12 @@ def multiprocess_launch(target, items, d, extraargs=None): | |||
324 | if errors: | 324 | if errors: |
325 | msg = "" | 325 | msg = "" |
326 | for (e, tb) in errors: | 326 | for (e, tb) in errors: |
327 | msg = msg + str(e) + ": " + str(tb) + "\n" | 327 | if isinstance(e, subprocess.CalledProcessError) and e.output: |
328 | msg = msg + str(e) + "\n" | ||
329 | msg = msg + "Subprocess output:" | ||
330 | msg = msg + e.output.decode("utf-8", errors="ignore") | ||
331 | else: | ||
332 | msg = msg + str(e) + ": " + str(tb) + "\n" | ||
328 | bb.fatal("Fatal errors occurred in subprocesses:\n%s" % msg) | 333 | bb.fatal("Fatal errors occurred in subprocesses:\n%s" % msg) |
329 | return results | 334 | return results |
330 | 335 | ||