bitbake-setup: Allow setup-dir-name to be specified in JSON
PATCH 1/2 bitbake-setup: Allow setup-dir-name to be specified in JSON
Enables the JSON file to specify the preferred name of the setup directory with a 'setup-dir-name' key. This key can have variable expansions in the same format as python string.Template strings (which matches the shell variable expansion rules).
Variables that can be expanded are any fragment configuration prompted by the user (e.g. the keys in "oe-fragments-one-of"), or "$name" to use the name of the configuration (e.g. the .conf.json file).
--- bin/bitbake-setup | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
bin/bitbake-setup +10 -1
@@ -17,6 +17,7 @@ import glob import subprocess import copy import textwrap +import string default_registry = os.path.normpath(os.path.dirname(__file__) + "/../default-registry")
@@ -467,7 +468,15 @@ def init_config(top_dir, settings, args, d): if args.setup_dir_name: setup_dir_name = args.setup_dir_name else: - setup_dir_name = "{}-{}".format(upstream_config['name']," ".join(upstream_config['non-interactive-cmdline-options'][1:]).replace(" ","-").replace("/","_")) + if 'setup-dir-name' in upstream_config['bitbake-config']: + mapping = { + k: v.replace(" ", "-").replace("/", "_") + for k, v in upstream_config['bitbake-config']['oe-fragment-choices'].items() + } + setup_dir_name = string.Template(upstream_config['bitbake-config']['setup-dir-name']).substitute(mapping) + else: + setup_dir_name = "{}-{}".format(upstream_config['name']," ".join(upstream_config['non-interactive-cmdline-options'][1:]).replace(" ","-").replace("/","_")) + if not args.non_interactive: n = input(f"Enter setup directory name: [{setup_dir_name}] ") if n:
Signature · 1 line
2.51.1
PATCH 2/2 default-registry: Change default setup dir
Uses the template mechanism to provide shorter setup-dir names by default. Specifically, the machine names are no longer part of the setup path since they are intended to be changed without needing a new setup directory.
--- default-registry/configurations/oe-nodistro.conf.json | 1 + default-registry/configurations/poky-master.conf.json | 1 + 2 files changed, 2 insertions(+)
default-registry/configurations/oe-nodistro.conf.json +1 -0
@@ -43,6 +43,7 @@ { "name": "nodistro", "description": "OpenEmbedded 'nodistro'", + "setup-dir-name": "oe-nodistro", "bb-layers": ["openembedded-core/meta"], "oe-fragments-one-of": { "machine": {
default-registry/configurations/poky-master.conf.json +1 -0
@@ -54,6 +54,7 @@ "configurations": [ { "bb-layers": ["openembedded-core/meta","meta-yocto/meta-yocto-bsp","meta-yocto/meta-poky"], + "setup-dir-name": "poky-master-$distro", "oe-fragments-one-of": { "machine": { "description": "Target machines",
Signature · 1 line
2.51.1
bin/bitbake-setup def init_config(top_dir, settings, args, d): · line 478
Quoted 9 lines · Joshua Watt via lists.openembedded.org
bin/bitbake-setup +8
-1- setup_dir_name = "{}-{}".format(upstream_config['name']," ".join(upstream_config['non-interactive-cmdline-options'][1:]).replace(" ","-").replace("/","_")) + if 'setup-dir-name' in upstream_config['bitbake-config']: + mapping = { + k: v.replace(" ", "-").replace("/", "_") + for k, v in upstream_config['bitbake-config']['oe-fragment-choices'].items() + } + setup_dir_name = string.Template(upstream_config['bitbake-config']['setup-dir-name']).substitute(mapping) + else: + setup_dir_name = "{}-{}".format(upstream_config['name']," ".join(upstream_config['non-interactive-cmdline-options'][1:]).replace(" ","-").replace("/","_"))
This (and the actual json tweaks) greatly increases the chances of directory names clashing, so there should be a check for existence, and a logic to deal with it (probably just fall back to the full style)?
Alex
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Alexander Kanavin via lists.openembedded.org
This (and the actual json tweaks) greatly increases the chances of directory names clashing, so there should be a check for existence, and a logic to deal with it (probably just fall back to the full style)?
Also see my proposal for a setting. There are pros and cons for either approach, I just would like you to read and consider it.
Alex
Quoted 11 lines · Alexander Kanavin
Quoted 4 lines · Alexander Kanavin via lists.openembedded.org
This (and the actual json tweaks) greatly increases the chances of directory names clashing, so there should be a check for existence, and a logic to deal with it (probably just fall back to the full style)?
Also see my proposal for a setting. There are pros and cons for either approach, I just would like you to read and consider it.
Ya this was more just to show how to do the template string per request, not necessarily the complete solution. I probably should have sent it as an RFC.
Quoted 2 lines
Alex
Quoted 10 lines · Joshua Watt
Quoted 7 lines
Quoted 4 lines
This (and the actual json tweaks) greatly increases the chances of directory names clashing, so there should be a check for existence, and a logic to deal with it (probably just fall back to the full style)?
Also see my proposal for a setting. There are pros and cons for either approach, I just would like you to read and consider it.
Ya this was more just to show how to do the template string per request, not necessarily the complete solution. I probably should have sent it as an RFC.
My C is that I'm okay with this, if it also comes with a 'force-full-setup-dir-name' setting :)
Alex