Bug 6551

Summary: layer priorities shadowing
Product: [Build System, Metadata & Runtime] BitBake Reporter: Stefan Mueller-Klieser <s.mueller-klieser>
Component: bitbakeAssignee: Nitin Kamble <nitin.a.kamble>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: Medium CC: dvhart, nitin.a.kamble, poky.bs.watcher, poky.watcher, richard.purdie, tom.zanussi
Version: unspecified   
Target Milestone: 1.7   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Stefan Mueller-Klieser 2014-07-18 09:10:09 UTC
occurs on:
poky branch master
commit 1dcdd877c7946be
meta-intel branch master

I report an unexpected behavior with layers containing sub directory layers, seen in the meta-intel directory structure. If a sub layer has a higher BBFILE_PRIORITY set in the layer.conf than the top directory layer.conf, the priorities will be only applied if the sub layer is listed prior to the top layer in the bblayers.conf. If the sub layer is listed after the top layer, the priorities from the sub layer.conf will be ignored or shadowed. Is this intended behavior or a bug?
Regards, Stefan
Comment 1 Richard Purdie 2014-09-25 12:53:04 UTC
Its probably working as designed but the configuration is unclear.

The top level layer.conf does:

BBFILE_PATTERN_intel := "^${LAYERDIR}/"
BBFILE_PRIORITY_intel = "5"

then crownbay for example does:

BBFILE_PATTERN_crownbay := "^${LAYERDIR}/"
BBFILE_PRIORITY_crownbay = "6"

so when bitbake has some recipe file, it tries to resolve which layer the file belongs to and it therefore calls each BBFILE_PATTERN in turn until one matches. Since the crownbay directory is within intel, it only works if crownbay is called first, then intel as a later match.

In turn, that only happens if the order in bblayers.conf is the correct way around.

So the fix is either to improve the BBFILE_PATTERN_intel := "^${LAYERDIR}/" to say BBFILE_PATTERN_intel := "^${LAYERDIR}/common" and/or to be specific about the bblayers.conf ordering (which does matter).

I'm ccing a few meta-intel people to see if this is something they can fix.
Comment 2 Nitin Kamble 2014-09-25 20:26:07 UTC
The <<BBFILE_PATTERN_intel := "^${LAYERDIR}/common">>  solution look favorable to me, as it can remove the requirement of ordering of listing layers in the bblayers.conf file. I feel the ordering should not be needed, as layer priority is handling same requirement. But I need to verify it can really solve the issue. I will do it and respond it here.
Comment 3 Nitin Kamble 2014-09-26 00:17:16 UTC
The <<BBFILE_PATTERN_intel := "^${LAYERDIR}/common">>  solution is working as expected. The oder of layers in the bblayers.conf does not affect order in which the layers are considered. The layer priority mechanism is working as expected. I could build couple of BSPs with this change toe BBFILE_PATTERN variable.
  Looks like the change can go in without any other side effects. 

RP,
  Are there any other aspects to this change I need to be aware of before pushing the change in the meta-intel layer?
Comment 4 Richard Purdie 2014-09-29 13:16:08 UTC
Nitin: No, I think that fix can be merged.
Comment 5 Nitin Kamble 2014-10-01 20:43:35 UTC
patch on the meta-intel ML
Comment 6 Nitin Kamble 2014-10-03 22:38:27 UTC
commit 6702f5a00c414c68f6f6ceae46552bce571cf93f
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date:   Fri Sep 26 17:04:57 2014 -0700

    layer.conf: Avoid conflicts with sub-layers
    
    The layer priority is getting ignored because the same set of files
    are visible in the meta-intel layer as well as any of its sub layers.
    
    The layer pattern for recipe files is changed from "^${LAYERDIR}/" to
    "^${LAYERDIR}/common" to stop unintentionally including the sub-layer
    recipe files in the meta-intel layer.
    
    Fixes Bug:
    [YOCTO #6552]
    
    Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
    Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>