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.
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/