lib/bb/parse/ast.py: treat internal fragment setting as default value
PATCH 1/1 lib/bb/parse/ast.py: treat internal fragment setting as default value
From: Chen Qi <[email protected]>
In this way, users can continue to override settings such as MACHINE via local.conf and env vars with plain '=' setting.
Fixes [YOCTO #16060]
--- lib/bb/parse/ast.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/parse/ast.py +1 -1
@@ -373,7 +373,7 @@ class AddFragmentsNode(AstNode): loginfo["detail"] = f"{value} ({self.fragments_variable} contains \"{fragment}\")" break # parsing=True since we want to emulate X=Y and allow X:override=Z to continue to exist - data.setVar(builtin_fragments[prefix], value, parsing=True, **loginfo) + data.setVarFlag(builtin_fragments[prefix], '_defaultval', value, parsing=True, **loginfo) return True return False
Signature · 1 line
2.34.1
Quoted 17 lines · Chen Qi via lists.openembedded.org
From: Chen Qi <[email protected]>
In this way, users can continue to override settings such as MACHINE via local.conf and env vars with plain '=' setting.
Fixes [YOCTO #16060]
Signed-off-by Chen Qi <[email protected]>---
lib/bb/parse/ast.py | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)lib/bb/parse/ast.py +0
-0@@ -373,7 +373,7 @@ class AddFragmentsNode(AstNode):
Quoted 8 lines
loginfo["detail"] = f"{value} ({self.fragments_variable} contains \"{fragment}\")" break
# parsing=True since we want to emulate X=Y and allow X:override=Z to continue to exist -data.setVar(builtin_fragments[prefix], value, parsing=True, **loginfo)
+data.setVarFlag(builtin_fragments[prefix], '_defaultval', value, parsing=True, **loginfo)return True
return False
This is a tough one. I've thought about the two sides to this and you can argue it both ways.
If we do this, we will get questions of "I set this fragment, why didn't it actually do that?".
I think if you specify a fragment and it should override the conf files...
Cheers,
Richard
Thank you for the explanation.
My major concern is about the behavioral change in a project setup by bitbake-setup.
When I was trying out bitbake-setup, the OE_FRAGMENTS are automatically generated in conf/toolcfg.conf. And I got an "empty" local.conf. So at that time, I felt it natural that user configuration (local.conf) should take priority over the automatically generated one (toolcfg.conf). The logic is like /etc and /usr in Linux systems.
It's a little counter-intuitive that local.conf does not override settings in toolcfg.conf. I mean, people have to edit toolcfg.conf to change MACHINE in a project setup by bitbake-setup. And they can't use "MACHINE=xxx bitbake <pkg>".
Regards,
Qi
-----Original Message-----
From: Richard Purdie <[email protected]>
Sent: Thursday, November 13, 2025 12:01 AM
To: Chen, Qi <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [bitbake-devel][PATCH] lib/bb/parse/ast.py: treat internal fragment setting as default value
Quoted 19 lines · Chen Qi via lists.openembedded.org
From: Chen Qi <[email protected]>
In this way, users can continue to override settings such as MACHINE via local.conf and env vars with plain '=' setting.
Fixes [YOCTO #16060]
Signed-off-by Chen Qi <[email protected]>---
lib/bb/parse/ast.py | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)lib/bb/parse/ast.py index renamed from lib/bb/parse/ast.py +0
-0
e6ff1ff76..f9d93aa0f100644lib/bb/parse/ast.py +0
-0@@ -373,7 +373,7 @@ class AddFragmentsNode(AstNode):loginfo["detail"] = f"{value} ({self.fragments_variable} contains \"{fragment}\")" break
Quoted 9 lines
# parsing=True since we want to emulate X=Y and allow X:override=Z to continue to exist
-data.setVar(builtin_fragments[prefix], value, parsing=True, **loginfo)
+data.setVarFlag(builtin_fragments[prefix], +'_defaultval', value, parsing=True, **loginfo)
return True
return False
This is a tough one. I've thought about the two sides to this and you can argue it both ways.
If we do this, we will get questions of "I set this fragment, why didn't it actually do that?".
I think if you specify a fragment and it should override the conf files...
Cheers,
Richard
For what it’s worth I agree with Chen. Priority order should be environment, local.conf and only then toolcfg.conf. Yes it will lead to confusion in legacy local.conf driven setups, but overriding machine on the command line is a common use case and it should work.
Alex
Quoted 76 lines · Qi
Thank you for the explanation.
My major concern is about the behavioral change in a project setup by bitbake-setup.
When I was trying out bitbake-setup, the
OE_FRAGMENTSare automatically generated inconf/toolcfg.conf. And I got an "empty" local.conf. So at that time, I felt it natural that user configuration (local.conf) should take priority over the automatically generated one (toolcfg.conf). The logic is like /etc and /usr in Linux systems.It's a little counter-intuitive that local.conf does not override settings in toolcfg.conf. I mean, people have to edit toolcfg.conf to change MACHINE in a project setup by bitbake-setup. And they can't use "MACHINE=xxx bitbake <pkg>".
Regards,
Qi-----Original Message-----
From: Richard Purdie <[email protected]>
Sent: Thursday, November 13, 2025 12:01 AM
To: Chen, Qi <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [bitbake-devel][PATCH]lib/bb/parse/ast.py: treat internal fragment setting as default valueQuoted 17 lines · Chen Qi via lists.openembedded.org
From: Chen Qi <[email protected]>
In this way, users can continue to override settings such as MACHINE via local.conf and env vars with plain '=' setting.
Fixes [YOCTO #16060]
Signed-off-by Chen Qi <[email protected]>--- lib/bb/parse/ast.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/bb/parse/ast.py index renamed from lib/bb/parse/ast.py +0
-0
e6ff1ff76..f9d93aa0f100644lib/bb/parse/ast.py class AddFragmentsNode(AstNode): · line 373
Quoted 1 line
lib/bb/parse/ast.py +0
-0@@ -373,7 +373,7 @@ class AddFragmentsNode(AstNode): loginfo["detail"] = f"{value}({self.fragments_variable} contains \"{fragment}\")"
Quoted 10 lines
lib/bb/parse/ast.py +0
-0break # parsing=True since we want to emulate X=Y and allowX:override=Z to continue to exist
- data.setVar(builtin_fragments[prefix], value,
parsing=True, **loginfo)
+ data.setVarFlag(builtin_fragments[prefix],
+'_defaultval', value, parsing=True, **loginfo)
return True
return FalseThis is a tough one. I've thought about the two sides to this and you can argue it both ways.
If we do this, we will get questions of "I set this fragment, why didn't it actually do that?".
I think if you specify a fragment and it should override the conf files...
Cheers,
Richard