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>
This commit is contained in:
Alexander Kanavin
2025-10-09 18:31:08 +02:00
committed by Richard Purdie
parent 401e7b6a10
commit cd4fe0aada
2 changed files with 71 additions and 107 deletions

View File

@@ -232,24 +232,29 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
self.runbbsetup("--help")
# set up global location for top-dir-prefix
out = self.runbbsetup("install-global-settings")
out = self.runbbsetup("settings --global default top-dir-prefix {}".format(self.tempdir))
settings_path = "{}/global-config".format(self.tempdir)
self.assertIn(settings_path, out[0])
out = self.runbbsetup("setting --global default top-dir-prefix {}".format(self.tempdir))
self.assertIn("Setting 'top-dir-prefix' in section 'default' is changed to", out[0])
self.assertIn("New settings written to".format(settings_path), out[0])
out = self.runbbsetup("setting --global default dl-dir {}".format(os.path.join(self.tempdir, 'downloads')))
out = self.runbbsetup("settings --global default dl-dir {}".format(os.path.join(self.tempdir, 'downloads')))
self.assertIn("Setting 'dl-dir' in section 'default' is changed to", out[0])
self.assertIn("New settings written to".format(settings_path), out[0])
# check that writing settings works and then adjust them to point to
# test registry repo
out = self.runbbsetup("setting default registry 'git://{};protocol=file;branch=master;rev=master'".format(self.registrypath))
out = self.runbbsetup("settings default registry 'git://{};protocol=file;branch=master;rev=master'".format(self.registrypath))
settings_path = "{}/bitbake-builds/settings.conf".format(self.tempdir)
self.assertIn(settings_path, out[0])
self.assertIn("Setting 'registry' in section 'default' is changed to", out[0])
self.assertIn("New settings written to".format(settings_path), out[0])
# check that listing settings works
out = self.runbbsetup("settings --list")
self.assertIn("default top-dir-prefix {}".format(self.tempdir), out[0])
self.assertIn("default dl-dir {}".format(os.path.join(self.tempdir, 'downloads')), out[0])
self.assertIn("default registry {}".format('git://{};protocol=file;branch=master;rev=master'.format(self.registrypath)), out[0])
# check that 'list' produces correct output with no configs, one config and two configs
out = self.runbbsetup("list")
self.assertNotIn("test-config-1", out[0])