Bug 15587

Summary: Processing of LAYERDIR during layer parsing causes loss of data
Product: [Build System, Metadata & Runtime] BitBake Reporter: Adam Blank <adam.blank.g>
Component: bitbakeAssignee: Unassigned <unassigned>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Medium+ CC: adam.blank.g, poky.bs.watcher, poky.watcher, randy.macleod, richard.purdie, yoann.congal
Version: 2.0.3   
Target Milestone: 6.99   
Hardware: All   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Adam Blank 2024-09-04 09:27:55 UTC
Current implementation of expandVarref has the following undesired characteristics:

- ref = '${%s}' % variable
  This line discriminates this type of variable reference ${@d.getVar('LAYERDIR')}"
  which causes them to always resolve to None

- referrervalue = self.getVar(key, False)
  if referrervalue and isinstance(referrervalue, str) and ref in referrervalue:
      self.setVar(key, referrervalue.replace(ref, value))
  This block (the serVar() call in particular) has the effect,
  that variables which reference LAYERDIR lose their append/prepend/remove data.
  During the call to expandVarref('LAYERDIR'), whichever append/prepend/remove
  apply at the moment are used by getVar(), and then they are all dropped by serVar(),
  including the ones whose OVERRIDES would come from layers parsed later
Comment 1 Randy MacLeod 2024-09-05 14:36:34 UTC
See discussion on mailing list.
Comment 3 Richard Purdie 2026-09-10 15:13:03 UTC
We are thinking of changing the way layers get added and we could try and take this into account when we do that.