diff options
| author | Yoann Congal <yoann.congal@smile.fr> | 2025-10-10 10:29:19 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-13 23:30:31 +0100 |
| commit | b203f9146e1c5ce38bdc55e93f769a14b8fce6ba (patch) | |
| tree | 5905073a5cc113f89086dd1a2116e8fe99044b79 /bitbake/lib | |
| parent | 34f0052af30d229429c6a886cbace726878ad072 (diff) | |
| download | poky-b203f9146e1c5ce38bdc55e93f769a14b8fce6ba.tar.gz | |
bitbake: ast: Warn on multiple builtin config fragments for the same variable
Having multiple builtin config fragments for the same variable
(eg OE_FRAGMENTS = "... machine/A ... machine/B") is not supported.
Warn the user to make them fix this but continue with the normal
variable evaluation : the last affectation "wins".
Added warning looks like:
WARNING: Multiple builtin fragments are enabled for machine via variable OE_FRAGMENTS: 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.
(Bitbake rev: 1c12aa23f6678dc289fc0e0d8b4dad311bd39c35)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
| -rw-r--r-- | bitbake/lib/bb/parse/ast.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index cb06e89179..cfead466e1 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py | |||
| @@ -376,6 +376,27 @@ class AddFragmentsNode(AstNode): | |||
| 376 | 376 | ||
| 377 | if not fragments: | 377 | if not fragments: |
| 378 | return | 378 | return |
| 379 | |||
| 380 | # Check for multiple builtin fragments setting the same variable | ||
| 381 | for builtin_fragment_key in builtin_fragments.keys(): | ||
| 382 | builtin_fragments_list = list( | ||
| 383 | filter( | ||
| 384 | lambda f: f.startswith(builtin_fragment_key + "/"), | ||
| 385 | fragments.split(), | ||
| 386 | ) | ||
| 387 | ) | ||
| 388 | if len(builtin_fragments_list) > 1: | ||
| 389 | bb.warn( | ||
| 390 | ("Multiple builtin fragments are enabled for %s via variable %s: %s. " | ||
| 391 | "This likely points to a mis-configuration in the metadata, as only " | ||
| 392 | "one of them should be set. The build will use the last value.") | ||
| 393 | % ( | ||
| 394 | builtin_fragment_key, | ||
| 395 | self.fragments_variable, | ||
| 396 | " ".join(builtin_fragments_list), | ||
| 397 | ) | ||
| 398 | ) | ||
| 399 | |||
| 379 | for f in fragments.split(): | 400 | for f in fragments.split(): |
| 380 | if check_and_set_builtin_fragment(f, data, builtin_fragments): | 401 | if check_and_set_builtin_fragment(f, data, builtin_fragments): |
| 381 | continue | 402 | continue |
