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 3/3] bitbake-setup: handle ctrl+c
Date: Mon, 17 Nov 2025 09:15:39 +0100 [thread overview]
Message-ID: <20251117-bitbake-setup-abort-v2-3-a73f44e83bc0@bootlin.com> (raw)
In-Reply-To: <20251117-bitbake-setup-abort-v2-0-a73f44e83bc0@bootlin.com>
Instead of printing the stack trace, print "Shutting down..." when the
user presses Ctrl+C during command executions. Mention that the
top-directory's setups might be incomplete if the topdir was already
created at this point.
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
bin/bitbake-setup | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index db6428f8d2..d0a932a6b2 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -17,6 +17,8 @@ import glob
import subprocess
import copy
import textwrap
+import signal
+import functools
default_registry = os.path.normpath(os.path.dirname(__file__) + "/../default-registry")
@@ -783,6 +785,15 @@ def merge_settings(builtin_settings, global_settings, topdir_settings, cmdline_s
return all_settings
+def sigint_handler(sig, frame, func, top_dir):
+ print(f'\nShutting down...')
+ if isinstance(top_dir, str) and os.path.exists(top_dir):
+ if func in [init_config, build_update]:
+ print(f'{top_dir} may contain an incomplete setup!')
+ elif func == install_buildtools:
+ print(f'{top_dir} may contain an incomplete buildtools installation!')
+ exit()
+
def main():
def add_setup_dir_arg(parser):
setup_dir = get_setup_dir_via_bbpath()
@@ -888,6 +899,12 @@ def main():
global_settings = load_settings(global_settings_path(args))
top_dir = get_top_dir(args, merge_settings(builtin_settings, global_settings, {}, args.cmdline_settings))
+ # register handler now to pass top_dir
+ _handler = functools.partial(sigint_handler,
+ func=args.func,
+ top_dir=os.path.abspath(top_dir))
+ signal.signal(signal.SIGINT, _handler)
+
# This cannot be set with the rest of the builtin settings as top_dir needs to be determined first
builtin_settings['default']['dl-dir'] = os.path.join(top_dir, '.bitbake-setup-downloads')
--
2.51.0
next prev 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 ` [PATCH v2 2/3] bitbake-setup: create top-dir later in init Antonin Godard
2025-11-17 8:15 ` Antonin Godard [this message]
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-3-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.