Bug 11212

Summary: bitbake-layers throws a non-obvious error if a layer's dependencies are missing
Product: [Build System, Metadata & Runtime] BitBake Reporter: Bruce Ashfield <bruce.ashfield>
Component: bitbakeAssignee: Stephano Cetola <stephano>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: Medium CC: poky.bs.watcher, poky.watcher
Version: unspecified   
Target Milestone: 2.4 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Bruce Ashfield 2017-03-22 15:14:14 UTC
If you don't add layers in the right order, you get a parse error stack
trace.

Nothing wrong with the trace .. it just doesn't tell you what the error
is and how to fix it.

I had to mess around for quite a while until I realized it was missing
dependencies.

i.e.:

bruce@yow-dellw-ag:~/overc/build$ bitbake-layers add-layer ../meta-openembedded/meta-networking/
bruce@yow-dellw-ag:~/overc/build$ bitbake-layers add-layer ../meta-openembedded/meta-filesystems/
Traceback (most recent call last):
  File "/home/bruce/overc/poky/bitbake/bin/bitbake-layers", line 115, in <module>
    ret = main()
  File "/home/bruce/overc/poky/bitbake/bin/bitbake-layers", line 83, in main
    tinfoil.prepare(True)
  File "/home/bruce/overc/poky/bitbake/lib/bb/tinfoil.py", line 262, in prepare
    self.run_command('parseConfiguration')
  File "/home/bruce/overc/poky/bitbake/lib/bb/tinfoil.py", line 312, in run_command
    raise TinfoilCommandFailed(result[1])
bb.tinfoil.TinfoilCommandFailed: Traceback (most recent call last):
  File "/home/bruce/overc/poky/bitbake/lib/bb/command.py", line 81, in runCommand
    result = command_method(self, commandline)
  File "/home/bruce/overc/poky/bitbake/lib/bb/command.py", line 315, in parseConfiguration
    command.cooker.parseConfiguration()
  File "/home/bruce/overc/poky/bitbake/lib/bb/cooker.py", line 541, in parseConfiguration
    self.handleCollections(self.data.getVar("BBFILE_COLLECTIONS"))
  File "/home/bruce/overc/poky/bitbake/lib/bb/cooker.py", line 1303, in handleCollections
    raise CollectionError("Errors during parsing layer configuration")
bb.cooker.CollectionError: Errors during parsing layer configuration
Comment 1 Stephano Cetola 2017-04-10 20:41:48 UTC
You should have seen an error from the Bitbake.Parsing log before the stacktrace:

$ bitbake-layers add-layer ../meta-networking/
$ bitbake-layers add-layer ../meta-filesystems/
ERROR: Layer 'networking-layer' depends on layer 'meta-python', but this layer is not enabled in your configuration
ERROR: Layer 'networking-layer' depends on layer 'openembedded-layer', but this layer is not enabled in your configuration
ERROR: Layer 'networking-layer' depends on layer 'meta-python', but this layer is not enabled in your configuration
ERROR: Layer 'networking-layer' depends on layer 'openembedded-layer', but this layer is not enabled in your configuration
Traceback (most recent call last):
  File "/home/stephano/build/master/openembedded-core/bitbake/lib/bb/tinfoil.py", line 267, in prepare
    self.run_command('parseConfiguration')
...

Do you have your bitbake logs going somewhere other than stdout?
Comment 2 Bruce Ashfield 2017-04-11 15:54:13 UTC
I just updated again, and yes, it is now throwing a big red error message that is more clear.

I can't say that I like python back traces in my error messages, since they hide the real information .. but no need to change that just for this.

I'm closing the bug as resolved/notabug.
Comment 3 Stephano Cetola 2017-04-11 16:48:10 UTC
Sounds good, thanks for the update.

I think the stack trace, while not an eminent issue, is a symptom of larger issues in tinfoil. For example, the fact that the error (ERROR: Layer 'networking-layer') gets printed two times. Error handling inside tinfoil is inherently complex, however it could use with some polish at the least.