Message ID | 20251009223552.2648331-1-yoann.congal@smile.fr |
---|---|
State | New |
Headers | show |
Series | ast: Warn on multiple builtin config fragments for the same variable | expand |
On Fri, 10 Oct 2025 at 00:36, Yoann Congal via lists.openembedded.org <yoann.congal=smile.fr@lists.openembedded.org> wrote: > + if len(builtin_fragments_list) > 1: > + bb.warn( > + ("%s has multiple builtin fragments for %s: %s. " > + "This is not supported but build will continue using the last value.") I think the message should be: "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." Alex
Le ven. 10 oct. 2025 à 08:40, Alexander Kanavin <alex.kanavin@gmail.com> a écrit : > On Fri, 10 Oct 2025 at 00:36, Yoann Congal via lists.openembedded.org > <yoann.congal=smile.fr@lists.openembedded.org> wrote: > > + if len(builtin_fragments_list) > 1: > > + bb.warn( > > + ("%s has multiple builtin fragments for %s: %s. " > > + "This is not supported but build will continue > using the last value.") > > I think the message should be: > > "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." > v2 sent. Thanks! > Alex >
diff --git a/lib/bb/parse/ast.py b/lib/bb/parse/ast.py index cb06e8917..6262d9ca1 100644 --- a/lib/bb/parse/ast.py +++ b/lib/bb/parse/ast.py @@ -376,6 +376,26 @@ 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( + ("%s has multiple builtin fragments for %s: %s. " + "This is not supported but build will continue using 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