mirror of
https://git.yoctoproject.org/poky
synced 2026-09-12 15:49:36 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
897f3020da
commit
7320e59aec
@@ -232,25 +232,25 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
|
||||
self.runbbsetup("--help")
|
||||
|
||||
# set up global location for top-dir-prefix
|
||||
out = self.runbbsetup("settings --global default top-dir-prefix {}".format(self.tempdir))
|
||||
out = self.runbbsetup("settings set --global default top-dir-prefix {}".format(self.tempdir))
|
||||
settings_path = "{}/global-config".format(self.tempdir)
|
||||
self.assertIn(settings_path, out[0])
|
||||
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("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])
|
||||
self.assertIn("From section 'default' the setting 'top-dir-prefix' was changed to", out[0])
|
||||
self.assertIn("Settings written to".format(settings_path), out[0])
|
||||
out = self.runbbsetup("settings set --global default dl-dir {}".format(os.path.join(self.tempdir, 'downloads')))
|
||||
self.assertIn("From section 'default' the setting 'dl-dir' was changed to", out[0])
|
||||
self.assertIn("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("settings default registry 'git://{};protocol=file;branch=master;rev=master'".format(self.registrypath))
|
||||
out = self.runbbsetup("settings set 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])
|
||||
self.assertIn("From section 'default' the setting 'registry' was changed to", out[0])
|
||||
self.assertIn("Settings written to".format(settings_path), out[0])
|
||||
|
||||
# check that listing settings works
|
||||
out = self.runbbsetup("settings --list")
|
||||
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])
|
||||
|
||||
Reference in New Issue
Block a user