diff mbox series

bitbake-setup: correctly define --global argument for settings management

Message ID 20251027141627.3724031-1-alex.kanavin@gmail.com
State New
Headers show
Series bitbake-setup: correctly define --global argument for settings management | expand

Commit Message

Alexander Kanavin Oct. 27, 2025, 2:16 p.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

--global was defined twice (for settings command as a whole, and specifically
for set/unset sub-commands), which caused 'settings --global set ...' to
be allowed, and at the same time not have any effect. 'settings set --global'
is the only valid form after this change.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bin/bitbake-setup | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Antonin Godard Oct. 27, 2025, 2:23 p.m. UTC | #1
On Mon Oct 27, 2025 at 3:16 PM CET, Alexander Kanavin via lists.openembedded.org wrote:
> From: Alexander Kanavin <alex@linutronix.de>
>
> --global was defined twice (for settings command as a whole, and specifically
> for set/unset sub-commands), which caused 'settings --global set ...' to
> be allowed, and at the same time not have any effect. 'settings set --global'
> is the only valid form after this change.
>
> Signed-off-by: Alexander Kanavin <alex@linutronix.de>
> ---
>  bin/bitbake-setup | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/bin/bitbake-setup b/bin/bitbake-setup
> index 38bb8099f..a0426005f 100755
> --- a/bin/bitbake-setup
> +++ b/bin/bitbake-setup
> @@ -785,7 +785,7 @@ def main():
>      parser_settings_arg_global = argparse.ArgumentParser(add_help=False)
>      parser_settings_arg_global.add_argument('--global', action='store_true', help="Modify the setting in a global settings file, rather than one specific to a top directory")
>  
> -    parser_settings = subparsers.add_parser('settings', parents=[parser_settings_arg_global],
> +    parser_settings = subparsers.add_parser('settings',
>                                              help='List current settings, or set or unset a setting in a settings file (e.g. the default prefix and name of the top directory, the location of build configuration registry, downloads directory and other settings specific to a top directory)')
>      parser_settings.set_defaults(func=settings_func)
>  

Thanks, this fixes the issue reported on IRC. I was able to set settings either
with `bitbake-setup settings set --global`, or `bitbake-setup settings set`, and
global and build-dir settings were modified respectively. E.g.:

$ cat /home/builder/.config/bitbake-setup/settings.conf /home/builder/yp2/bitbake-builds/settings.conf
[default]
top-dir-prefix = /home/builder/yp2

[default]
top-dir-name = builds

$ bitbake-setup settings list
Loading settings from
    /home/builder/.config/bitbake-setup/settings.conf

Loading settings from
    /home/builder/yp2/bitbake-builds/settings.conf

default top-dir-prefix /home/builder/yp2
default top-dir-name builds
default registry /bitbake/default-registry
default dl-dir /home/builder/yp2/bitbake-builds/.bitbake-setup-downloads

Tested-by: Antonin Godard <antonin.godard@bootlin.com>

Antonin
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 38bb8099f..a0426005f 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -785,7 +785,7 @@  def main():
     parser_settings_arg_global = argparse.ArgumentParser(add_help=False)
     parser_settings_arg_global.add_argument('--global', action='store_true', help="Modify the setting in a global settings file, rather than one specific to a top directory")
 
-    parser_settings = subparsers.add_parser('settings', parents=[parser_settings_arg_global],
+    parser_settings = subparsers.add_parser('settings',
                                             help='List current settings, or set or unset a setting in a settings file (e.g. the default prefix and name of the top directory, the location of build configuration registry, downloads directory and other settings specific to a top directory)')
     parser_settings.set_defaults(func=settings_func)