diff options
| author | Alexander Kanavin <alex@linutronix.de> | 2025-11-04 11:08:01 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-11-04 13:16:04 +0000 |
| commit | 5d7abe740e26a34216236e0b00f6d2bc001e3156 (patch) | |
| tree | a48e9294d1acc3c5307f3acbda188cb32ca5ed7f /bitbake | |
| parent | 07c35eec54153f3aab0501aa880dfc8824ccb08b (diff) | |
| download | poky-5d7abe740e26a34216236e0b00f6d2bc001e3156.tar.gz | |
bitbake: bitbake-setup: rename 'build' -> 'setup'
After a terminology review by Antonin we brainstormed
something less confusing than 'build' and 'build directory'
for the place where bitbake-setup clones layers and
creates a *bitbake* build directory in. People are bound
to get these two confused and mix them up, and 'setup' is
much more distinct and aligns nicely with 'bitbake-setup'.
It's also not claimed by anything else in OE/Yocto.
So before:
top-dir -> build-dir (can be several) -> bitbake build dir, layer dir, config dir
Now:
top-dir -> setup-dir (can be several) -> bitbake build dir, layer dir, config dir
This also updates the respective command line options, I understand it's
a breaking change, but as before the tweaks are simple and we need to get the
terminology right for the users, and now is the time to do it.
(Bitbake rev: eeb81a35bf0304451f7612950d5156ea7ff18bad)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
| -rwxr-xr-x | bitbake/bin/bitbake-setup | 94 | ||||
| -rw-r--r-- | bitbake/lib/bb/tests/setup.py | 60 |
2 files changed, 77 insertions, 77 deletions
diff --git a/bitbake/bin/bitbake-setup b/bitbake/bin/bitbake-setup index a0426005ff..3cd67805fe 100755 --- a/bitbake/bin/bitbake-setup +++ b/bitbake/bin/bitbake-setup | |||
| @@ -114,7 +114,7 @@ def checkout_layers(layers, layerdir, d): | |||
| 114 | os.remove(symlink) | 114 | os.remove(symlink) |
| 115 | os.symlink(os.path.relpath(t,layerdir),symlink) | 115 | os.symlink(os.path.relpath(t,layerdir),symlink) |
| 116 | 116 | ||
| 117 | def setup_bitbake_build(bitbake_config, layerdir, builddir, thisdir): | 117 | def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir): |
| 118 | def _setup_build_conf(layers, build_conf_dir): | 118 | def _setup_build_conf(layers, build_conf_dir): |
| 119 | os.makedirs(build_conf_dir) | 119 | os.makedirs(build_conf_dir) |
| 120 | layers_s = [] | 120 | layers_s = [] |
| @@ -188,7 +188,7 @@ def setup_bitbake_build(bitbake_config, layerdir, builddir, thisdir): | |||
| 188 | f.write('\n') | 188 | f.write('\n') |
| 189 | f.write(content) | 189 | f.write(content) |
| 190 | 190 | ||
| 191 | bitbake_builddir = os.path.join(builddir, "build") | 191 | bitbake_builddir = os.path.join(setupdir, "build") |
| 192 | print("Setting up bitbake configuration in\n {}\n".format(bitbake_builddir)) | 192 | print("Setting up bitbake configuration in\n {}\n".format(bitbake_builddir)) |
| 193 | 193 | ||
| 194 | template = bitbake_config.get("oe-template") | 194 | template = bitbake_config.get("oe-template") |
| @@ -220,7 +220,7 @@ def setup_bitbake_build(bitbake_config, layerdir, builddir, thisdir): | |||
| 220 | _prepend_passthrough_to_init_build_env(bitbake_builddir) | 220 | _prepend_passthrough_to_init_build_env(bitbake_builddir) |
| 221 | 221 | ||
| 222 | siteconf_symlink = os.path.join(bitbake_confdir, "site.conf") | 222 | siteconf_symlink = os.path.join(bitbake_confdir, "site.conf") |
| 223 | siteconf = os.path.normpath(os.path.join(builddir, '..', "site.conf")) | 223 | siteconf = os.path.normpath(os.path.join(setupdir, '..', "site.conf")) |
| 224 | if os.path.lexists(siteconf_symlink): | 224 | if os.path.lexists(siteconf_symlink): |
| 225 | os.remove(symlink) | 225 | os.remove(symlink) |
| 226 | os.symlink(os.path.relpath(siteconf, bitbake_confdir) ,siteconf_symlink) | 226 | os.symlink(os.path.relpath(siteconf, bitbake_confdir) ,siteconf_symlink) |
| @@ -267,7 +267,7 @@ def get_registry_config(registry_path, id): | |||
| 267 | return os.path.join(root, f) | 267 | return os.path.join(root, f) |
| 268 | raise Exception("Unable to find {} in available configurations; use 'list' sub-command to see what is available".format(id)) | 268 | raise Exception("Unable to find {} in available configurations; use 'list' sub-command to see what is available".format(id)) |
| 269 | 269 | ||
| 270 | def update_build(config, confdir, builddir, layerdir, d): | 270 | def update_build(config, confdir, setupdir, layerdir, d): |
| 271 | layer_config = config["data"]["sources"] | 271 | layer_config = config["data"]["sources"] |
| 272 | layer_overrides = config["source-overrides"]["sources"] | 272 | layer_overrides = config["source-overrides"]["sources"] |
| 273 | for k,v in layer_overrides.items(): | 273 | for k,v in layer_overrides.items(): |
| @@ -276,7 +276,7 @@ def update_build(config, confdir, builddir, layerdir, d): | |||
| 276 | checkout_layers(layer_config, layerdir, d) | 276 | checkout_layers(layer_config, layerdir, d) |
| 277 | bitbake_config = config["bitbake-config"] | 277 | bitbake_config = config["bitbake-config"] |
| 278 | thisdir = os.path.dirname(config["path"]) if config["type"] == 'local' else None | 278 | thisdir = os.path.dirname(config["path"]) if config["type"] == 'local' else None |
| 279 | setup_bitbake_build(bitbake_config, layerdir, builddir, thisdir) | 279 | setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir) |
| 280 | 280 | ||
| 281 | def int_input(allowed_values): | 281 | def int_input(allowed_values): |
| 282 | n = None | 282 | n = None |
| @@ -441,22 +441,22 @@ def init_config(top_dir, settings, args, d): | |||
| 441 | upstream_config = obtain_config(top_dir, settings, args, source_overrides, d) | 441 | upstream_config = obtain_config(top_dir, settings, args, source_overrides, d) |
| 442 | print("\nRun 'bitbake-setup init --non-interactive {}' to select this configuration non-interactively.\n".format(" ".join(upstream_config['non-interactive-cmdline-options']))) | 442 | print("\nRun 'bitbake-setup init --non-interactive {}' to select this configuration non-interactively.\n".format(" ".join(upstream_config['non-interactive-cmdline-options']))) |
| 443 | 443 | ||
| 444 | builddir = os.path.join(os.path.abspath(top_dir), args.build_dir_name or "{}-{}".format(upstream_config['name']," ".join(upstream_config['non-interactive-cmdline-options'][1:]).replace(" ","-").replace("/","_"))) | 444 | setupdir = os.path.join(os.path.abspath(top_dir), args.setup_dir_name or "{}-{}".format(upstream_config['name']," ".join(upstream_config['non-interactive-cmdline-options'][1:]).replace(" ","-").replace("/","_"))) |
| 445 | if os.path.exists(os.path.join(builddir, "layers")): | 445 | if os.path.exists(os.path.join(setupdir, "layers")): |
| 446 | print(f"Build already initialized in:\n {builddir}\nUse 'bitbake-setup status' to check if it needs to be updated, or 'bitbake-setup update' to perform the update.\nIf you would like to start over and re-initialize a build in this directory, remove it, and run 'bitbake-setup init' again.") | 446 | print(f"Setup already initialized in:\n {setupdir}\nUse 'bitbake-setup status' to check if it needs to be updated, or 'bitbake-setup update' to perform the update.\nIf you would like to start over and re-initialize in this directory, remove it, and run 'bitbake-setup init' again.") |
| 447 | return | 447 | return |
| 448 | 448 | ||
| 449 | print("Initializing a build in\n {}".format(builddir)) | 449 | print("Initializing a setup directory in\n {}".format(setupdir)) |
| 450 | if not args.non_interactive: | 450 | if not args.non_interactive: |
| 451 | y_or_n = input('Continue? (y/N): ') | 451 | y_or_n = input('Continue? (y/N): ') |
| 452 | if y_or_n != 'y': | 452 | if y_or_n != 'y': |
| 453 | exit() | 453 | exit() |
| 454 | print() | 454 | print() |
| 455 | 455 | ||
| 456 | os.makedirs(builddir, exist_ok=True) | 456 | os.makedirs(setupdir, exist_ok=True) |
| 457 | 457 | ||
| 458 | confdir = os.path.join(builddir, "config") | 458 | confdir = os.path.join(setupdir, "config") |
| 459 | layerdir = os.path.join(builddir, "layers") | 459 | layerdir = os.path.join(setupdir, "layers") |
| 460 | 460 | ||
| 461 | os.makedirs(confdir) | 461 | os.makedirs(confdir) |
| 462 | os.makedirs(layerdir) | 462 | os.makedirs(layerdir) |
| @@ -471,7 +471,7 @@ def init_config(top_dir, settings, args, d): | |||
| 471 | 471 | ||
| 472 | write_config(upstream_config, confdir) | 472 | write_config(upstream_config, confdir) |
| 473 | commit_config(confdir) | 473 | commit_config(confdir) |
| 474 | update_build(upstream_config, confdir, builddir, layerdir, d) | 474 | update_build(upstream_config, confdir, setupdir, layerdir, d) |
| 475 | 475 | ||
| 476 | bb.event.remove("bb.build.TaskProgress", None) | 476 | bb.event.remove("bb.build.TaskProgress", None) |
| 477 | 477 | ||
| @@ -513,10 +513,10 @@ def are_layers_changed(layers, layerdir, d): | |||
| 513 | return changed | 513 | return changed |
| 514 | 514 | ||
| 515 | def build_status(top_dir, settings, args, d, update=False): | 515 | def build_status(top_dir, settings, args, d, update=False): |
| 516 | builddir = args.build_dir | 516 | setupdir = args.setup_dir |
| 517 | 517 | ||
| 518 | confdir = os.path.join(builddir, "config") | 518 | confdir = os.path.join(setupdir, "config") |
| 519 | layerdir = os.path.join(builddir, "layers") | 519 | layerdir = os.path.join(setupdir, "layers") |
| 520 | 520 | ||
| 521 | current_upstream_config = json.load(open(os.path.join(confdir, "config-upstream.json"))) | 521 | current_upstream_config = json.load(open(os.path.join(confdir, "config-upstream.json"))) |
| 522 | 522 | ||
| @@ -530,20 +530,20 @@ def build_status(top_dir, settings, args, d, update=False): | |||
| 530 | config_diff = bb.process.run('git -C {} diff'.format(confdir))[0] | 530 | config_diff = bb.process.run('git -C {} diff'.format(confdir))[0] |
| 531 | 531 | ||
| 532 | if config_diff: | 532 | if config_diff: |
| 533 | print('\nConfiguration in {} has changed:\n{}'.format(builddir, config_diff)) | 533 | print('\nConfiguration in {} has changed:\n{}'.format(setupdir, config_diff)) |
| 534 | if update: | 534 | if update: |
| 535 | commit_config(confdir) | 535 | commit_config(confdir) |
| 536 | update_build(new_upstream_config, confdir, builddir, layerdir, d) | 536 | update_build(new_upstream_config, confdir, setupdir, layerdir, d) |
| 537 | else: | 537 | else: |
| 538 | bb.process.run('git -C {} restore config-upstream.json'.format(confdir)) | 538 | bb.process.run('git -C {} restore config-upstream.json'.format(confdir)) |
| 539 | return | 539 | return |
| 540 | 540 | ||
| 541 | if are_layers_changed(current_upstream_config["data"]["sources"], layerdir, d): | 541 | if are_layers_changed(current_upstream_config["data"]["sources"], layerdir, d): |
| 542 | if update: | 542 | if update: |
| 543 | update_build(current_upstream_config, confdir, builddir, layerdir, d) | 543 | update_build(current_upstream_config, confdir, setupdir, layerdir, d) |
| 544 | return | 544 | return |
| 545 | 545 | ||
| 546 | print("\nConfiguration in {} has not changed.".format(builddir)) | 546 | print("\nConfiguration in {} has not changed.".format(setupdir)) |
| 547 | 547 | ||
| 548 | def build_update(top_dir, settings, args, d): | 548 | def build_update(top_dir, settings, args, d): |
| 549 | build_status(top_dir, settings, args, d, update=True) | 549 | build_status(top_dir, settings, args, d, update=True) |
| @@ -616,7 +616,7 @@ def list_configs(top_dir, settings, args, d): | |||
| 616 | print("Available configurations written into {}".format(args.write_json)) | 616 | print("Available configurations written into {}".format(args.write_json)) |
| 617 | 617 | ||
| 618 | def install_buildtools(top_dir, settings, args, d): | 618 | def install_buildtools(top_dir, settings, args, d): |
| 619 | buildtools_install_dir = os.path.join(args.build_dir, 'buildtools') | 619 | buildtools_install_dir = os.path.join(args.setup_dir, 'buildtools') |
| 620 | if os.path.exists(buildtools_install_dir): | 620 | if os.path.exists(buildtools_install_dir): |
| 621 | if not args.force: | 621 | if not args.force: |
| 622 | print("Buildtools are already installed in {}.".format(buildtools_install_dir)) | 622 | print("Buildtools are already installed in {}.".format(buildtools_install_dir)) |
| @@ -629,8 +629,8 @@ def install_buildtools(top_dir, settings, args, d): | |||
| 629 | return | 629 | return |
| 630 | shutil.rmtree(buildtools_install_dir) | 630 | shutil.rmtree(buildtools_install_dir) |
| 631 | 631 | ||
| 632 | install_buildtools = os.path.join(args.build_dir, 'layers/oe-scripts/install-buildtools') | 632 | install_buildtools = os.path.join(args.setup_dir, 'layers/oe-scripts/install-buildtools') |
| 633 | buildtools_download_dir = os.path.join(args.build_dir, 'buildtools-downloads/{}'.format(time.strftime("%Y%m%d%H%M%S"))) | 633 | buildtools_download_dir = os.path.join(args.setup_dir, 'buildtools-downloads/{}'.format(time.strftime("%Y%m%d%H%M%S"))) |
| 634 | print("Buildtools archive is downloaded into {} and its content installed into {}".format(buildtools_download_dir, buildtools_install_dir)) | 634 | print("Buildtools archive is downloaded into {} and its content installed into {}".format(buildtools_download_dir, buildtools_install_dir)) |
| 635 | subprocess.check_call("{} -d {} --downloads-directory {}".format(install_buildtools, buildtools_install_dir, buildtools_download_dir), shell=True) | 635 | subprocess.check_call("{} -d {} --downloads-directory {}".format(install_buildtools, buildtools_install_dir, buildtools_download_dir), shell=True) |
| 636 | 636 | ||
| @@ -696,24 +696,24 @@ def settings_func(top_dir, all_settings, args): | |||
| 696 | elif args.subcommand == 'set' or args.subcommand == 'unset': | 696 | elif args.subcommand == 'set' or args.subcommand == 'unset': |
| 697 | change_setting(top_dir, args) | 697 | change_setting(top_dir, args) |
| 698 | 698 | ||
| 699 | def get_build_dir_via_bbpath(): | 699 | def get_setup_dir_via_bbpath(): |
| 700 | bbpath = os.environ.get('BBPATH') | 700 | bbpath = os.environ.get('BBPATH') |
| 701 | if bbpath: | 701 | if bbpath: |
| 702 | bitbake_dir = os.path.normpath(bbpath.split(':')[0]) | 702 | bitbake_dir = os.path.normpath(bbpath.split(':')[0]) |
| 703 | if os.path.exists(os.path.join(bitbake_dir,'init-build-env')): | 703 | if os.path.exists(os.path.join(bitbake_dir,'init-build-env')): |
| 704 | build_dir = os.path.dirname(bitbake_dir) | 704 | setup_dir = os.path.dirname(bitbake_dir) |
| 705 | return build_dir | 705 | return setup_dir |
| 706 | return None | 706 | return None |
| 707 | 707 | ||
| 708 | def get_top_dir(args, settings): | 708 | def get_top_dir(args, settings): |
| 709 | build_dir_via_bbpath = get_build_dir_via_bbpath() | 709 | setup_dir_via_bbpath = get_setup_dir_via_bbpath() |
| 710 | if build_dir_via_bbpath: | 710 | if setup_dir_via_bbpath: |
| 711 | top_dir = os.path.dirname(build_dir_via_bbpath) | 711 | top_dir = os.path.dirname(setup_dir_via_bbpath) |
| 712 | if os.path.exists(default_settings_path(top_dir)): | 712 | if os.path.exists(default_settings_path(top_dir)): |
| 713 | return top_dir | 713 | return top_dir |
| 714 | 714 | ||
| 715 | if hasattr(args, 'build_dir'): | 715 | if hasattr(args, 'setup_dir'): |
| 716 | top_dir = os.path.dirname(os.path.normpath(args.build_dir)) | 716 | top_dir = os.path.dirname(os.path.normpath(args.setup_dir)) |
| 717 | return top_dir | 717 | return top_dir |
| 718 | 718 | ||
| 719 | top_dir_prefix = settings['default']['top-dir-prefix'] | 719 | top_dir_prefix = settings['default']['top-dir-prefix'] |
| @@ -734,12 +734,12 @@ def merge_settings(builtin_settings, global_settings, local_settings, cmdline_se | |||
| 734 | return all_settings | 734 | return all_settings |
| 735 | 735 | ||
| 736 | def main(): | 736 | def main(): |
| 737 | def add_build_dir_arg(parser): | 737 | def add_setup_dir_arg(parser): |
| 738 | build_dir = get_build_dir_via_bbpath() | 738 | setup_dir = get_setup_dir_via_bbpath() |
| 739 | if build_dir: | 739 | if setup_dir: |
| 740 | parser.add_argument('--build-dir', default=build_dir, help="Path to the build, default is %(default)s via BBPATH") | 740 | parser.add_argument('--setup-dir', default=setup_dir, help="Path to the setup, default is %(default)s via BBPATH") |
| 741 | else: | 741 | else: |
| 742 | parser.add_argument('--build-dir', required=True, help="Path to the build") | 742 | parser.add_argument('--setup-dir', required=True, help="Path to the setup") |
| 743 | 743 | ||
| 744 | parser = argparse.ArgumentParser( | 744 | parser = argparse.ArgumentParser( |
| 745 | description="BitBake setup utility. Run with 'init' argument to get started.", | 745 | description="BitBake setup utility. Run with 'init' argument to get started.", |
| @@ -761,24 +761,24 @@ def main(): | |||
| 761 | parser_list.add_argument('--write-json', action='store', help='Write available configurations into a json file so they can be programmatically processed.') | 761 | parser_list.add_argument('--write-json', action='store', help='Write available configurations into a json file so they can be programmatically processed.') |
| 762 | parser_list.set_defaults(func=list_configs) | 762 | parser_list.set_defaults(func=list_configs) |
| 763 | 763 | ||
| 764 | parser_init = subparsers.add_parser('init', help='Select a configuration and initialize a build from it') | 764 | parser_init = subparsers.add_parser('init', help='Select a configuration and initialize a setup from it') |
| 765 | parser_init.add_argument('config', nargs='*', help="path/URL/id to a configuration file (use 'list' command to get available ids), followed by configuration options. Bitbake-setup will ask to choose from available choices if command line doesn't completely specify them.") | 765 | parser_init.add_argument('config', nargs='*', help="path/URL/id to a configuration file (use 'list' command to get available ids), followed by configuration options. Bitbake-setup will ask to choose from available choices if command line doesn't completely specify them.") |
| 766 | 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.') | 766 | 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.') |
| 767 | parser_init.add_argument('--source-overrides', action='store', help='Override sources information (repositories/revisions) with values from a local json file.') | 767 | parser_init.add_argument('--source-overrides', action='store', help='Override sources information (repositories/revisions) with values from a local json file.') |
| 768 | parser_init.add_argument('--build-dir-name', action='store', help='A custom build directory name under the top directory.') | 768 | parser_init.add_argument('--setup-dir-name', action='store', help='A custom setup directory name under the top directory.') |
| 769 | 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.') | 769 | 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.') |
| 770 | parser_init.set_defaults(func=init_config) | 770 | parser_init.set_defaults(func=init_config) |
| 771 | 771 | ||
| 772 | parser_status = subparsers.add_parser('status', help='Check if the build needs to be synchronized with configuration') | 772 | parser_status = subparsers.add_parser('status', help='Check if the setup needs to be synchronized with configuration') |
| 773 | add_build_dir_arg(parser_status) | 773 | add_setup_dir_arg(parser_status) |
| 774 | parser_status.set_defaults(func=build_status) | 774 | parser_status.set_defaults(func=build_status) |
| 775 | 775 | ||
| 776 | parser_update = subparsers.add_parser('update', help='Update a build to be in sync with configuration') | 776 | parser_update = subparsers.add_parser('update', help='Update a setup to be in sync with configuration') |
| 777 | add_build_dir_arg(parser_update) | 777 | add_setup_dir_arg(parser_update) |
| 778 | parser_update.set_defaults(func=build_update) | 778 | parser_update.set_defaults(func=build_update) |
| 779 | 779 | ||
| 780 | parser_install_buildtools = subparsers.add_parser('install-buildtools', help='Install buildtools which can help fulfil missing or incorrect dependencies on the host machine') | 780 | parser_install_buildtools = subparsers.add_parser('install-buildtools', help='Install buildtools which can help fulfil missing or incorrect dependencies on the host machine') |
| 781 | add_build_dir_arg(parser_install_buildtools) | 781 | add_setup_dir_arg(parser_install_buildtools) |
| 782 | parser_install_buildtools.add_argument('--force', action='store_true', help='Force a reinstall of buildtools over the previous installation.') | 782 | parser_install_buildtools.add_argument('--force', action='store_true', help='Force a reinstall of buildtools over the previous installation.') |
| 783 | parser_install_buildtools.set_defaults(func=install_buildtools) | 783 | parser_install_buildtools.set_defaults(func=install_buildtools) |
| 784 | 784 | ||
| @@ -786,7 +786,7 @@ def main(): | |||
| 786 | 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") | 786 | 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") |
| 787 | 787 | ||
| 788 | parser_settings = subparsers.add_parser('settings', | 788 | parser_settings = subparsers.add_parser('settings', |
| 789 | 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)') | 789 | 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 configuration registry, downloads directory and other settings specific to a top directory)') |
| 790 | parser_settings.set_defaults(func=settings_func) | 790 | parser_settings.set_defaults(func=settings_func) |
| 791 | 791 | ||
| 792 | subparser_settings = parser_settings.add_subparsers(dest="subcommand", required=True, help="The action to perform on the settings file") | 792 | subparser_settings = parser_settings.add_subparsers(dest="subcommand", required=True, help="The action to perform on the settings file") |
| @@ -820,9 +820,9 @@ def main(): | |||
| 820 | level=logger.getEffectiveLevel()) | 820 | level=logger.getEffectiveLevel()) |
| 821 | 821 | ||
| 822 | if 'func' in args: | 822 | if 'func' in args: |
| 823 | if hasattr(args, 'build_dir'): | 823 | if hasattr(args, 'setup_dir'): |
| 824 | if not os.path.exists(os.path.join(args.build_dir,'build', 'init-build-env')): | 824 | if not os.path.exists(os.path.join(args.setup_dir,'build', 'init-build-env')): |
| 825 | print("Not a valid build directory: build/init-build-env does not exist in {}".format(args.build_dir)) | 825 | print("Not a valid setup directory: build/init-build-env does not exist in {}".format(args.setup_dir)) |
| 826 | return | 826 | return |
| 827 | 827 | ||
| 828 | if not hasattr(args, 'non_interactive'): | 828 | if not hasattr(args, 'non_interactive'): |
diff --git a/bitbake/lib/bb/tests/setup.py b/bitbake/lib/bb/tests/setup.py index e320cdf56f..a17b8ac46a 100644 --- a/bitbake/lib/bb/tests/setup.py +++ b/bitbake/lib/bb/tests/setup.py | |||
| @@ -109,19 +109,19 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) | |||
| 109 | "configurations": [ | 109 | "configurations": [ |
| 110 | { | 110 | { |
| 111 | "name": "gadget", | 111 | "name": "gadget", |
| 112 | "description": "Gadget build configuration", | 112 | "description": "Gadget configuration", |
| 113 | "oe-template": "test-configuration-gadget", | 113 | "oe-template": "test-configuration-gadget", |
| 114 | "oe-fragments": ["test-fragment-1"] | 114 | "oe-fragments": ["test-fragment-1"] |
| 115 | }, | 115 | }, |
| 116 | { | 116 | { |
| 117 | "name": "gizmo", | 117 | "name": "gizmo", |
| 118 | "description": "Gizmo build configuration", | 118 | "description": "Gizmo configuration", |
| 119 | "oe-template": "test-configuration-gizmo", | 119 | "oe-template": "test-configuration-gizmo", |
| 120 | "oe-fragments": ["test-fragment-2"] | 120 | "oe-fragments": ["test-fragment-2"] |
| 121 | }, | 121 | }, |
| 122 | { | 122 | { |
| 123 | "name": "gizmo-env-passthrough", | 123 | "name": "gizmo-env-passthrough", |
| 124 | "description": "Gizmo build configuration with environment-passthrough", | 124 | "description": "Gizmo configuration with environment-passthrough", |
| 125 | "bb-layers": ["layerC","layerD/meta-layer"], | 125 | "bb-layers": ["layerC","layerD/meta-layer"], |
| 126 | "oe-fragments": ["test-fragment-1"], | 126 | "oe-fragments": ["test-fragment-1"], |
| 127 | "bb-env-passthrough-additions": [ | 127 | "bb-env-passthrough-additions": [ |
| @@ -132,24 +132,24 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) | |||
| 132 | }, | 132 | }, |
| 133 | { | 133 | { |
| 134 | "name": "gizmo-no-fragment", | 134 | "name": "gizmo-no-fragment", |
| 135 | "description": "Gizmo no-fragment template-only build configuration", | 135 | "description": "Gizmo no-fragment template-only configuration", |
| 136 | "oe-template": "test-configuration-gizmo" | 136 | "oe-template": "test-configuration-gizmo" |
| 137 | }, | 137 | }, |
| 138 | { | 138 | { |
| 139 | "name": "gadget-notemplate", | 139 | "name": "gadget-notemplate", |
| 140 | "description": "Gadget notemplate build configuration", | 140 | "description": "Gadget notemplate configuration", |
| 141 | "bb-layers": ["layerA","layerB/meta-layer"], | 141 | "bb-layers": ["layerA","layerB/meta-layer"], |
| 142 | "oe-fragments": ["test-fragment-1"] | 142 | "oe-fragments": ["test-fragment-1"] |
| 143 | }, | 143 | }, |
| 144 | { | 144 | { |
| 145 | "name": "gizmo-notemplate", | 145 | "name": "gizmo-notemplate", |
| 146 | "description": "Gizmo notemplate build configuration", | 146 | "description": "Gizmo notemplate configuration", |
| 147 | "bb-layers": ["layerC","layerD/meta-layer"], | 147 | "bb-layers": ["layerC","layerD/meta-layer"], |
| 148 | "oe-fragments": ["test-fragment-2"] | 148 | "oe-fragments": ["test-fragment-2"] |
| 149 | }, | 149 | }, |
| 150 | { | 150 | { |
| 151 | "name": "gizmo-notemplate-with-thisdir", | 151 | "name": "gizmo-notemplate-with-thisdir", |
| 152 | "description": "Gizmo notemplate build configuration using THISDIR", | 152 | "description": "Gizmo notemplate configuration using THISDIR", |
| 153 | "bb-layers": ["layerC","layerD/meta-layer","{THISDIR}/layerE/meta-layer"], | 153 | "bb-layers": ["layerC","layerD/meta-layer","{THISDIR}/layerE/meta-layer"], |
| 154 | "oe-fragments": ["test-fragment-2"] | 154 | "oe-fragments": ["test-fragment-2"] |
| 155 | } | 155 | } |
| @@ -177,11 +177,11 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) | |||
| 177 | self.git('add {}'.format(name), cwd=self.testrepopath) | 177 | self.git('add {}'.format(name), cwd=self.testrepopath) |
| 178 | self.git('commit -m "Adding {}"'.format(name), cwd=self.testrepopath) | 178 | self.git('commit -m "Adding {}"'.format(name), cwd=self.testrepopath) |
| 179 | 179 | ||
| 180 | def check_builddir_files(self, buildpath, test_file_content, json_config): | 180 | def check_setupdir_files(self, setuppath, test_file_content, json_config): |
| 181 | with open(os.path.join(buildpath, 'layers', 'test-repo', 'test-file')) as f: | 181 | with open(os.path.join(setuppath, 'layers', 'test-repo', 'test-file')) as f: |
| 182 | self.assertEqual(f.read(), test_file_content) | 182 | self.assertEqual(f.read(), test_file_content) |
| 183 | bitbake_config = json_config["bitbake-config"] | 183 | bitbake_config = json_config["bitbake-config"] |
| 184 | bb_build_path = os.path.join(buildpath, 'build') | 184 | bb_build_path = os.path.join(setuppath, 'build') |
| 185 | bb_conf_path = os.path.join(bb_build_path, 'conf') | 185 | bb_conf_path = os.path.join(bb_build_path, 'conf') |
| 186 | self.assertTrue(os.path.exists(os.path.join(bb_build_path, 'init-build-env'))) | 186 | self.assertTrue(os.path.exists(os.path.join(bb_build_path, 'init-build-env'))) |
| 187 | 187 | ||
| @@ -203,7 +203,7 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) | |||
| 203 | ) | 203 | ) |
| 204 | self.assertIn(thisdir_layer, bblayers) | 204 | self.assertIn(thisdir_layer, bblayers) |
| 205 | else: | 205 | else: |
| 206 | self.assertIn(os.path.join(buildpath, "layers", l), bblayers) | 206 | self.assertIn(os.path.join(setuppath, "layers", l), bblayers) |
| 207 | 207 | ||
| 208 | if 'oe-fragment' in bitbake_config.keys(): | 208 | if 'oe-fragment' in bitbake_config.keys(): |
| 209 | for f in bitbake_config["oe-fragments"]: | 209 | for f in bitbake_config["oe-fragments"]: |
| @@ -295,20 +295,20 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) | |||
| 295 | for cf, v in test_configurations.items(): | 295 | for cf, v in test_configurations.items(): |
| 296 | for c in v['buildconfigs']: | 296 | for c in v['buildconfigs']: |
| 297 | out = self.runbbsetup("init --non-interactive {} {}".format(v['cmdline'], c)) | 297 | out = self.runbbsetup("init --non-interactive {} {}".format(v['cmdline'], c)) |
| 298 | buildpath = os.path.join(self.tempdir, 'bitbake-builds', '{}-{}'.format(cf, c)) | 298 | setuppath = os.path.join(self.tempdir, 'bitbake-builds', '{}-{}'.format(cf, c)) |
| 299 | with open(os.path.join(buildpath, 'config', "config-upstream.json")) as f: | 299 | with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f: |
| 300 | config_upstream = json.load(f) | 300 | config_upstream = json.load(f) |
| 301 | self.check_builddir_files(buildpath, test_file_content, config_upstream) | 301 | self.check_setupdir_files(setuppath, test_file_content, config_upstream) |
| 302 | os.environ['BBPATH'] = os.path.join(buildpath, 'build') | 302 | os.environ['BBPATH'] = os.path.join(setuppath, 'build') |
| 303 | out = self.runbbsetup("status") | 303 | out = self.runbbsetup("status") |
| 304 | self.assertIn("Configuration in {} has not changed".format(buildpath), out[0]) | 304 | self.assertIn("Configuration in {} has not changed".format(setuppath), out[0]) |
| 305 | out = self.runbbsetup("update") | 305 | out = self.runbbsetup("update") |
| 306 | self.assertIn("Configuration in {} has not changed".format(buildpath), out[0]) | 306 | self.assertIn("Configuration in {} has not changed".format(setuppath), out[0]) |
| 307 | 307 | ||
| 308 | # install buildtools | 308 | # install buildtools |
| 309 | out = self.runbbsetup("install-buildtools") | 309 | out = self.runbbsetup("install-buildtools") |
| 310 | self.assertIn("Buildtools installed into", out[0]) | 310 | self.assertIn("Buildtools installed into", out[0]) |
| 311 | self.assertTrue(os.path.exists(os.path.join(buildpath, 'buildtools'))) | 311 | self.assertTrue(os.path.exists(os.path.join(setuppath, 'buildtools'))) |
| 312 | 312 | ||
| 313 | # change a file in the test layer repo, make a new commit and | 313 | # change a file in the test layer repo, make a new commit and |
| 314 | # test that status/update correctly report the change and update the config | 314 | # test that status/update correctly report the change and update the config |
| @@ -319,17 +319,17 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) | |||
| 319 | 'gizmo-env-passthrough', | 319 | 'gizmo-env-passthrough', |
| 320 | 'gizmo-no-fragment', | 320 | 'gizmo-no-fragment', |
| 321 | 'gadget-notemplate', 'gizmo-notemplate'): | 321 | 'gadget-notemplate', 'gizmo-notemplate'): |
| 322 | buildpath = os.path.join(self.tempdir, 'bitbake-builds', 'test-config-1-{}'.format(c)) | 322 | setuppath = os.path.join(self.tempdir, 'bitbake-builds', 'test-config-1-{}'.format(c)) |
| 323 | os.environ['BBPATH'] = os.path.join(buildpath, 'build') | 323 | os.environ['BBPATH'] = os.path.join(setuppath, 'build') |
| 324 | out = self.runbbsetup("status") | 324 | out = self.runbbsetup("status") |
| 325 | self.assertIn("Layer repository file://{} checked out into {}/layers/test-repo updated revision master from".format(self.testrepopath, buildpath), out[0]) | 325 | self.assertIn("Layer repository file://{} checked out into {}/layers/test-repo updated revision master from".format(self.testrepopath, setuppath), out[0]) |
| 326 | out = self.runbbsetup("update") | 326 | out = self.runbbsetup("update") |
| 327 | if c in ('gadget', 'gizmo'): | 327 | if c in ('gadget', 'gizmo'): |
| 328 | self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(buildpath), out[0]) | 328 | self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(setuppath), out[0]) |
| 329 | self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0]) | 329 | self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0]) |
| 330 | with open(os.path.join(buildpath, 'config', "config-upstream.json")) as f: | 330 | with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f: |
| 331 | config_upstream = json.load(f) | 331 | config_upstream = json.load(f) |
| 332 | self.check_builddir_files(buildpath, test_file_content, config_upstream) | 332 | self.check_setupdir_files(setuppath, test_file_content, config_upstream) |
| 333 | 333 | ||
| 334 | # make a new branch in the test layer repo, change a file on that branch, | 334 | # make a new branch in the test layer repo, change a file on that branch, |
| 335 | # make a new commit, update the top level json config to refer to that branch, | 335 | # make a new commit, update the top level json config to refer to that branch, |
| @@ -344,15 +344,15 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"])) | |||
| 344 | 'gizmo-env-passthrough', | 344 | 'gizmo-env-passthrough', |
| 345 | 'gizmo-no-fragment', | 345 | 'gizmo-no-fragment', |
| 346 | 'gadget-notemplate', 'gizmo-notemplate'): | 346 | 'gadget-notemplate', 'gizmo-notemplate'): |
| 347 | buildpath = os.path.join(self.tempdir, 'bitbake-builds', 'test-config-1-{}'.format(c)) | 347 | setuppath = os.path.join(self.tempdir, 'bitbake-builds', 'test-config-1-{}'.format(c)) |
| 348 | os.environ['BBPATH'] = os.path.join(buildpath, 'build') | 348 | os.environ['BBPATH'] = os.path.join(setuppath, 'build') |
| 349 | out = self.runbbsetup("status") | 349 | out = self.runbbsetup("status") |
| 350 | self.assertIn("Configuration in {} has changed:".format(buildpath), out[0]) | 350 | self.assertIn("Configuration in {} has changed:".format(setuppath), out[0]) |
| 351 | self.assertIn('- "rev": "master"\n+ "rev": "another-branch"', out[0]) | 351 | self.assertIn('- "rev": "master"\n+ "rev": "another-branch"', out[0]) |
| 352 | out = self.runbbsetup("update") | 352 | out = self.runbbsetup("update") |
| 353 | if c in ('gadget', 'gizmo'): | 353 | if c in ('gadget', 'gizmo'): |
| 354 | self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(buildpath), out[0]) | 354 | self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(setuppath), out[0]) |
| 355 | self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0]) | 355 | self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0]) |
| 356 | with open(os.path.join(buildpath, 'config', "config-upstream.json")) as f: | 356 | with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f: |
| 357 | config_upstream = json.load(f) | 357 | config_upstream = json.load(f) |
| 358 | self.check_builddir_files(buildpath, test_file_content, config_upstream) | 358 | self.check_setupdir_files(setuppath, test_file_content, config_upstream) |
