Bug 1398

Summary: Provide a helpful message when MACHINE is not defined
Product: [Build System, Metadata & Runtime] BitBake Reporter: Darren Hart <dvhart>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: Low CC: poky.bs.watcher, poky.watcher, sgw
Version: unspecified   
Target Milestone: 1.2   
Hardware: x86   
OS: Multiple   
Whiteboard: Patch our for review on mailing list
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Darren Hart 2011-08-24 10:29:35 UTC
It isn't uncommon for something to go wrong with the .conf files when one is doing a lot of builds. On a couple occasions I've ended up with a config without a MACHINE defined. The message back from bitbake could be a lot more helpful / parsable:

Pseudo is not present but is required, building this first before the main build
ERROR: Execution of event handler 'check_sanity_eventhandler' failed
Traceback (most recent call last):
  File "/home/dvhart/source/poky.git/bitbake/lib/bb/data_smart.py", line 60, in VariableParse.var_sub(match=<_sre.SRE_Match object at 0x1795238>):
                         raise Exception("variable %s references itself!" % self.varname)
    >            var = self.d.getVar(key, 1)
                 if var is not None:
  File "/home/dvhart/source/poky.git/bitbake/lib/bb/data_smart.py", line 271, in DataSmart.getVar(var='MACHINE_ARCH', expand=1, noweakdefault=False):
         def getVar(self, var, expand=False, noweakdefault=False):
    >        return self.getVarFlag(var, "content", expand, noweakdefault)

  File "/home/dvhart/source/poky.git/bitbake/lib/bb/data_smart.py", line 318, in DataSmart.getVarFlag(var='MACHINE_ARCH', flag='content', expand=1, noweakdefault=False):
             if expand and value:
    >            value = self.expand(value, None)
             return value
  File "/home/dvhart/source/poky.git/bitbake/lib/bb/data_smart.py", line 144, in DataSmart.expand(s="${@[bb.data.getVar('TUNE_PKGARCH', d, 1), bb.data.getVar('MACHINE', d, 1)][bool(bb.data.getVar('MACHINE', d, 1))].replace('-', '_')}", varname=None):
         def expand(self, s, varname):
    >        return self.expandWithRefs(s, varname).value

  File "/home/dvhart/source/poky.git/bitbake/lib/bb/data_smart.py", line 134, in DataSmart.expandWithRefs(s="${@[bb.data.getVar('TUNE_PKGARCH', d, 1), bb.data.getVar('MACHINE', d, 1)][bool(bb.data.getVar('MACHINE', d, 1))].replace('-', '_')}", varname=None):
                 except Exception as exc:
    >                raise ExpansionError(varname, s, exc)

ExpansionError: Failure expanding variable None, expression was ${@[bb.data.getVar('TUNE_PKGARCH', d, 1), bb.data.getVar('MACHINE', d, 1)][bool(bb.data.getVar('MACHINE', d, 1))].replace('-', '_')} which triggered exception AttributeError: 'NoneType' object has no attribute 'replace'

ERROR: Failure expanding variable None, expression was ${@[bb.data.getVar('TUNE_PKGARCH', d, 1), bb.data.getVar('MACHINE', d, 1)][bool(bb.data.getVar('MACHINE', d, 1))].replace('-', '_')} which triggered exception AttributeError: 'NoneType' object has no attribute 'replace'
ERROR: Command execution failed: Exited with 1
Comment 2 Darren Hart 2011-08-31 16:30:19 UTC
Just tested locally, fix verified.