| Message ID | 20251114-bitbake-setup-abort-v1-3-d2f9967df3b1@bootlin.com |
|---|---|
| State | New |
| Headers | show |
| Series | bitbake-setup init improvements | expand |
Since other functions may also become interactive (e.g. update prompting the user if files in build/conf/ should be replaced), shouldn't this be installed as a generic handler in main()? Alex On Fri, 14 Nov 2025 at 12:07, Antonin Godard via lists.openembedded.org <antonin.godard=bootlin.com@lists.openembedded.org> wrote: > > Instead of printing the stack trace, print "Shutting down..." when the > user presses Ctrl+C during the init. Mention that the top-directory's > setups might be incomplete if the topdir was already created. > > Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> > --- > bin/bitbake-setup | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/bin/bitbake-setup b/bin/bitbake-setup > index 3dc46cbbfa..151cb79cac 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") > > @@ -452,7 +454,15 @@ def obtain_config(top_dir, settings, args, source_overrides, d): > upstream_config['skip-selection'] = args.skip_selection > return upstream_config > > +def init_sigint_handler(sig, frame, top_dir): > + print(f'\nShutting down...') > + if isinstance(top_dir, str) and os.path.exists(top_dir): > + print(f'{top_dir} may contain an incomplete setup!') > + exit() > + > def init_config(top_dir, settings, args): > + _handler = functools.partial(init_sigint_handler, top_dir=top_dir) > + signal.signal(signal.SIGINT, _handler) > create_siteconf(top_dir, args.non_interactive, settings) > > d = init_bb_cache(top_dir, settings, args) > > -- > 2.51.0 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#18392): https://lists.openembedded.org/g/bitbake-devel/message/18392 > Mute This Topic: https://lists.openembedded.org/mt/116290015/1686489 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 3dc46cbbfa..151cb79cac 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") @@ -452,7 +454,15 @@ def obtain_config(top_dir, settings, args, source_overrides, d): upstream_config['skip-selection'] = args.skip_selection return upstream_config +def init_sigint_handler(sig, frame, top_dir): + print(f'\nShutting down...') + if isinstance(top_dir, str) and os.path.exists(top_dir): + print(f'{top_dir} may contain an incomplete setup!') + exit() + def init_config(top_dir, settings, args): + _handler = functools.partial(init_sigint_handler, top_dir=top_dir) + signal.signal(signal.SIGINT, _handler) create_siteconf(top_dir, args.non_interactive, settings) d = init_bb_cache(top_dir, settings, args)
Instead of printing the stack trace, print "Shutting down..." when the user presses Ctrl+C during the init. Mention that the top-directory's setups might be incomplete if the topdir was already created. Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> --- bin/bitbake-setup | 10 ++++++++++ 1 file changed, 10 insertions(+)