Skip to contentSkip to conversation

base: Improve module import error message

PATCH New Richard Purdie 1 participant 2 messages Oct 2, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 base: Improve module import error message

Turn:

ERROR: Unable to parse Var <OE_IMPORTED[:=]>
Traceback (most recent call last):
File "Var <OE_IMPORTED[:=]>", line 1, in <module>
File "/media/build1/poky/meta/classes/base.bbclass", line 35, in oe_import(d=<bb.data_smart.DataSmart object at 0x7f1d941ad208>):
for toimport in oe.data.typed_value("OE_IMPORTS", d):
> imported = __import__(toimport)
inject(toimport.split(".", 1)[0], imported)
File "/media/build1/poky/meta/lib/oe/sstatesig.py", line 267, in <module>:

Quoted 1 line

class SignatureGeneratorOEEquivHash(SignatureGeneratorOEBasicHashMixIn, bb.siggen.SignatureGeneratorUniHashMixIn, bb.siggen.SignatureGeneratorBasicHash):

name = "OEEquivHash"
bb.data_smart.ExpansionError: Failure expanding variable OE_IMPORTED[:=], expression was ${@oe_import(d)} which triggered exception AttributeError: module 'bb.siggen' has no attribute 'SignatureGeneratorUniHashMixIn'

into:
ERROR: Error importing OE modules: module 'bb.siggen' has no attribute 'SignatureGeneratorUniHashMixIn'

which can then trigger a version mismatch error message.

---
 meta/classes/base.bbclass | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
meta/classes/base.bbclass +5 -3
index 0c8a4b28629..d3184ecf7bb 100644
@@ -32,9 +32,11 @@ def oe_import(d):
 
     import oe.data
     for toimport in oe.data.typed_value("OE_IMPORTS", d):
-        imported = __import__(toimport)
-        inject(toimport.split(".", 1)[0], imported)
-
+        try:
+            imported = __import__(toimport)
+            inject(toimport.split(".", 1)[0], imported)
+        except AttributeError as e:
+            bb.error("Error importing OE modules: %s" % str(e))
     return ""
 
 # We need the oe module name space early (before INHERITs get added)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 sanity.conf: Bump minimum bitbake version

We need SignatureGeneratorUniHashMixIn from newer bitbake so bump the minimum version.

---
 meta/conf/sanity.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/sanity.conf +1 -1
index 92e1886990f..8b2f6553949 100644
@@ -3,7 +3,7 @@
 # See sanity.bbclass
 #
 # Expert users can confirm their sanity with "touch conf/sanity.conf"
-BB_MIN_VERSION = "1.43.1"
+BB_MIN_VERSION = "1.43.2"
 
 SANITY_ABIFILE = "${TMPDIR}/abi_version"
 
Signature · 1 line
2.20.1