[oe-commits] [openembedded-core] 25/25: utils/multiprocess_launch: Improve failing subprocess output

git at git.openembedded.org git at git.openembedded.org
Thu Apr 25 14:29:38 UTC 2019


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 0259d3fe29c40cd75456e4c4fec456d8ad031d4f
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Thu Apr 25 14:51:42 2019 +0100

    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.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oe/utils.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index a4fd79c..5925181 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):
     if errors:
         msg = ""
         for (e, tb) in errors:
-            msg = msg + str(e) + ": " + str(tb) + "\n"
+            if isinstance(e, subprocess.CalledProcessError) and e.output:
+                msg = msg + str(e) + "\n"
+                msg = msg + "Subprocess output:"
+                msg = msg + e.output.decode("utf-8", errors="ignore")
+            else:
+                msg = msg + str(e) + ": " + str(tb) + "\n"
         bb.fatal("Fatal errors occurred in subprocesses:\n%s" % msg)
     return results
 

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


More information about the Openembedded-commits mailing list