Bug 15987

Summary: Fragment enable/disable is confusing and can cause user error
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Richard Purdie <richard.purdie>
Component: coreAssignee: Alexander Kanavin <alex.kanavin>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher, randy.macleod
Version: 0.0.0   
Target Milestone: 5.3 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

Description Richard Purdie 2025-10-02 11:34:54 UTC
Imagine running:

build-config-setup enable-fragment machine/qemuarm
build-config-setup enable-fragment machine/qemux86
build-config-setup enable-fragment machine/qemuarm

The enabled machine is still qemux86 despite the user thinking it might now be qemuarm.

I can understand why this happens but it is confusing for the user and there is no error code set for "fragment already enabled". Perhaps it should be moved to be last?

I think we may want some kind of option to remove all other machine/* options or allow the machine/ fragment to be changed.

Futher "proof"/debug output

$ bitbake-getvar MACHINE

NOTE: Starting bitbake server...
#
# $MACHINE [4 operations]
#   set /media/build/poky/build/conf/local.conf:38
#     [_defaultval] "qemux86-64"
#   set ast.py:367 [check_and_set_builtin_fragment]
#     "qemuarm"
#   set ast.py:367 [check_and_set_builtin_fragment]
#     "qemux86"
#   set /media/build/poky/meta/conf/documentation.conf:274
#     [doc] "Specifies the target device for which the image is built. You define MACHINE in the conf/local.conf file in the Build Directory."
# pre-expansion value:
#   "qemux86"
MACHINE="qemux86"


$ cat conf/auto.conf 

OE_FRAGMENTS += "core/yocto-autobuilder/autobuilder machine/qemuarm machine/qemux86"

$ bitbake-config-build enable-fragment machine/qemuarm

NOTE: Starting bitbake server...
Fragment machine/qemuarm already included in /media/build/poky/build/conf/auto.conf
richard@max:/media/build/poky/build$ bitbake-getvar MACHINE
NOTE: Starting bitbake server...
#
# $MACHINE [4 operations]
#   set /media/build/poky/build/conf/local.conf:38
#     [_defaultval] "qemux86-64"
#   set ast.py:367 [check_and_set_builtin_fragment]
#     "qemuarm"
#   set ast.py:367 [check_and_set_builtin_fragment]
#     "qemux86"
#   set /media/build/poky/meta/conf/documentation.conf:274
#     [doc] "Specifies the target device for which the image is built. You define MACHINE in the conf/local.conf file in the Build Directory."
# pre-expansion value:
#   "qemux86"
MACHINE="qemux86"
Comment 1 Alexander Kanavin 2025-10-02 16:24:49 UTC
Patch: https://lists.openembedded.org/g/openembedded-core/message/224372