Bug 14054

Summary: bitbake-layers allows adding invalid layer configuration
Product: [Build System, Metadata & Runtime] BitBake Reporter: Ross Burton <ross.burton>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: poky.bs.watcher, poky.watcher, randy.macleod
Version: 3.3   
Target Milestone: 3.3 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Ross Burton 2020-09-21 03:00:22 UTC
'bitbake-layers add-layer' doesn't validate the layer configuration before writing it:

$ bitbake-layers  show-layers
NOTE: Starting bitbake server...
layer                 path                                      priority
==========================================================================
meta                  /home/ross/Yocto/poky/meta                5
meta-poky             /home/ross/Yocto/poky/meta-poky           5
meta-yocto-bsp        /home/ross/Yocto/poky/meta-yocto-bsp      5


$ bitbake-layers add-layer ~/Yocto/meta-arm/meta-arm
NOTE: Starting bitbake server...

$ bitbake-layers  show-layers
NOTE: Starting bitbake server...
Traceback (most recent call last):
  File "/home/ross/Yocto/poky/bitbake/bin/bitbake-layers", line 95, in <module>
    ret = main()
  File "/home/ross/Yocto/poky/bitbake/bin/bitbake-layers", line 63, in main
    tinfoil.prepare(True)
  File "/home/ross/Yocto/poky/bitbake/lib/bb/tinfoil.py", line 410, in prepare
    self.run_command('parseConfiguration')
  File "/home/ross/Yocto/poky/bitbake/lib/bb/tinfoil.py", line 466, in run_command
    raise TinfoilCommandFailed(result[1])
bb.tinfoil.TinfoilCommandFailed: Traceback (most recent call last):
  File "/home/ross/Yocto/poky/bitbake/lib/bb/command.py", line 81, in runCommand
    result = command_method(self, commandline)
  File "/home/ross/Yocto/poky/bitbake/lib/bb/command.py", line 281, in parseConfiguration
    command.cooker.parseConfiguration()
  File "/home/ross/Yocto/poky/bitbake/lib/bb/cooker.py", line 426, in parseConfiguration
    self.handleCollections(self.data.getVar("BBFILE_COLLECTIONS"))
  File "/home/ross/Yocto/poky/bitbake/lib/bb/cooker.py", line 1255, in handleCollections
    raise CollectionError("Errors during parsing layer configuration")
bb.cooker.CollectionError: Errors during parsing layer configuration

The actual error (not visible, see bug 13183) is that meta-arm depends on meta-arm-toolchain.  This should have prevented adding meta-arm to the layers.
Comment 1 Richard Purdie 2020-09-23 02:32:09 UTC
The issue is that it probably can't validate it without writing it, then the exception causes the rollback to fail?
Comment 2 Richard Purdie 2020-10-09 08:28:26 UTC
I see something a little different:

richard@jet$ bitbake-layers add-layer ../meta-arm/meta-arm
NOTE: Starting bitbake server...

richard@jet$ bitbake show-layers
ERROR: Layer 'meta-arm' depends on layer 'arm-toolchain', but this layer is not enabled in your configuration

which release was this with?
Comment 3 Richard Purdie 2020-10-09 09:43:30 UTC
Obviously that should be "bitbake-layers show-layers" but it was confusing as the wrong command was showing me the error I wanted!