diff options
| author | Alexander Kanavin <alex@linutronix.de> | 2025-10-02 17:01:16 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-06 17:01:09 +0100 |
| commit | 4426d680bc826ddce491dfa045374cf435a96e5b (patch) | |
| tree | 035e7bc5fcea7e52bc7d21ffe7ee7473327caa60 | |
| parent | 430f652e1ce78d4bee55a9335e350cf31cc85a9a (diff) | |
| download | poky-4426d680bc826ddce491dfa045374cf435a96e5b.tar.gz | |
bitbake: bitbake-setup: add support for skipping a fragment selection
In autobuilder testing a use case arised where
- the available choices in configuration file for choosing a machine are incomplete
- putting every possible machine choice into that configuration is undesirable/not possible
- autobuilder code can write a machine selection into the bitbake config
after the fact.
So this --skip-selection option is intended for advanced users that know what they're doing
and is generally not recommended as it requires manually tweaking the bitbake config to
make it usable.
(Bitbake rev: fa81154cd8a204b394afa698daa0162e6337e7fa)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rwxr-xr-x | bitbake/bin/bitbake-setup | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bitbake/bin/bitbake-setup b/bitbake/bin/bitbake-setup index bb466d85b4..e7b955213e 100755 --- a/bitbake/bin/bitbake-setup +++ b/bitbake/bin/bitbake-setup | |||
| @@ -339,9 +339,12 @@ def choose_config(configs, non_interactive): | |||
| 339 | config_n = int_input([i[0] for i in config_list]) | 339 | config_n = int_input([i[0] for i in config_list]) |
| 340 | return config_list[config_n][1] | 340 | return config_list[config_n][1] |
| 341 | 341 | ||
| 342 | def choose_fragments(possibilities, parameters, non_interactive): | 342 | def choose_fragments(possibilities, parameters, non_interactive, skip_selection): |
| 343 | choices = {} | 343 | choices = {} |
| 344 | for k,v in possibilities.items(): | 344 | for k,v in possibilities.items(): |
| 345 | if skip_selection and k in skip_selection: | ||
| 346 | print("Skipping a selection of {}, as requested on command line. The resulting bitbake configuration may require further manual adjustments.".format(k)) | ||
| 347 | continue | ||
| 345 | choice = [o for o in v["options"] if o in parameters] | 348 | choice = [o for o in v["options"] if o in parameters] |
| 346 | if len(choice) > 1: | 349 | if len(choice) > 1: |
| 347 | raise Exception("Options specified on command line do not allow a single selection from possibilities {}, please remove one or more from {}".format(v["options"], parameters)) | 350 | raise Exception("Options specified on command line do not allow a single selection from possibilities {}, please remove one or more from {}".format(v["options"], parameters)) |
| @@ -395,9 +398,10 @@ def obtain_config(settings, args, source_overrides, d): | |||
| 395 | upstream_config = {'type':'registry','registry':settings["default"]["registry"],'name':config_id,'data':json.load(open(get_registry_config(registry_path,config_id)))} | 398 | upstream_config = {'type':'registry','registry':settings["default"]["registry"],'name':config_id,'data':json.load(open(get_registry_config(registry_path,config_id)))} |
| 396 | 399 | ||
| 397 | upstream_config['bitbake-config'] = choose_bitbake_config(upstream_config['data']['bitbake-setup']['configurations'], config_parameters, args.non_interactive) | 400 | upstream_config['bitbake-config'] = choose_bitbake_config(upstream_config['data']['bitbake-setup']['configurations'], config_parameters, args.non_interactive) |
| 398 | upstream_config['bitbake-config']['oe-fragment-choices'] = choose_fragments(upstream_config['bitbake-config'].get('oe-fragments-one-of',{}), config_parameters[1:], args.non_interactive) | 401 | upstream_config['bitbake-config']['oe-fragment-choices'] = choose_fragments(upstream_config['bitbake-config'].get('oe-fragments-one-of',{}), config_parameters[1:], args.non_interactive, args.skip_selection) |
| 399 | upstream_config['non-interactive-cmdline-options'] = [config_id, upstream_config['bitbake-config']['name']] + sorted(upstream_config['bitbake-config']['oe-fragment-choices'].values()) | 402 | upstream_config['non-interactive-cmdline-options'] = [config_id, upstream_config['bitbake-config']['name']] + sorted(upstream_config['bitbake-config']['oe-fragment-choices'].values()) |
| 400 | upstream_config['source-overrides'] = source_overrides | 403 | upstream_config['source-overrides'] = source_overrides |
| 404 | upstream_config['skip-selection'] = args.skip_selection | ||
| 401 | return upstream_config | 405 | return upstream_config |
| 402 | 406 | ||
| 403 | def init_config(settings, args, d): | 407 | def init_config(settings, args, d): |
| @@ -492,6 +496,7 @@ def build_status(settings, args, d, update=False): | |||
| 492 | 496 | ||
| 493 | args.config = current_upstream_config['non-interactive-cmdline-options'] | 497 | args.config = current_upstream_config['non-interactive-cmdline-options'] |
| 494 | args.non_interactive = True | 498 | args.non_interactive = True |
| 499 | args.skip_selection = current_upstream_config['skip-selection'] | ||
| 495 | source_overrides = current_upstream_config["source-overrides"] | 500 | source_overrides = current_upstream_config["source-overrides"] |
| 496 | new_upstream_config = obtain_config(settings, args, source_overrides, d) | 501 | new_upstream_config = obtain_config(settings, args, source_overrides, d) |
| 497 | 502 | ||
| @@ -778,6 +783,7 @@ def main(): | |||
| 778 | parser_init.add_argument('--non-interactive', action='store_true', help='Do not ask to interactively choose from available options; if bitbake-setup cannot make a decision it will stop with a failure.') | 783 | parser_init.add_argument('--non-interactive', action='store_true', help='Do not ask to interactively choose from available options; if bitbake-setup cannot make a decision it will stop with a failure.') |
| 779 | parser_init.add_argument('--source-overrides', action='store', help='Override sources information (repositories/revisions) with values from a local json file.') | 784 | parser_init.add_argument('--source-overrides', action='store', help='Override sources information (repositories/revisions) with values from a local json file.') |
| 780 | parser_init.add_argument('--build-dir-name', action='store', help='A custom build directory name under the top directory.') | 785 | parser_init.add_argument('--build-dir-name', action='store', help='A custom build directory name under the top directory.') |
| 786 | parser_init.add_argument('--skip-selection', action='append', help='Do not select and set an option/fragment from available choices; the resulting bitbake configuration may be incomplete.') | ||
| 781 | parser_init.set_defaults(func=init_config) | 787 | parser_init.set_defaults(func=init_config) |
| 782 | 788 | ||
| 783 | parser_status = subparsers.add_parser('status', help='Check if the build needs to be synchronized with configuration') | 789 | parser_status = subparsers.add_parser('status', help='Check if the build needs to be synchronized with configuration') |
