]> code.ossystems Code Review - openembedded-core.git/commitdiff
buildhistory.bbclass: avoid exception for empty BUILDHISTORY_FEATURES variable
authorPeter Bergin <peter@berginkonsult.se>
Fri, 29 Jan 2021 09:50:54 +0000 (10:50 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 29 Jan 2021 21:21:27 +0000 (21:21 +0000)
An exception is fired when a BuildStarted event is sent to buildhistory bbclass
and the variable BUILDHISTORY_FEATURES is not set.

    ERROR: Execution of event handler 'buildhistory_eventhandler' failed
    Traceback (most recent call last):
      File "<...>/meta/classes/buildhistory.bbclass", line 862, in buildhistory_eventhandler(e=<bb.event.BuildStarted object at 0x7f94c3810250>):
         python buildhistory_eventhandler() {
        >    if e.data.getVar('BUILDHISTORY_FEATURES').strip():
                 reset = e.data.getVar("BUILDHISTORY_RESET")
    AttributeError: 'NoneType' object has no attribute 'strip'

This can happen in a multiconfig build where the default configuration use the
buildhistory class but not the configuration in mc. It should be a rare case that
this happens and it was found in a missconfigured build.

Signed-off-by: Peter Bergin <peter@berginkonsult.se>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/buildhistory.bbclass

index daae0561445138b4f3e2c2c1c26543bf6c5cd844..117a44eaf38421640c5e6ebf2527fe7de84847a1 100644 (file)
@@ -859,7 +859,7 @@ END
 }
 
 python buildhistory_eventhandler() {
-    if e.data.getVar('BUILDHISTORY_FEATURES').strip():
+    if (e.data.getVar('BUILDHISTORY_FEATURES') or "").strip():
         reset = e.data.getVar("BUILDHISTORY_RESET")
         olddir = e.data.getVar("BUILDHISTORY_OLD_DIR")
         if isinstance(e, bb.event.BuildStarted):