Bug 16060

Summary: Behavior change: projects setup with bitbake-setup no longer respects MACHINE=xxx env settings
Product: [Build System, Metadata & Runtime] BitBake Reporter: Chen Qi <Qi.Chen>
Component: bitbakeAssignee: Chen Qi <Qi.Chen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: alex.kanavin, ccasciato, poky.bs.watcher, poky.watcher, randy.macleod, richard.purdie
Version: unspecified   
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 Chen Qi 2025-11-12 05:48:24 UTC
Previously, I usually do 'MACHINE=xxx bitbake <pkg>' when doing build test for package upgrades.

Now with bitbake-setup, as the toolcfg.conf contains fragements such as:
OE_FRAGMENTS += "distro/poky machine/qemux86-64"
Using MACHINE=xxx in env does not work anymore.

What's worse, even if I put MACHINE = "qemuarm64" in local.conf, it still does take effect.

Should we change internal fragement settings to be like "?=" instead of "="?
Comment 1 Chen Qi 2025-11-12 06:21:58 UTC
I submitted a patch:
https://lists.openembedded.org/g/bitbake-devel/message/18343
Comment 2 Richard Purdie 2025-11-13 15:49:47 UTC
We think the best way to handle this is to error if a fragment is set and there is also a value for the variable already set (from the environment or the conf files). We could recommend the user unset the fragment with:

bitbake-config-build disable-fragment
Comment 4 Chen Qi 2025-11-14 09:50:02 UTC
@Alex & @Richard,

The above patch has two things that I don't feel good:
1) The env pass-through mechanism is used to avoid 'bitbake-config-build' error out.
2) The '??=' is OK, but '?=' still triggers an error.

If you have some suggestion, please let me know.