Skip to contentSkip to conversation

ipk_write_pkg: add error output

PATCH New Alejandro del Castillo 1 participant 1 message Jan 16, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipk_write_pkg: add error output

---
 meta/classes/package_ipk.bbclass | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
meta/classes/package_ipk.bbclass +12 -9
index 508b7dcaff..5eec20a35b 100644
@@ -224,15 +224,18 @@ 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)
-
-        if d.getVar('IPK_SIGN_PACKAGES') == '1':
-            ipkver = "%s-%s" % (d.getVar('PKGV'), d.getVar('PKGR'))
-            ipk_to_sign = "%s/%s_%s_%s.ipk" % (pkgoutdir, pkgname, ipkver, d.getVar('PACKAGE_ARCH'))
-            sign_ipk(d, ipk_to_sign)
+        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 e:
+            bb.error("Failed to create package, opkg-build failed with: %s" % e.output.decode('utf-8'))
+        else:
+            if d.getVar('IPK_SIGN_PACKAGES') == '1':
+                ipkver = "%s-%s" % (d.getVar('PKGV'), d.getVar('PKGR'))
+                ipk_to_sign = "%s/%s_%s_%s.ipk" % (pkgoutdir, pkgname, ipkver, d.getVar('PACKAGE_ARCH'))
+                sign_ipk(d, ipk_to_sign)
 
     finally:
         cleanupcontrol(root)
Signature · 1 line
2.20.1