Bug 16497

Summary: layerindex: distro configuration leaks into the parsing of a layer's recipes
Product: [Yocto Project Subprojects] Layer Index Reporter: Tim Orling <tim.orling>
Component: Layer IndexAssignee: Tim Orling <tim.orling>
Status: IN PROGRESS REVIEW --- QA Contact: apoorv sangal <apoorvsangal>
Severity: normal    
Priority: Medium+    
Version: unspecified   
Target Milestone: 6.2 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Tim Orling 2026-11-14 04:32:44 UTC
To index a layer's distros, update_layer.py parses each distro configuration file (conf/distro/*.conf) with update_distro_conf_file(), but it parses it into the same datastore it then uses to parse the layer's recipes. Every recipe parsed after a distro configuration in the same run therefore gets that distro's configuration, so its indexed data can be wrong, and parsing can fail.

Example: meta-luneos on scarthgap. After conf/distro/luneos.conf has been parsed, image recipes such as luneos-emulator-appliance.bb fail with:

  bb.data_smart.ExpansionError: Failure expanding variable WEBOS_DISTRO_TOPDIR_BRANCH, expression was ${@oebackport.buildcfg.get_metadata_git_branch(...)}
  NameError: name 'oebackport' is not defined

WEBOS_DISTRO_TOPDIR_BRANCH comes from luneos.inc, which only luneos.conf includes, so these recipes should never see it when indexed. (The NameError itself is bug 16192.) Whether a recipe is affected depends on the order the files are processed in.

Fix: parse each distro configuration file into a copy of the datastore.
Comment 1 Tim Orling 2026-11-14 06:48:35 UTC
Patch sent for review, staged on master-next:

update_layer: don't parse distro configuration into the recipe datastore
https://lore.kernel.org/yocto-patches/20261114044035.88470-2-tim.orling@konsulko.com/