Patchwork [3/6] license.bbclass: cleanly handle invalid licenses in incompatible_license

login
register
mail settings
Submitter Christopher Larson
Date Jan. 15, 2013, 8:22 p.m.
Message ID <15719a0894a4a514d5cad911198ac789524dcfc3.1358281118.git.chris_larson@mentor.com>
Download mbox | patch
Permalink /patch/42675/
State Accepted
Commit cea9f48ea80a65d48e5f1ca1ce2c3fbb62958c1b
Headers show

Comments

Christopher Larson - Jan. 15, 2013, 8:22 p.m.
From: Christopher Larson <chris_larson@mentor.com>

This gives us an error message (bb.fatal) rather than a traceback due to the
uncaught LicenseError.

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
 meta/classes/license.bbclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index cfb816d..cd18e19 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -237,7 +237,10 @@  def incompatible_license(d, dont_want_licenses, package=None):
     def choose_lic_set(a, b):
         return a if all(license_ok(lic) for lic in a) else b
 
-    licenses=oe.license.flattened_licenses(license, choose_lic_set)
+    try:
+        licenses = oe.license.flattened_licenses(license, choose_lic_set)
+    except oe.license.LicenseError as exc:
+        bb.fatal('%s: %s' % (d.getVar('P', True), exc))
     return any(not license_ok(l) for l in licenses)
 
 def check_license_flags(d):