All of lore.kernel.org
 help / color / mirror / Atom feed
* [bitbake-devel][PATCH 1/2] bitbake-setup: Allow setup-dir-name to be specified in JSON
@ 2025-11-17 19:48 Joshua Watt
  2025-11-17 19:48 ` [bitbake-devel][PATCH 2/2] default-registry: Change default setup dir Joshua Watt
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Joshua Watt @ 2025-11-17 19:48 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Joshua Watt

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).

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 bin/bitbake-setup | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 7e9491fac..7ee182bf3 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -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:
-- 
2.51.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-17 20:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17 19:48 [bitbake-devel][PATCH 1/2] bitbake-setup: Allow setup-dir-name to be specified in JSON Joshua Watt
2025-11-17 19:48 ` [bitbake-devel][PATCH 2/2] default-registry: Change default setup dir Joshua Watt
2025-11-17 19:53 ` [bitbake-devel][PATCH 1/2] bitbake-setup: Allow setup-dir-name to be specified in JSON Alexander Kanavin
     [not found] ` <1878E35BD8113CE6.1265056@lists.openembedded.org>
2025-11-17 19:55   ` Alexander Kanavin
2025-11-17 19:57     ` Joshua Watt
2025-11-17 20:02       ` Alexander Kanavin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.