On a second thought it should be bb.error not bb.fatal - are all okay with fixing just this one for now?

On 20.05.20 00:02, Richard Purdie wrote:
On Tue, 2020-05-19 at 20:36 +0200, Konrad Weihmann wrote:
in case the opkg command fails in before no output of the tool
itself was printed to assist the user with debugging the issue.
Print all output of the tool by using CalledProcessError wrapper around
the call

Signed-off-by: Konrad Weihmann <kweihm...@outlook.com>
---
  meta/classes/package_ipk.bbclass | 11 +++++++----
  1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass
index c008559e4a..5e7d552cc5 100644
--- a/meta/classes/package_ipk.bbclass
+++ b/meta/classes/package_ipk.bbclass
@@ -223,10 +223,13 @@ def ipk_write_pkg(pkg, d):
              conffiles.close()
os.chdir(basedir)
-        subprocess.check_output("PATH=\"%s\" %s %s %s" % 
(localdata.getVar("PATH"),
-                                                          
d.getVar("OPKGBUILDCMD"), pkg, pkgoutdir),
-                                stderr=subprocess.STDOUT,
-                                shell=True)
+        try:
+            subprocess.check_output("PATH=\"%s\" %s %s %s" % 
(localdata.getVar("PATH"),
+                                                            
d.getVar("OPKGBUILDCMD"), pkg, pkgoutdir),
+                                    stderr=subprocess.STDOUT,
+                                    shell=True)
+        except subprocess.CalledProcessError as exp:
+            bb.fatal("{} failed with {}: {}".format(exp.cmd, exp.returncode, 
exp.output.decode("utf-8")))
if d.getVar('IPK_SIGN_PACKAGES') == '1':
              ipkver = "%s-%s" % (d.getVar('PKGV'), d.getVar('PKGR'))

I get the feeling we have a problem with our subprocess calls and
debugging but its hard to know what to do about it. We can patch each
call site like this but it starts to make we wonder whether we need a
general wrapper, or we're missing something in bitbake or elsewhere to
help with things.

There is this code:

http://git.yoctoproject.org/cgit.cgi/poky/tree/bitbake/lib/bb/utils.py#n378

which is meant to help but it clearly isn't helping/catching all cases.

I think we are going to need to look at a wider/more general solution
or at least have a plan for one.

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#138520): 
https://lists.openembedded.org/g/openembedded-core/message/138520
Mute This Topic: https://lists.openembedded.org/mt/74331803/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to