diff options
| author | Alexander Kanavin <alex@linutronix.de> | 2025-09-29 14:56:16 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-04 15:16:03 +0100 |
| commit | e5b133f7291c511f711fe531380cd33d60754f11 (patch) | |
| tree | 291204f72d54c42c8339f9d0d57ac0ede447ec08 | |
| parent | d38ba1099184c7454b2d876575ab04787b371d86 (diff) | |
| download | poky-e5b133f7291c511f711fe531380cd33d60754f11.tar.gz | |
bitbake: bitbake-setup: improve robustness of loading/writing settings
Particularly:
- ensure global settings command line argument is always expanded to
full path
- ensure any errors that happen when loading settings are reported
at that point, otherwise we get an empty dictionary and cryptic
key errors later
(Bitbake rev: b3f3ea52e90fb2036074cc88fd00496eb995346d)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rwxr-xr-x | bitbake/bin/bitbake-setup | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bitbake/bin/bitbake-setup b/bitbake/bin/bitbake-setup index 8ceacada9a..1fbb65494b 100755 --- a/bitbake/bin/bitbake-setup +++ b/bitbake/bin/bitbake-setup | |||
| @@ -635,11 +635,11 @@ def load_settings(top_dir, non_interactive): | |||
| 635 | settings_path = default_settings_path(top_dir) | 635 | settings_path = default_settings_path(top_dir) |
| 636 | settings = configparser.ConfigParser() | 636 | settings = configparser.ConfigParser() |
| 637 | print('Loading settings from\n {}\n'.format(settings_path)) | 637 | print('Loading settings from\n {}\n'.format(settings_path)) |
| 638 | settings.read([settings_path]) | 638 | settings.read_file(open(settings_path)) |
| 639 | return settings | 639 | return settings |
| 640 | 640 | ||
| 641 | def global_settings_path(args): | 641 | def global_settings_path(args): |
| 642 | return args.global_settings if args.global_settings else os.path.join(os.path.expanduser('~'), '.config', 'bitbake-setup', 'config') | 642 | return os.path.abspath(args.global_settings) if args.global_settings else os.path.join(os.path.expanduser('~'), '.config', 'bitbake-setup', 'config') |
| 643 | 643 | ||
| 644 | def write_global_settings(settings_path, force_replace, non_interactive=True): | 644 | def write_global_settings(settings_path, force_replace, non_interactive=True): |
| 645 | if not os.path.exists(settings_path) or force_replace: | 645 | if not os.path.exists(settings_path) or force_replace: |
| @@ -673,7 +673,7 @@ def load_global_settings(settings_path, non_interactive): | |||
| 673 | 673 | ||
| 674 | settings = configparser.ConfigParser() | 674 | settings = configparser.ConfigParser() |
| 675 | print('Loading global settings from\n {}\n'.format(settings_path)) | 675 | print('Loading global settings from\n {}\n'.format(settings_path)) |
| 676 | settings.read([settings_path]) | 676 | settings.read_file(open(settings_path)) |
| 677 | return settings | 677 | return settings |
| 678 | 678 | ||
| 679 | def change_settings(top_dir, new_settings): | 679 | def change_settings(top_dir, new_settings): |
