All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: bitbake-devel@lists.openembedded.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [bitbake-devel][PATCH 1/2] bitbake-setup: Allow setup-dir-name to be specified in JSON
Date: Mon, 17 Nov 2025 12:48:39 -0700	[thread overview]
Message-ID: <20251117194840.2322115-1-JPEWhacker@gmail.com> (raw)

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



             reply	other threads:[~2025-11-17 19:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 19:48 Joshua Watt [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251117194840.2322115-1-JPEWhacker@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.