mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
07c35eec54
commit
5d7abe740e
@@ -114,7 +114,7 @@ def checkout_layers(layers, layerdir, d):
|
|||||||
os.remove(symlink)
|
os.remove(symlink)
|
||||||
os.symlink(os.path.relpath(t,layerdir),symlink)
|
os.symlink(os.path.relpath(t,layerdir),symlink)
|
||||||
|
|
||||||
def setup_bitbake_build(bitbake_config, layerdir, builddir, thisdir):
|
def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir):
|
||||||
def _setup_build_conf(layers, build_conf_dir):
|
def _setup_build_conf(layers, build_conf_dir):
|
||||||
os.makedirs(build_conf_dir)
|
os.makedirs(build_conf_dir)
|
||||||
layers_s = []
|
layers_s = []
|
||||||
@@ -188,7 +188,7 @@ def setup_bitbake_build(bitbake_config, layerdir, builddir, thisdir):
|
|||||||
f.write('\n')
|
f.write('\n')
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
|
||||||
bitbake_builddir = os.path.join(builddir, "build")
|
bitbake_builddir = os.path.join(setupdir, "build")
|
||||||
print("Setting up bitbake configuration in\n {}\n".format(bitbake_builddir))
|
print("Setting up bitbake configuration in\n {}\n".format(bitbake_builddir))
|
||||||
|
|
||||||
template = bitbake_config.get("oe-template")
|
template = bitbake_config.get("oe-template")
|
||||||
@@ -220,7 +220,7 @@ def setup_bitbake_build(bitbake_config, layerdir, builddir, thisdir):
|
|||||||
_prepend_passthrough_to_init_build_env(bitbake_builddir)
|
_prepend_passthrough_to_init_build_env(bitbake_builddir)
|
||||||
|
|
||||||
siteconf_symlink = os.path.join(bitbake_confdir, "site.conf")
|
siteconf_symlink = os.path.join(bitbake_confdir, "site.conf")
|
||||||
siteconf = os.path.normpath(os.path.join(builddir, '..', "site.conf"))
|
siteconf = os.path.normpath(os.path.join(setupdir, '..', "site.conf"))
|
||||||
if os.path.lexists(siteconf_symlink):
|
if os.path.lexists(siteconf_symlink):
|
||||||
os.remove(symlink)
|
os.remove(symlink)
|
||||||
os.symlink(os.path.relpath(siteconf, bitbake_confdir) ,siteconf_symlink)
|
os.symlink(os.path.relpath(siteconf, bitbake_confdir) ,siteconf_symlink)
|
||||||
@@ -267,7 +267,7 @@ def get_registry_config(registry_path, id):
|
|||||||
return os.path.join(root, f)
|
return os.path.join(root, f)
|
||||||
raise Exception("Unable to find {} in available configurations; use 'list' sub-command to see what is available".format(id))
|
raise Exception("Unable to find {} in available configurations; use 'list' sub-command to see what is available".format(id))
|
||||||
|
|
||||||
def update_build(config, confdir, builddir, layerdir, d):
|
def update_build(config, confdir, setupdir, layerdir, d):
|
||||||
layer_config = config["data"]["sources"]
|
layer_config = config["data"]["sources"]
|
||||||
layer_overrides = config["source-overrides"]["sources"]
|
layer_overrides = config["source-overrides"]["sources"]
|
||||||
for k,v in layer_overrides.items():
|
for k,v in layer_overrides.items():
|
||||||
@@ -276,7 +276,7 @@ def update_build(config, confdir, builddir, layerdir, d):
|
|||||||
checkout_layers(layer_config, layerdir, d)
|
checkout_layers(layer_config, layerdir, d)
|
||||||
bitbake_config = config["bitbake-config"]
|
bitbake_config = config["bitbake-config"]
|
||||||
thisdir = os.path.dirname(config["path"]) if config["type"] == 'local' else None
|
thisdir = os.path.dirname(config["path"]) if config["type"] == 'local' else None
|
||||||
setup_bitbake_build(bitbake_config, layerdir, builddir, thisdir)
|
setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir)
|
||||||
|
|
||||||
def int_input(allowed_values):
|
def int_input(allowed_values):
|
||||||
n = None
|
n = None
|
||||||
@@ -441,22 +441,22 @@ def init_config(top_dir, settings, args, d):
|
|||||||
upstream_config = obtain_config(top_dir, settings, args, source_overrides, d)
|
upstream_config = obtain_config(top_dir, settings, args, source_overrides, d)
|
||||||
print("\nRun 'bitbake-setup init --non-interactive {}' to select this configuration non-interactively.\n".format(" ".join(upstream_config['non-interactive-cmdline-options'])))
|
print("\nRun 'bitbake-setup init --non-interactive {}' to select this configuration non-interactively.\n".format(" ".join(upstream_config['non-interactive-cmdline-options'])))
|
||||||
|
|
||||||
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("/","_")))
|
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("/","_")))
|
||||||
if os.path.exists(os.path.join(builddir, "layers")):
|
if os.path.exists(os.path.join(setupdir, "layers")):
|
||||||
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.")
|
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.")
|
||||||
return
|
return
|
||||||
|
|
||||||
print("Initializing a build in\n {}".format(builddir))
|
print("Initializing a setup directory in\n {}".format(setupdir))
|
||||||
if not args.non_interactive:
|
if not args.non_interactive:
|
||||||
y_or_n = input('Continue? (y/N): ')
|
y_or_n = input('Continue? (y/N): ')
|
||||||
if y_or_n != 'y':
|
if y_or_n != 'y':
|
||||||
exit()
|
exit()
|
||||||
print()
|
print()
|
||||||
|
|
||||||
os.makedirs(builddir, exist_ok=True)
|
os.makedirs(setupdir, exist_ok=True)
|
||||||
|
|
||||||
confdir = os.path.join(builddir, "config")
|
confdir = os.path.join(setupdir, "config")
|
||||||
layerdir = os.path.join(builddir, "layers")
|
layerdir = os.path.join(setupdir, "layers")
|
||||||
|
|
||||||
os.makedirs(confdir)
|
os.makedirs(confdir)
|
||||||
os.makedirs(layerdir)
|
os.makedirs(layerdir)
|
||||||
@@ -471,7 +471,7 @@ def init_config(top_dir, settings, args, d):
|
|||||||
|
|
||||||
write_config(upstream_config, confdir)
|
write_config(upstream_config, confdir)
|
||||||
commit_config(confdir)
|
commit_config(confdir)
|
||||||
update_build(upstream_config, confdir, builddir, layerdir, d)
|
update_build(upstream_config, confdir, setupdir, layerdir, d)
|
||||||
|
|
||||||
bb.event.remove("bb.build.TaskProgress", None)
|
bb.event.remove("bb.build.TaskProgress", None)
|
||||||
|
|
||||||
@@ -513,10 +513,10 @@ def are_layers_changed(layers, layerdir, d):
|
|||||||
return changed
|
return changed
|
||||||
|
|
||||||
def build_status(top_dir, settings, args, d, update=False):
|
def build_status(top_dir, settings, args, d, update=False):
|
||||||
builddir = args.build_dir
|
setupdir = args.setup_dir
|
||||||
|
|
||||||
confdir = os.path.join(builddir, "config")
|
confdir = os.path.join(setupdir, "config")
|
||||||
layerdir = os.path.join(builddir, "layers")
|
layerdir = os.path.join(setupdir, "layers")
|
||||||
|
|
||||||
current_upstream_config = json.load(open(os.path.join(confdir, "config-upstream.json")))
|
current_upstream_config = json.load(open(os.path.join(confdir, "config-upstream.json")))
|
||||||
|
|
||||||
@@ -530,20 +530,20 @@ def build_status(top_dir, settings, args, d, update=False):
|
|||||||
config_diff = bb.process.run('git -C {} diff'.format(confdir))[0]
|
config_diff = bb.process.run('git -C {} diff'.format(confdir))[0]
|
||||||
|
|
||||||
if config_diff:
|
if config_diff:
|
||||||
print('\nConfiguration in {} has changed:\n{}'.format(builddir, config_diff))
|
print('\nConfiguration in {} has changed:\n{}'.format(setupdir, config_diff))
|
||||||
if update:
|
if update:
|
||||||
commit_config(confdir)
|
commit_config(confdir)
|
||||||
update_build(new_upstream_config, confdir, builddir, layerdir, d)
|
update_build(new_upstream_config, confdir, setupdir, layerdir, d)
|
||||||
else:
|
else:
|
||||||
bb.process.run('git -C {} restore config-upstream.json'.format(confdir))
|
bb.process.run('git -C {} restore config-upstream.json'.format(confdir))
|
||||||
return
|
return
|
||||||
|
|
||||||
if are_layers_changed(current_upstream_config["data"]["sources"], layerdir, d):
|
if are_layers_changed(current_upstream_config["data"]["sources"], layerdir, d):
|
||||||
if update:
|
if update:
|
||||||
update_build(current_upstream_config, confdir, builddir, layerdir, d)
|
update_build(current_upstream_config, confdir, setupdir, layerdir, d)
|
||||||
return
|
return
|
||||||
|
|
||||||
print("\nConfiguration in {} has not changed.".format(builddir))
|
print("\nConfiguration in {} has not changed.".format(setupdir))
|
||||||
|
|
||||||
def build_update(top_dir, settings, args, d):
|
def build_update(top_dir, settings, args, d):
|
||||||
build_status(top_dir, settings, args, d, update=True)
|
build_status(top_dir, settings, args, d, update=True)
|
||||||
@@ -616,7 +616,7 @@ def list_configs(top_dir, settings, args, d):
|
|||||||
print("Available configurations written into {}".format(args.write_json))
|
print("Available configurations written into {}".format(args.write_json))
|
||||||
|
|
||||||
def install_buildtools(top_dir, settings, args, d):
|
def install_buildtools(top_dir, settings, args, d):
|
||||||
buildtools_install_dir = os.path.join(args.build_dir, 'buildtools')
|
buildtools_install_dir = os.path.join(args.setup_dir, 'buildtools')
|
||||||
if os.path.exists(buildtools_install_dir):
|
if os.path.exists(buildtools_install_dir):
|
||||||
if not args.force:
|
if not args.force:
|
||||||
print("Buildtools are already installed in {}.".format(buildtools_install_dir))
|
print("Buildtools are already installed in {}.".format(buildtools_install_dir))
|
||||||
@@ -629,8 +629,8 @@ def install_buildtools(top_dir, settings, args, d):
|
|||||||
return
|
return
|
||||||
shutil.rmtree(buildtools_install_dir)
|
shutil.rmtree(buildtools_install_dir)
|
||||||
|
|
||||||
install_buildtools = os.path.join(args.build_dir, 'layers/oe-scripts/install-buildtools')
|
install_buildtools = os.path.join(args.setup_dir, 'layers/oe-scripts/install-buildtools')
|
||||||
buildtools_download_dir = os.path.join(args.build_dir, 'buildtools-downloads/{}'.format(time.strftime("%Y%m%d%H%M%S")))
|
buildtools_download_dir = os.path.join(args.setup_dir, 'buildtools-downloads/{}'.format(time.strftime("%Y%m%d%H%M%S")))
|
||||||
print("Buildtools archive is downloaded into {} and its content installed into {}".format(buildtools_download_dir, buildtools_install_dir))
|
print("Buildtools archive is downloaded into {} and its content installed into {}".format(buildtools_download_dir, buildtools_install_dir))
|
||||||
subprocess.check_call("{} -d {} --downloads-directory {}".format(install_buildtools, buildtools_install_dir, buildtools_download_dir), shell=True)
|
subprocess.check_call("{} -d {} --downloads-directory {}".format(install_buildtools, buildtools_install_dir, buildtools_download_dir), shell=True)
|
||||||
|
|
||||||
@@ -696,24 +696,24 @@ def settings_func(top_dir, all_settings, args):
|
|||||||
elif args.subcommand == 'set' or args.subcommand == 'unset':
|
elif args.subcommand == 'set' or args.subcommand == 'unset':
|
||||||
change_setting(top_dir, args)
|
change_setting(top_dir, args)
|
||||||
|
|
||||||
def get_build_dir_via_bbpath():
|
def get_setup_dir_via_bbpath():
|
||||||
bbpath = os.environ.get('BBPATH')
|
bbpath = os.environ.get('BBPATH')
|
||||||
if bbpath:
|
if bbpath:
|
||||||
bitbake_dir = os.path.normpath(bbpath.split(':')[0])
|
bitbake_dir = os.path.normpath(bbpath.split(':')[0])
|
||||||
if os.path.exists(os.path.join(bitbake_dir,'init-build-env')):
|
if os.path.exists(os.path.join(bitbake_dir,'init-build-env')):
|
||||||
build_dir = os.path.dirname(bitbake_dir)
|
setup_dir = os.path.dirname(bitbake_dir)
|
||||||
return build_dir
|
return setup_dir
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_top_dir(args, settings):
|
def get_top_dir(args, settings):
|
||||||
build_dir_via_bbpath = get_build_dir_via_bbpath()
|
setup_dir_via_bbpath = get_setup_dir_via_bbpath()
|
||||||
if build_dir_via_bbpath:
|
if setup_dir_via_bbpath:
|
||||||
top_dir = os.path.dirname(build_dir_via_bbpath)
|
top_dir = os.path.dirname(setup_dir_via_bbpath)
|
||||||
if os.path.exists(default_settings_path(top_dir)):
|
if os.path.exists(default_settings_path(top_dir)):
|
||||||
return top_dir
|
return top_dir
|
||||||
|
|
||||||
if hasattr(args, 'build_dir'):
|
if hasattr(args, 'setup_dir'):
|
||||||
top_dir = os.path.dirname(os.path.normpath(args.build_dir))
|
top_dir = os.path.dirname(os.path.normpath(args.setup_dir))
|
||||||
return top_dir
|
return top_dir
|
||||||
|
|
||||||
top_dir_prefix = settings['default']['top-dir-prefix']
|
top_dir_prefix = settings['default']['top-dir-prefix']
|
||||||
@@ -734,12 +734,12 @@ def merge_settings(builtin_settings, global_settings, local_settings, cmdline_se
|
|||||||
return all_settings
|
return all_settings
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
def add_build_dir_arg(parser):
|
def add_setup_dir_arg(parser):
|
||||||
build_dir = get_build_dir_via_bbpath()
|
setup_dir = get_setup_dir_via_bbpath()
|
||||||
if build_dir:
|
if setup_dir:
|
||||||
parser.add_argument('--build-dir', default=build_dir, help="Path to the build, default is %(default)s via BBPATH")
|
parser.add_argument('--setup-dir', default=setup_dir, help="Path to the setup, default is %(default)s via BBPATH")
|
||||||
else:
|
else:
|
||||||
parser.add_argument('--build-dir', required=True, help="Path to the build")
|
parser.add_argument('--setup-dir', required=True, help="Path to the setup")
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="BitBake setup utility. Run with 'init' argument to get started.",
|
description="BitBake setup utility. Run with 'init' argument to get started.",
|
||||||
@@ -761,24 +761,24 @@ def main():
|
|||||||
parser_list.add_argument('--write-json', action='store', help='Write available configurations into a json file so they can be programmatically processed.')
|
parser_list.add_argument('--write-json', action='store', help='Write available configurations into a json file so they can be programmatically processed.')
|
||||||
parser_list.set_defaults(func=list_configs)
|
parser_list.set_defaults(func=list_configs)
|
||||||
|
|
||||||
parser_init = subparsers.add_parser('init', help='Select a configuration and initialize a build from it')
|
parser_init = subparsers.add_parser('init', help='Select a configuration and initialize a setup from it')
|
||||||
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.")
|
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.")
|
||||||
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.')
|
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.')
|
||||||
parser_init.add_argument('--source-overrides', action='store', help='Override sources information (repositories/revisions) with values from a local json file.')
|
parser_init.add_argument('--source-overrides', action='store', help='Override sources information (repositories/revisions) with values from a local json file.')
|
||||||
parser_init.add_argument('--build-dir-name', action='store', help='A custom build directory name under the top directory.')
|
parser_init.add_argument('--setup-dir-name', action='store', help='A custom setup directory name under the top directory.')
|
||||||
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.')
|
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.')
|
||||||
parser_init.set_defaults(func=init_config)
|
parser_init.set_defaults(func=init_config)
|
||||||
|
|
||||||
parser_status = subparsers.add_parser('status', help='Check if the build needs to be synchronized with configuration')
|
parser_status = subparsers.add_parser('status', help='Check if the setup needs to be synchronized with configuration')
|
||||||
add_build_dir_arg(parser_status)
|
add_setup_dir_arg(parser_status)
|
||||||
parser_status.set_defaults(func=build_status)
|
parser_status.set_defaults(func=build_status)
|
||||||
|
|
||||||
parser_update = subparsers.add_parser('update', help='Update a build to be in sync with configuration')
|
parser_update = subparsers.add_parser('update', help='Update a setup to be in sync with configuration')
|
||||||
add_build_dir_arg(parser_update)
|
add_setup_dir_arg(parser_update)
|
||||||
parser_update.set_defaults(func=build_update)
|
parser_update.set_defaults(func=build_update)
|
||||||
|
|
||||||
parser_install_buildtools = subparsers.add_parser('install-buildtools', help='Install buildtools which can help fulfil missing or incorrect dependencies on the host machine')
|
parser_install_buildtools = subparsers.add_parser('install-buildtools', help='Install buildtools which can help fulfil missing or incorrect dependencies on the host machine')
|
||||||
add_build_dir_arg(parser_install_buildtools)
|
add_setup_dir_arg(parser_install_buildtools)
|
||||||
parser_install_buildtools.add_argument('--force', action='store_true', help='Force a reinstall of buildtools over the previous installation.')
|
parser_install_buildtools.add_argument('--force', action='store_true', help='Force a reinstall of buildtools over the previous installation.')
|
||||||
parser_install_buildtools.set_defaults(func=install_buildtools)
|
parser_install_buildtools.set_defaults(func=install_buildtools)
|
||||||
|
|
||||||
@@ -786,7 +786,7 @@ def main():
|
|||||||
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_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',
|
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)')
|
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)')
|
||||||
parser_settings.set_defaults(func=settings_func)
|
parser_settings.set_defaults(func=settings_func)
|
||||||
|
|
||||||
subparser_settings = parser_settings.add_subparsers(dest="subcommand", required=True, help="The action to perform on the settings file")
|
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():
|
|||||||
level=logger.getEffectiveLevel())
|
level=logger.getEffectiveLevel())
|
||||||
|
|
||||||
if 'func' in args:
|
if 'func' in args:
|
||||||
if hasattr(args, 'build_dir'):
|
if hasattr(args, 'setup_dir'):
|
||||||
if not os.path.exists(os.path.join(args.build_dir,'build', 'init-build-env')):
|
if not os.path.exists(os.path.join(args.setup_dir,'build', 'init-build-env')):
|
||||||
print("Not a valid build directory: build/init-build-env does not exist in {}".format(args.build_dir))
|
print("Not a valid setup directory: build/init-build-env does not exist in {}".format(args.setup_dir))
|
||||||
return
|
return
|
||||||
|
|
||||||
if not hasattr(args, 'non_interactive'):
|
if not hasattr(args, 'non_interactive'):
|
||||||
|
|||||||
@@ -109,19 +109,19 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
|
|||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "gadget",
|
"name": "gadget",
|
||||||
"description": "Gadget build configuration",
|
"description": "Gadget configuration",
|
||||||
"oe-template": "test-configuration-gadget",
|
"oe-template": "test-configuration-gadget",
|
||||||
"oe-fragments": ["test-fragment-1"]
|
"oe-fragments": ["test-fragment-1"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gizmo",
|
"name": "gizmo",
|
||||||
"description": "Gizmo build configuration",
|
"description": "Gizmo configuration",
|
||||||
"oe-template": "test-configuration-gizmo",
|
"oe-template": "test-configuration-gizmo",
|
||||||
"oe-fragments": ["test-fragment-2"]
|
"oe-fragments": ["test-fragment-2"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gizmo-env-passthrough",
|
"name": "gizmo-env-passthrough",
|
||||||
"description": "Gizmo build configuration with environment-passthrough",
|
"description": "Gizmo configuration with environment-passthrough",
|
||||||
"bb-layers": ["layerC","layerD/meta-layer"],
|
"bb-layers": ["layerC","layerD/meta-layer"],
|
||||||
"oe-fragments": ["test-fragment-1"],
|
"oe-fragments": ["test-fragment-1"],
|
||||||
"bb-env-passthrough-additions": [
|
"bb-env-passthrough-additions": [
|
||||||
@@ -132,24 +132,24 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gizmo-no-fragment",
|
"name": "gizmo-no-fragment",
|
||||||
"description": "Gizmo no-fragment template-only build configuration",
|
"description": "Gizmo no-fragment template-only configuration",
|
||||||
"oe-template": "test-configuration-gizmo"
|
"oe-template": "test-configuration-gizmo"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gadget-notemplate",
|
"name": "gadget-notemplate",
|
||||||
"description": "Gadget notemplate build configuration",
|
"description": "Gadget notemplate configuration",
|
||||||
"bb-layers": ["layerA","layerB/meta-layer"],
|
"bb-layers": ["layerA","layerB/meta-layer"],
|
||||||
"oe-fragments": ["test-fragment-1"]
|
"oe-fragments": ["test-fragment-1"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gizmo-notemplate",
|
"name": "gizmo-notemplate",
|
||||||
"description": "Gizmo notemplate build configuration",
|
"description": "Gizmo notemplate configuration",
|
||||||
"bb-layers": ["layerC","layerD/meta-layer"],
|
"bb-layers": ["layerC","layerD/meta-layer"],
|
||||||
"oe-fragments": ["test-fragment-2"]
|
"oe-fragments": ["test-fragment-2"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gizmo-notemplate-with-thisdir",
|
"name": "gizmo-notemplate-with-thisdir",
|
||||||
"description": "Gizmo notemplate build configuration using THISDIR",
|
"description": "Gizmo notemplate configuration using THISDIR",
|
||||||
"bb-layers": ["layerC","layerD/meta-layer","{THISDIR}/layerE/meta-layer"],
|
"bb-layers": ["layerC","layerD/meta-layer","{THISDIR}/layerE/meta-layer"],
|
||||||
"oe-fragments": ["test-fragment-2"]
|
"oe-fragments": ["test-fragment-2"]
|
||||||
}
|
}
|
||||||
@@ -177,11 +177,11 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
|
|||||||
self.git('add {}'.format(name), cwd=self.testrepopath)
|
self.git('add {}'.format(name), cwd=self.testrepopath)
|
||||||
self.git('commit -m "Adding {}"'.format(name), cwd=self.testrepopath)
|
self.git('commit -m "Adding {}"'.format(name), cwd=self.testrepopath)
|
||||||
|
|
||||||
def check_builddir_files(self, buildpath, test_file_content, json_config):
|
def check_setupdir_files(self, setuppath, test_file_content, json_config):
|
||||||
with open(os.path.join(buildpath, 'layers', 'test-repo', 'test-file')) as f:
|
with open(os.path.join(setuppath, 'layers', 'test-repo', 'test-file')) as f:
|
||||||
self.assertEqual(f.read(), test_file_content)
|
self.assertEqual(f.read(), test_file_content)
|
||||||
bitbake_config = json_config["bitbake-config"]
|
bitbake_config = json_config["bitbake-config"]
|
||||||
bb_build_path = os.path.join(buildpath, 'build')
|
bb_build_path = os.path.join(setuppath, 'build')
|
||||||
bb_conf_path = os.path.join(bb_build_path, 'conf')
|
bb_conf_path = os.path.join(bb_build_path, 'conf')
|
||||||
self.assertTrue(os.path.exists(os.path.join(bb_build_path, 'init-build-env')))
|
self.assertTrue(os.path.exists(os.path.join(bb_build_path, 'init-build-env')))
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
|
|||||||
)
|
)
|
||||||
self.assertIn(thisdir_layer, bblayers)
|
self.assertIn(thisdir_layer, bblayers)
|
||||||
else:
|
else:
|
||||||
self.assertIn(os.path.join(buildpath, "layers", l), bblayers)
|
self.assertIn(os.path.join(setuppath, "layers", l), bblayers)
|
||||||
|
|
||||||
if 'oe-fragment' in bitbake_config.keys():
|
if 'oe-fragment' in bitbake_config.keys():
|
||||||
for f in bitbake_config["oe-fragments"]:
|
for f in bitbake_config["oe-fragments"]:
|
||||||
@@ -295,20 +295,20 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
|
|||||||
for cf, v in test_configurations.items():
|
for cf, v in test_configurations.items():
|
||||||
for c in v['buildconfigs']:
|
for c in v['buildconfigs']:
|
||||||
out = self.runbbsetup("init --non-interactive {} {}".format(v['cmdline'], c))
|
out = self.runbbsetup("init --non-interactive {} {}".format(v['cmdline'], c))
|
||||||
buildpath = os.path.join(self.tempdir, 'bitbake-builds', '{}-{}'.format(cf, c))
|
setuppath = os.path.join(self.tempdir, 'bitbake-builds', '{}-{}'.format(cf, c))
|
||||||
with open(os.path.join(buildpath, 'config', "config-upstream.json")) as f:
|
with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f:
|
||||||
config_upstream = json.load(f)
|
config_upstream = json.load(f)
|
||||||
self.check_builddir_files(buildpath, test_file_content, config_upstream)
|
self.check_setupdir_files(setuppath, test_file_content, config_upstream)
|
||||||
os.environ['BBPATH'] = os.path.join(buildpath, 'build')
|
os.environ['BBPATH'] = os.path.join(setuppath, 'build')
|
||||||
out = self.runbbsetup("status")
|
out = self.runbbsetup("status")
|
||||||
self.assertIn("Configuration in {} has not changed".format(buildpath), out[0])
|
self.assertIn("Configuration in {} has not changed".format(setuppath), out[0])
|
||||||
out = self.runbbsetup("update")
|
out = self.runbbsetup("update")
|
||||||
self.assertIn("Configuration in {} has not changed".format(buildpath), out[0])
|
self.assertIn("Configuration in {} has not changed".format(setuppath), out[0])
|
||||||
|
|
||||||
# install buildtools
|
# install buildtools
|
||||||
out = self.runbbsetup("install-buildtools")
|
out = self.runbbsetup("install-buildtools")
|
||||||
self.assertIn("Buildtools installed into", out[0])
|
self.assertIn("Buildtools installed into", out[0])
|
||||||
self.assertTrue(os.path.exists(os.path.join(buildpath, 'buildtools')))
|
self.assertTrue(os.path.exists(os.path.join(setuppath, 'buildtools')))
|
||||||
|
|
||||||
# change a file in the test layer repo, make a new commit and
|
# change a file in the test layer repo, make a new commit and
|
||||||
# test that status/update correctly report the change and update the config
|
# test that status/update correctly report the change and update the config
|
||||||
@@ -319,17 +319,17 @@ print("BBPATH is {{}}".format(os.environ["BBPATH"]))
|
|||||||
'gizmo-env-passthrough',
|
'gizmo-env-passthrough',
|
||||||
'gizmo-no-fragment',
|
'gizmo-no-fragment',
|
||||||
'gadget-notemplate', 'gizmo-notemplate'):
|
'gadget-notemplate', 'gizmo-notemplate'):
|
||||||
buildpath = os.path.join(self.tempdir, 'bitbake-builds', 'test-config-1-{}'.format(c))
|
setuppath = os.path.join(self.tempdir, 'bitbake-builds', 'test-config-1-{}'.format(c))
|
||||||
os.environ['BBPATH'] = os.path.join(buildpath, 'build')
|
os.environ['BBPATH'] = os.path.join(setuppath, 'build')
|
||||||
out = self.runbbsetup("status")
|
out = self.runbbsetup("status")
|
||||||
self.assertIn("Layer repository file://{} checked out into {}/layers/test-repo updated revision master from".format(self.testrepopath, buildpath), out[0])
|
self.assertIn("Layer repository file://{} checked out into {}/layers/test-repo updated revision master from".format(self.testrepopath, setuppath), out[0])
|
||||||
out = self.runbbsetup("update")
|
out = self.runbbsetup("update")
|
||||||
if c in ('gadget', 'gizmo'):
|
if c in ('gadget', 'gizmo'):
|
||||||
self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(buildpath), out[0])
|
self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(setuppath), out[0])
|
||||||
self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0])
|
self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0])
|
||||||
with open(os.path.join(buildpath, 'config', "config-upstream.json")) as f:
|
with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f:
|
||||||
config_upstream = json.load(f)
|
config_upstream = json.load(f)
|
||||||
self.check_builddir_files(buildpath, test_file_content, config_upstream)
|
self.check_setupdir_files(setuppath, test_file_content, config_upstream)
|
||||||
|
|
||||||
# make a new branch in the test layer repo, change a file on that branch,
|
# make a new branch in the test layer repo, change a file on that branch,
|
||||||
# make a new commit, update the top level json config to refer to that branch,
|
# 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"]))
|
|||||||
'gizmo-env-passthrough',
|
'gizmo-env-passthrough',
|
||||||
'gizmo-no-fragment',
|
'gizmo-no-fragment',
|
||||||
'gadget-notemplate', 'gizmo-notemplate'):
|
'gadget-notemplate', 'gizmo-notemplate'):
|
||||||
buildpath = os.path.join(self.tempdir, 'bitbake-builds', 'test-config-1-{}'.format(c))
|
setuppath = os.path.join(self.tempdir, 'bitbake-builds', 'test-config-1-{}'.format(c))
|
||||||
os.environ['BBPATH'] = os.path.join(buildpath, 'build')
|
os.environ['BBPATH'] = os.path.join(setuppath, 'build')
|
||||||
out = self.runbbsetup("status")
|
out = self.runbbsetup("status")
|
||||||
self.assertIn("Configuration in {} has changed:".format(buildpath), out[0])
|
self.assertIn("Configuration in {} has changed:".format(setuppath), out[0])
|
||||||
self.assertIn('- "rev": "master"\n+ "rev": "another-branch"', out[0])
|
self.assertIn('- "rev": "master"\n+ "rev": "another-branch"', out[0])
|
||||||
out = self.runbbsetup("update")
|
out = self.runbbsetup("update")
|
||||||
if c in ('gadget', 'gizmo'):
|
if c in ('gadget', 'gizmo'):
|
||||||
self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(buildpath), out[0])
|
self.assertIn("Existing bitbake configuration directory renamed to {}/build/conf-backup.".format(setuppath), out[0])
|
||||||
self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0])
|
self.assertIn('-{}+{}'.format(prev_test_file_content, test_file_content), out[0])
|
||||||
with open(os.path.join(buildpath, 'config', "config-upstream.json")) as f:
|
with open(os.path.join(setuppath, 'config', "config-upstream.json")) as f:
|
||||||
config_upstream = json.load(f)
|
config_upstream = json.load(f)
|
||||||
self.check_builddir_files(buildpath, test_file_content, config_upstream)
|
self.check_setupdir_files(setuppath, test_file_content, config_upstream)
|
||||||
|
|||||||
Reference in New Issue
Block a user