From 7759cd4931b2e7af19eea79dfac6738a92687665 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Fri, 1 May 2015 16:20:33 +0100 Subject: bitbake: toasterui: proper exit code on toaster errors This patch modifies the toasterui to properly return the exit code based on the errors found in the toaster itself. The upload event file API call will not delete event logs for which toasterui showed an error. This will facilitate debugging. Minor enhancement in the buildinfohelper to reduce the number of lookups on unknown layer objects (prevented testing of the patch). (Bitbake rev: 1ddd6a9e4280a4adf971132ff1fe7ec9b3252905) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/toasterui.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bitbake/lib/bb/ui/toasterui.py') diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py index f0f853be14..6a7a1cd174 100644 --- a/bitbake/lib/bb/ui/toasterui.py +++ b/bitbake/lib/bb/ui/toasterui.py @@ -88,7 +88,7 @@ def main(server, eventHandler, params ): if not params.observe_only: logger.error("ToasterUI can only work in observer mode") - return + return 1 main.shutdown = 0 @@ -144,7 +144,6 @@ def main(server, eventHandler, params ): buildinfohelper.store_log_event(event) if event.levelno >= format.ERROR: errors = errors + 1 - return_value = 1 elif event.levelno == format.WARNING: warnings = warnings + 1 # For "normal" logging conditions, don't show note logs from tasks @@ -158,7 +157,6 @@ def main(server, eventHandler, params ): if isinstance(event, bb.build.TaskFailed): buildinfohelper.update_and_store_task(event) - return_value = 1 logfile = event.logfile if logfile and os.path.exists(logfile): bb.error("Logfile of failure stored in: %s" % logfile) @@ -188,7 +186,6 @@ def main(server, eventHandler, params ): continue if isinstance(event, bb.event.NoProvider): - return_value = 1 errors = errors + 1 if event._runtime: r = "R" @@ -316,6 +313,7 @@ def main(server, eventHandler, params ): continue logger.error("Unknown event: %s", event) + return_value += 1 except EnvironmentError as ioerror: # ignore interrupted io @@ -344,10 +342,13 @@ def main(server, eventHandler, params ): except Exception as ce: logger.error("CRITICAL - Failed to to save toaster exception to the database: %s" % str(ce)) + # make sure we return with an error + return_value += 1 pass if interrupted: if return_value == 0: - return_value = 1 + return_value += 1 + logger.warn("Return value is %d", return_value) return return_value -- cgit v1.2.3-54-g00ecf