summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorAlexander Kanavin <alex@linutronix.de>2025-10-09 18:31:08 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-10-14 11:24:57 +0100
commitcd4fe0aadac89190c793a764ee11c96ee5eb67df (patch)
tree86ad3f352d3a31748189cafe5a1b5116d03ea697 /bitbake/lib/bb
parent401e7b6a1062f687d1f3d68d81daca8c17615c8a (diff)
downloadpoky-cd4fe0aadac89190c793a764ee11c96ee5eb67df.tar.gz
bitbake: bitbake-setup: further rework the settings handling
After some further feedback, additional changes are made: 1. 'setting' command is renamed to 'settings' to better reflect that it is an interface to various ways of managing settings. 2. This command now has a -l/--list option to list all settings with their values (same as 'git config -l'). 3. A new level of settings (built-in defaults) is added, and used as a last resort after command line options, top dir settings file and global settings file. 4. This means bitbake-setup does not have to write and use a global settings file, and it no longer does so when initializing a build, avoiding default 'pollution' of ~/.config/bitbake-setup/ which can be problematic or unwelcome. A global settings file is still created if a setting is explicitly requested to be placed into it. 5. 'install-global-settins' is removed as the use case for it (tweak default settings before using them to initialize a build) can be achieved by setting the settings individually. 5. Similarly, a top dir settings file is no longer created by default and only appears if a setting needs to be written into it. 6. Default dl-dir is again created inside a top directory and not in ~/.cache/ to make default builds fully contained in the top directory (which was also asked about). (Bitbake rev: 664f8ec48d42d2ddc5f234c4f7d590fa597f489a) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/tests/setup.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/bitbake/lib/bb/tests/setup.py b/bitbake/lib/bb/tests/setup.py
index 22edda40e4..b238926b29 100644
--- a/bitbake/lib/bb/tests/setup.py
+++ b/bitbake/lib/bb/tests/setup.py
@@ -232,24 +232,29 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
232 self.runbbsetup("--help") 232 self.runbbsetup("--help")
233 233
234 # set up global location for top-dir-prefix 234 # set up global location for top-dir-prefix
235 out = self.runbbsetup("install-global-settings") 235 out = self.runbbsetup("settings --global default top-dir-prefix {}".format(self.tempdir))
236 settings_path = "{}/global-config".format(self.tempdir) 236 settings_path = "{}/global-config".format(self.tempdir)
237 self.assertIn(settings_path, out[0]) 237 self.assertIn(settings_path, out[0])
238 out = self.runbbsetup("setting --global default top-dir-prefix {}".format(self.tempdir))
239 self.assertIn("Setting 'top-dir-prefix' in section 'default' is changed to", out[0]) 238 self.assertIn("Setting 'top-dir-prefix' in section 'default' is changed to", out[0])
240 self.assertIn("New settings written to".format(settings_path), out[0]) 239 self.assertIn("New settings written to".format(settings_path), out[0])
241 out = self.runbbsetup("setting --global default dl-dir {}".format(os.path.join(self.tempdir, 'downloads'))) 240 out = self.runbbsetup("settings --global default dl-dir {}".format(os.path.join(self.tempdir, 'downloads')))
242 self.assertIn("Setting 'dl-dir' in section 'default' is changed to", out[0]) 241 self.assertIn("Setting 'dl-dir' in section 'default' is changed to", out[0])
243 self.assertIn("New settings written to".format(settings_path), out[0]) 242 self.assertIn("New settings written to".format(settings_path), out[0])
244 243
245 # check that writing settings works and then adjust them to point to 244 # check that writing settings works and then adjust them to point to
246 # test registry repo 245 # test registry repo
247 out = self.runbbsetup("setting default registry 'git://{};protocol=file;branch=master;rev=master'".format(self.registrypath)) 246 out = self.runbbsetup("settings default registry 'git://{};protocol=file;branch=master;rev=master'".format(self.registrypath))
248 settings_path = "{}/bitbake-builds/settings.conf".format(self.tempdir) 247 settings_path = "{}/bitbake-builds/settings.conf".format(self.tempdir)
249 self.assertIn(settings_path, out[0]) 248 self.assertIn(settings_path, out[0])
250 self.assertIn("Setting 'registry' in section 'default' is changed to", out[0]) 249 self.assertIn("Setting 'registry' in section 'default' is changed to", out[0])
251 self.assertIn("New settings written to".format(settings_path), out[0]) 250 self.assertIn("New settings written to".format(settings_path), out[0])
252 251
252 # check that listing settings works
253 out = self.runbbsetup("settings --list")
254 self.assertIn("default top-dir-prefix {}".format(self.tempdir), out[0])
255 self.assertIn("default dl-dir {}".format(os.path.join(self.tempdir, 'downloads')), out[0])
256 self.assertIn("default registry {}".format('git://{};protocol=file;branch=master;rev=master'.format(self.registrypath)), out[0])
257
253 # check that 'list' produces correct output with no configs, one config and two configs 258 # check that 'list' produces correct output with no configs, one config and two configs
254 out = self.runbbsetup("list") 259 out = self.runbbsetup("list")
255 self.assertNotIn("test-config-1", out[0]) 260 self.assertNotIn("test-config-1", out[0])