Message ID | 20251010080619.2688482-1-yoann.congal@smile.fr |
---|---|
State | New |
Headers | show |
Series | [v2] ast: Warn on multiple builtin config fragments for the same variable | expand |
> Added warning looks like: > WARNING: Multiple builtin fragments are enabled for OE_FRAGMENTS via variable machine: machine/qemux86-64 machine/test machine/qemux86-64. This likely points to a mis-configuration in the metadata, as only one of them should be set. The build will use the last value. ... > + % ( > + self.fragments_variable, > + builtin_fragment_key, > + " ".join(builtin_fragments_list), You need to put these into correct order. Alex
Le ven. 10 oct. 2025 à 10:13, Alexander Kanavin <alex.kanavin@gmail.com> a écrit : > > Added warning looks like: > > WARNING: Multiple builtin fragments are enabled for OE_FRAGMENTS via > variable machine: machine/qemux86-64 machine/test machine/qemux86-64. This > likely points to a mis-configuration in the metadata, as only one of them > should be set. The build will use the last value. > > ... > > > + % ( > > + self.fragments_variable, > > + builtin_fragment_key, > > + " ".join(builtin_fragments_list), > > You need to put these into correct order. > d'oh! V3 sent : https://lists.openembedded.org/g/bitbake-devel/topic/patch_v3_ast_warn_on/115686012 > > Alex >
diff --git a/lib/bb/parse/ast.py b/lib/bb/parse/ast.py index cb06e8917..895c020ce 100644 --- a/lib/bb/parse/ast.py +++ b/lib/bb/parse/ast.py @@ -376,6 +376,27 @@ class AddFragmentsNode(AstNode): if not fragments: return + + # Check for multiple builtin fragments setting the same variable + for builtin_fragment_key in builtin_fragments.keys(): + builtin_fragments_list = list( + filter( + lambda f: f.startswith(builtin_fragment_key + "/"), + fragments.split(), + ) + ) + if len(builtin_fragments_list) > 1: + bb.warn( + ("Multiple builtin fragments are enabled for %s via variable %s: %s. " + "This likely points to a mis-configuration in the metadata, as only " + "one of them should be set. The build will use the last value.") + % ( + self.fragments_variable, + builtin_fragment_key, + " ".join(builtin_fragments_list), + ) + ) + for f in fragments.split(): if check_and_set_builtin_fragment(f, data, builtin_fragments): continue