diff mbox series

[bitbake-devel,v2] bitbake-setup: Prompt setup directory name

Message ID 20251112172413.3763712-1-JPEWhacker@gmail.com
State New
Headers show
Series [bitbake-devel,v2] bitbake-setup: Prompt setup directory name | expand

Commit Message

Joshua Watt Nov. 12, 2025, 5:24 p.m. UTC
If the setup directory is not specified on the command line, prompt the
user if they would like to change it. This allows the user to use an
alternative name (e.g. a terser one) at setup time.

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

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index c32381e50..3df8f120b 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -466,7 +466,16 @@  def init_config(top_dir, settings, args, 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'])))
 
-    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 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 not args.non_interactive:
+            n = input(f"Enter setup directory name: [{setup_dir_name}] ")
+            if n:
+                setup_dir_name = n
+
+    setupdir = os.path.join(os.path.abspath(top_dir), setup_dir_name)
     if os.path.exists(os.path.join(setupdir, "layers")):
         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