summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-01-11 17:43:30 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-01-11 23:14:48 +0000
commit3a439f94ab61902155eecc86c31b2bd6968b0dbe (patch)
treea98d68b0176e84a29e7f0d177cfd7160ce0022d6 /bitbake/lib/bb
parent92c0dba45611e33e6e929c5032e35a202a5c32b6 (diff)
downloadpoky-3a439f94ab61902155eecc86c31b2bd6968b0dbe.tar.gz
bitbake: knotty: Improve shutdown handling
There are three levels of shutdown, the initial "wait for current tasks", then "stop current tasks" and "exit now". Change the code so that we don't instantly exit after "stop current tasks" but allow the events to come through from the server first. The new shutdown level allows that to then be broken out of too. (Bitbake rev: af38345b91cfc8a6bb5c38f5753255e7635bfe2b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/ui/knotty.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 7370a1adfd..431baa15ef 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -631,7 +631,12 @@ def main(server, eventHandler, params, tf = TerminalFilter):
631 termfilter = tf(main, helper, console_handlers, params.options.quiet) 631 termfilter = tf(main, helper, console_handlers, params.options.quiet)
632 atexit.register(termfilter.finish) 632 atexit.register(termfilter.finish)
633 633
634 while main.shutdown < 2: 634 # shutdown levels
635 # 0 - normal operation
636 # 1 - no new task execution, let current running tasks finish
637 # 2 - interrupting currently executing tasks
638 # 3 - we're done, exit
639 while main.shutdown < 3:
635 try: 640 try:
636 if (lastprint + printinterval) <= time.time(): 641 if (lastprint + printinterval) <= time.time():
637 termfilter.keepAlive(printinterval) 642 termfilter.keepAlive(printinterval)
@@ -644,7 +649,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
644 termfilter.clearFooter() 649 termfilter.clearFooter()
645 print("No reply after pinging server (%s, %s), exiting." % (str(error), str(ret))) 650 print("No reply after pinging server (%s, %s), exiting." % (str(error), str(ret)))
646 return_value = 3 651 return_value = 3
647 main.shutdown = 2 652 main.shutdown = 3
648 lastevent = time.time() 653 lastevent = time.time()
649 if not parseprogress: 654 if not parseprogress:
650 termfilter.updateFooter() 655 termfilter.updateFooter()
@@ -756,15 +761,15 @@ def main(server, eventHandler, params, tf = TerminalFilter):
756 if event.error: 761 if event.error:
757 errors = errors + 1 762 errors = errors + 1
758 logger.error(str(event)) 763 logger.error(str(event))
759 main.shutdown = 2 764 main.shutdown = 3
760 continue 765 continue
761 if isinstance(event, bb.command.CommandExit): 766 if isinstance(event, bb.command.CommandExit):
762 if not return_value: 767 if not return_value:
763 return_value = event.exitcode 768 return_value = event.exitcode
764 main.shutdown = 2 769 main.shutdown = 3
765 continue 770 continue
766 if isinstance(event, (bb.command.CommandCompleted, bb.cooker.CookerExit)): 771 if isinstance(event, (bb.command.CommandCompleted, bb.cooker.CookerExit)):
767 main.shutdown = 2 772 main.shutdown = 3
768 continue 773 continue
769 if isinstance(event, bb.event.MultipleProviders): 774 if isinstance(event, bb.event.MultipleProviders):
770 logger.info(str(event)) 775 logger.info(str(event))