From: Alexander Kanavin <alex.kanavin@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Alexander Kanavin <alex@linutronix.de>
Subject: [PATCH] lib/bbconfigbuild/configfragments: disable the previous builtin fragment when enabling a new one
Date: Thu, 2 Oct 2025 18:16:58 +0200 [thread overview]
Message-ID: <20251002161658.1356793-1-alex.kanavin@gmail.com> (raw)
From: Alexander Kanavin <alex@linutronix.de>
There was a flaw in the logic that allowed multiple builtin fragments with
the same prefix to be enabled at the same time. The correct behaviour
is that only one of them should be enabled, and when enabling it
all previously enabled fragments should be removed.
The issues that this caused are further explained in
https://bugzilla.yoctoproject.org/show_bug.cgi?id=15987
[YOCTO #15987]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
meta/lib/bbconfigbuild/configfragments.py | 7 ++++++-
meta/lib/oeqa/selftest/cases/bblayers.py | 15 +++++++++------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/meta/lib/bbconfigbuild/configfragments.py b/meta/lib/bbconfigbuild/configfragments.py
index fce3301bac9..34c6a3b4bcc 100644
--- a/meta/lib/bbconfigbuild/configfragments.py
+++ b/meta/lib/bbconfigbuild/configfragments.py
@@ -104,8 +104,11 @@ class ConfigFragmentsPlugin(LayerPlugin):
return True
return False
+ def fragment_prefix(self, fragmentname):
+ return fragmentname.split("/",1)[0]
+
def builtin_fragment_exists(self, fragmentname):
- fragment_prefix = fragmentname.split("/",1)[0]
+ fragment_prefix = self.fragment_prefix(fragmentname)
fragment_prefix_defs = set([f.split(':')[0] for f in self.tinfoil.config_data.getVar('OE_FRAGMENTS_BUILTIN').split()])
return fragment_prefix in fragment_prefix_defs
@@ -128,6 +131,8 @@ class ConfigFragmentsPlugin(LayerPlugin):
if f in enabled_fragments:
print("Fragment {} already included in {}".format(f, args.confpath))
else:
+ # first filter out all built-in fragments with the same prefix as the one that is being enabled
+ enabled_fragments = [fragment for fragment in enabled_fragments if not(self.builtin_fragment_exists(fragment) and self.fragment_prefix(fragment) == self.fragment_prefix(f))]
enabled_fragments.append(f)
return " ".join(enabled_fragments), None, 0, True
diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py
index d82c5aaf376..7eb176aa04b 100644
--- a/meta/lib/oeqa/selftest/cases/bblayers.py
+++ b/meta/lib/oeqa/selftest/cases/bblayers.py
@@ -281,11 +281,11 @@ class BitbakeConfigBuild(OESelftestTestCase):
2. Verify that SELFTEST_BUILTIN_FRAGMENT_VARIABLE is set after setting
the fragment.
3. Verify that SELFTEST_BUILTIN_FRAGMENT_VARIABLE is set after setting
- the fragment with another value that overrides the first one.
- 4. Verify that SELFTEST_BUILTIN_FRAGMENT_VARIABLE is set to the previous
- value after removing the second assignment (from step 3).
+ the fragment with another value that replaces the first one.
+ 4. Repeat steps 2 and 3 to verify that going back and forth between values
+ works.
5. Verify that SELFTEST_BUILTIN_FRAGMENT_VARIABLE is not set after
- removing the original assignment.
+ removing the final assignment.
"""
self.assertEqual(get_bb_var('SELFTEST_BUILTIN_FRAGMENT_VARIABLE'), None)
@@ -295,10 +295,13 @@ class BitbakeConfigBuild(OESelftestTestCase):
runCmd('bitbake-config-build enable-fragment selftest-fragment/someothervalue')
self.assertEqual(get_bb_var('SELFTEST_BUILTIN_FRAGMENT_VARIABLE'), 'someothervalue')
- runCmd('bitbake-config-build disable-fragment selftest-fragment/someothervalue')
+ runCmd('bitbake-config-build enable-fragment selftest-fragment/somevalue')
self.assertEqual(get_bb_var('SELFTEST_BUILTIN_FRAGMENT_VARIABLE'), 'somevalue')
- runCmd('bitbake-config-build disable-fragment selftest-fragment/somevalue')
+ runCmd('bitbake-config-build enable-fragment selftest-fragment/someothervalue')
+ self.assertEqual(get_bb_var('SELFTEST_BUILTIN_FRAGMENT_VARIABLE'), 'someothervalue')
+
+ runCmd('bitbake-config-build disable-fragment selftest-fragment/someothervalue')
self.assertEqual(get_bb_var('SELFTEST_BUILTIN_FRAGMENT_VARIABLE'), None)
def test_show_fragment(self):
--
2.39.5
next reply other threads:[~2025-10-02 16:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-02 16:16 Alexander Kanavin [this message]
2025-10-02 16:30 ` Patchtest results for [PATCH] lib/bbconfigbuild/configfragments: disable the previous builtin fragment when enabling a new one patchtest
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251002161658.1356793-1-alex.kanavin@gmail.com \
--to=alex.kanavin@gmail.com \
--cc=alex@linutronix.de \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox