All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonin Godard <antonin.godard@bootlin.com>
To: bitbake-devel@lists.openembedded.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	 Antonin Godard <antonin.godard@bootlin.com>
Subject: [PATCH v2 2/3] bitbake-setup: create top-dir later in init
Date: Mon, 17 Nov 2025 09:15:38 +0100	[thread overview]
Message-ID: <20251117-bitbake-setup-abort-v2-2-a73f44e83bc0@bootlin.com> (raw)
In-Reply-To: <20251117-bitbake-setup-abort-v2-0-a73f44e83bc0@bootlin.com>

Calling init_bb_cache() before init_config() creates the top-directory
already, before the user has accepted to proceed after the first few
messages:

  Bitbake-setup is using <topdir> as top directory ("bitbake-setup settings --help" shows how to change it).

  A common site.conf file will be created, please edit or replace before running builds
      <topdir>/site.conf

  Proceed? (y/N):

Saying N here would leave an empty top directory which is unexpected.

Move the init_bb_cache() call later in init_config().

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 bin/bitbake-setup | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index adf19ab09f..db6428f8d2 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -452,14 +452,16 @@ def obtain_config(top_dir, settings, args, source_overrides, d):
     upstream_config['skip-selection'] = args.skip_selection
     return upstream_config
 
-def init_config(top_dir, settings, args, d):
+def init_config(top_dir, settings, args):
+    create_siteconf(top_dir, args.non_interactive, settings)
+
+    d = init_bb_cache(top_dir, settings, args)
     stdout = sys.stdout
     def handle_task_progress(event, d):
         rate = event.rate if event.rate else ''
         progress = event.progress if event.progress > 0 else 0
         print("{}% {}                ".format(progress, rate), file=stdout, end='\r')
 
-    create_siteconf(top_dir, args.non_interactive, settings)
     source_overrides = json.load(open(args.source_overrides)) if args.source_overrides else {'sources':{}}
     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'])))
@@ -898,8 +900,12 @@ def main():
 
         print('Bitbake-setup is using {} as top directory ("bitbake-setup settings --help" shows how to change it).\n'.format(top_dir, global_settings_path(args)))
 
-        d = init_bb_cache(top_dir, all_settings, args)
-        args.func(top_dir, all_settings, args, d)
+        if args.func == init_config:
+            init_config(top_dir, all_settings, args)
+        else:
+            d = init_bb_cache(top_dir, all_settings, args)
+            args.func(top_dir, all_settings, args, d)
+
         save_bb_cache()
     else:
         from argparse import Namespace

-- 
2.51.0



  parent reply	other threads:[~2025-11-17  8:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17  8:15 [PATCH v2 0/3] bitbake-setup init improvements Antonin Godard
2025-11-17  8:15 ` [PATCH v2 1/3] bitbake-setup: fix top_dir creation in create_siteconf Antonin Godard
2025-11-17  8:15 ` Antonin Godard [this message]
2025-11-17  8:15 ` [PATCH v2 3/3] bitbake-setup: handle ctrl+c Antonin Godard
2025-11-17 10:38 ` [bitbake-devel] [PATCH v2 0/3] bitbake-setup init improvements 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=20251117-bitbake-setup-abort-v2-2-a73f44e83bc0@bootlin.com \
    --to=antonin.godard@bootlin.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=thomas.petazzoni@bootlin.com \
    /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.