In "cooker.py" there is a section of code that scans a layer for its priority. However, only the success path avoids an otherwise undefined variable, so the error is not reported and bitbake crashes. This was found while experimenting with a weak layer. UnboundLocalError: local variable 'cre' referenced before assignment Here is the code in question. Notice that 'cre' is only defined on the success path. vvvvvvv # Calculate all layer priorities using calc_layer_priority and store in bbfile_config_priorities for c in collection_list: calc_layer_priority(c) regex = self.data.getVar("BBFILE_PATTERN_%s" % c) if regex == None: parselog.error("BBFILE_PATTERN_%s not defined" % c) errors = True continue elif regex == "": parselog.debug(1, "BBFILE_PATTERN_%s is empty" % c) errors = False else: try: cre = re.compile(regex) except re.error: parselog.error("BBFILE_PATTERN_%s \"%s\" is not a valid regular expression", c, regex) errors = True continue self.bbfile_config_priorities.append((c, regex, cre, collection_priorities[c])) ^^^^^^^^ I propose that the resolution is to move the append right after 'cre' is defined, since that is the only success path.
This was fixed by this commit: commit fe70fd1a03dcbf516ee10866b8a68daf942c0a07 Author: Robert Yang <liezhi.yang@windriver.com> Date: Thu Feb 1 23:15:22 2018 +0800 bitbake: bitbake: cooker: skip when BBFILE_PATTERN is empty