summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorJohannes Schneider <johannes.schneider@leica-geosystems.com>2025-10-12 19:47:27 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-10-14 11:24:57 +0100
commit7320e59aecbaac830d912dd4c0e68b5963c25db4 (patch)
tree3e9a591cb64398f3028f813e9d820bf71afaa593 /bitbake/lib
parent897f3020daa12ae9e70943c82f780515b1666e9b (diff)
downloadpoky-7320e59aecbaac830d912dd4c0e68b5963c25db4.tar.gz
bitbake: bitbake-setup: commandline: use subsubparser for settings {list,set,unset}
Previously the sub-command 'settings' would take any number of arguments and then silently do nothing if the number wasn't three. The help text was also not clear about this, marking the positionals separately as optional: usage: bitbake-setup settings [-h] [--global] [--unset UNSET UNSET] [-l] [section] [key] [value] The '--unset SECTION SETTING' also did not integrate too well, as it had its own positional arguments for section+setting. For a bit more consistency and a explorable help, a sub-subparser is added, that provides the commands: bitbake-setup settings list bitbake-setup settings set foo bar baz bitbake-setup settings unset foo bar with a '--global' that is added from a stand-alone parent parser, so that it shows up in all sub-command help texts. The new help text now reads: usage: bitbake-setup settings [-h] [--global] {list,set,unset} ... and the respective sub commands: usage: bitbake-setup settings list [-h] [--global] usage: bitbake-setup settings set [-h] [--global] <section> <setting> <value> usage: bitbake-setup settings unset [-h] [--global] <section> <setting> (Bitbake rev: 8b582ef8dd0cef0192d4c0104bcd9b5d642d132c) Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/tests/setup.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/bitbake/lib/bb/tests/setup.py b/bitbake/lib/bb/tests/setup.py
index b238926b29..e320cdf56f 100644
--- a/bitbake/lib/bb/tests/setup.py
+++ b/bitbake/lib/bb/tests/setup.py
@@ -232,25 +232,25 @@ 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("settings --global default top-dir-prefix {}".format(self.tempdir)) 235 out = self.runbbsetup("settings set --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 self.assertIn("Setting 'top-dir-prefix' in section 'default' is changed to", out[0]) 238 self.assertIn("From section 'default' the setting 'top-dir-prefix' was changed to", out[0])
239 self.assertIn("New settings written to".format(settings_path), out[0]) 239 self.assertIn("Settings written to".format(settings_path), out[0])
240 out = self.runbbsetup("settings --global default dl-dir {}".format(os.path.join(self.tempdir, 'downloads'))) 240 out = self.runbbsetup("settings set --global default dl-dir {}".format(os.path.join(self.tempdir, 'downloads')))
241 self.assertIn("Setting 'dl-dir' in section 'default' is changed to", out[0]) 241 self.assertIn("From section 'default' the setting 'dl-dir' was changed to", out[0])
242 self.assertIn("New settings written to".format(settings_path), out[0]) 242 self.assertIn("Settings written to".format(settings_path), out[0])
243 243
244 # 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
245 # test registry repo 245 # test registry repo
246 out = self.runbbsetup("settings default registry 'git://{};protocol=file;branch=master;rev=master'".format(self.registrypath)) 246 out = self.runbbsetup("settings set default registry 'git://{};protocol=file;branch=master;rev=master'".format(self.registrypath))
247 settings_path = "{}/bitbake-builds/settings.conf".format(self.tempdir) 247 settings_path = "{}/bitbake-builds/settings.conf".format(self.tempdir)
248 self.assertIn(settings_path, out[0]) 248 self.assertIn(settings_path, out[0])
249 self.assertIn("Setting 'registry' in section 'default' is changed to", out[0]) 249 self.assertIn("From section 'default' the setting 'registry' was changed to", out[0])
250 self.assertIn("New settings written to".format(settings_path), out[0]) 250 self.assertIn("Settings written to".format(settings_path), out[0])
251 251
252 # check that listing settings works 252 # check that listing settings works
253 out = self.runbbsetup("settings --list") 253 out = self.runbbsetup("settings list")
254 self.assertIn("default top-dir-prefix {}".format(self.tempdir), out[0]) 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]) 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]) 256 self.assertIn("default registry {}".format('git://{};protocol=file;branch=master;rev=master'.format(self.registrypath)), out[0])