1
0
mirror of https://git.yoctoproject.org/poky synced 2026-07-27 19:37:10 +00:00

bitbake-config-build: add a plugin for config fragments

This allows fine-tuning local configurations with pre-frabricated
configuration snippets in a structured, controlled way. It's also
an important building block for bitbake-setup.

The tool requires that each fragment contains a one-line summary, and one or more
lines of description, as BB_CONF_FRAGMENT_SUMMARY style metadata.

There are three (and a half) operations (list/enable/disable/disable all), and here's the 'list' output:

alex@Zen2:/srv/storage/alex/yocto/build-64$ bitbake-config-build list-fragments
NOTE: Starting bitbake server...
Available fragments in selftest layer located in /srv/work/alex/poky/meta-selftest:

Enabled fragments:
selftest/test-fragment	This is a configuration fragment intended for testing in oe-selftest context

Unused fragments:
selftest/more-fragments-here/test-another-fragment	This is a second configuration fragment intended for testing in oe-selftest context

(From OE-Core rev: fdb611e13bd7aa00360d3a68e4818ef5f05c8944)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexander Kanavin
2024-12-11 14:46:30 +01:00
committed by Richard Purdie
parent aadff6930b
commit 22f046d67c
4 changed files with 196 additions and 0 deletions
+31
View File
@@ -240,3 +240,34 @@ class BitbakeLayers(OESelftestTestCase):
self.assertEqual(first_desc_2, '', "Describe not cleared: '{}'".format(first_desc_2))
self.assertEqual(second_rev_2, second_rev_1, "Revision should not be updated: '{}'".format(second_rev_2))
self.assertEqual(second_desc_2, second_desc_1, "Describe should not be updated: '{}'".format(second_desc_2))
class BitbakeConfigBuild(OESelftestTestCase):
def test_enable_disable_fragments(self):
self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_VARIABLE'), None)
self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_ANOTHER_VARIABLE'), None)
runCmd('bitbake-config-build enable-fragment selftest/test-fragment')
self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_VARIABLE'), 'somevalue')
self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_ANOTHER_VARIABLE'), None)
runCmd('bitbake-config-build enable-fragment selftest/more-fragments-here/test-another-fragment')
self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_VARIABLE'), 'somevalue')
self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_ANOTHER_VARIABLE'), 'someothervalue')
fragment_metadata_command = "bitbake-getvar -f {} --value {}"
result = runCmd(fragment_metadata_command.format("selftest/test-fragment", "BB_CONF_FRAGMENT_SUMMARY"))
self.assertIn("This is a configuration fragment intended for testing in oe-selftest context", result.output)
result = runCmd(fragment_metadata_command.format("selftest/test-fragment", "BB_CONF_FRAGMENT_DESCRIPTION"))
self.assertIn("It defines a variable that can be checked inside the test.", result.output)
result = runCmd(fragment_metadata_command.format("selftest/more-fragments-here/test-another-fragment", "BB_CONF_FRAGMENT_SUMMARY"))
self.assertIn("This is a second configuration fragment intended for testing in oe-selftest context", result.output)
result = runCmd(fragment_metadata_command.format("selftest/more-fragments-here/test-another-fragment", "BB_CONF_FRAGMENT_DESCRIPTION"))
self.assertIn("It defines another variable that can be checked inside the test.", result.output)
runCmd('bitbake-config-build disable-fragment selftest/test-fragment')
self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_VARIABLE'), None)
self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_ANOTHER_VARIABLE'), 'someothervalue')
runCmd('bitbake-config-build disable-fragment selftest/more-fragments-here/test-another-fragment')
self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_VARIABLE'), None)
self.assertEqual(get_bb_var('SELFTEST_FRAGMENT_ANOTHER_VARIABLE'), None)