aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbitbake/bin/toaster-eventreplay13
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py5
-rw-r--r--bitbake/lib/bb/ui/toasterui.py11
-rw-r--r--bitbake/lib/toaster/orm/views.py8
4 files changed, 19 insertions, 18 deletions
diff --git a/bitbake/bin/toaster-eventreplay b/bitbake/bin/toaster-eventreplay
index 624829aea0f..615a7aed150 100755
--- a/bitbake/bin/toaster-eventreplay
+++ b/bitbake/bin/toaster-eventreplay
@@ -26,6 +26,7 @@
# as a build eventlog, and the ToasterUI is used to process events in the file
# and log data in the database
+from __future__ import print_function
import os
import sys, logging
@@ -39,12 +40,6 @@ from bb.ui import toasterui
import sys
import logging
-logger = logging.getLogger(__name__)
-console = logging.StreamHandler(sys.stdout)
-format_str = "%(levelname)s: %(message)s"
-logging.basicConfig(format=format_str)
-
-
import json, pickle
@@ -168,12 +163,12 @@ class MockConfigParameters():
# run toaster ui on our mock bitbake class
if __name__ == "__main__":
if len(sys.argv) < 2:
- logger.error("Usage: %s event.log " % sys.argv[0])
+ print("Usage: %s event.log " % sys.argv[0])
sys.exit(1)
file_name = sys.argv[-1]
mock_connection = FileReadEventsServerConnection(file_name)
configParams = MockConfigParameters()
- # run the main program
- toasterui.main(mock_connection.connection, mock_connection.events, configParams)
+ # run the main program and set exit code to the returned value
+ sys.exit(toasterui.main(mock_connection.connection, mock_connection.events, configParams))
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 64bd94e5e8d..647d663cb5a 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -718,12 +718,15 @@ class BuildInfoHelper(object):
return lvo
#if we get here, we didn't read layers correctly; dump whatever information we have on the error log
- logger.error("Could not match layer version for recipe path %s : %s" % (path, self.orm_wrapper.layer_version_objects))
+ logger.warn("Could not match layer version for recipe path %s : %s" % (path, self.orm_wrapper.layer_version_objects))
#mockup the new layer
unknown_layer, created = Layer.objects.get_or_create(name="__FIXME__unidentified_layer", local_path="/", layer_index_url="")
unknown_layer_version_obj, created = Layer_Version.objects.get_or_create(layer = unknown_layer, build = self.internal_state['build'])
+ # append it so we don't run into this error again and again
+ self.orm_wrapper.layer_version_objects.append(unknown_layer_version_obj)
+
return unknown_layer_version_obj
def _get_recipe_information_from_taskfile(self, taskfile):
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index f0f853be14f..6a7a1cd174b 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
diff --git a/bitbake/lib/toaster/orm/views.py b/bitbake/lib/toaster/orm/views.py
index 97d792b99e9..61d14f93755 100644
--- a/bitbake/lib/toaster/orm/views.py
+++ b/bitbake/lib/toaster/orm/views.py
@@ -55,6 +55,8 @@ def eventfile(request):
scriptenv["DATABASE_URL"] = toastermain.settings.getDATABASE_URL()
# run the data loading process and return the results
- (out, err) = subprocess.Popen([import_script, abstemppath], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=scriptenv).communicate()
- os.remove(abstemppath)
- return HttpResponse("%s\n%s" % (out, err), content_type="text/plain;utf8")
+ importer = subprocess.Popen([import_script, abstemppath], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=scriptenv)
+ (out, err) = importer.communicate()
+ if importer.returncode == 0:
+ os.remove(abstemppath)
+ return HttpResponse("== Retval %d\n== STDOUT\n%s\n\n== STDERR\n%s" % (importer.returncode, out, err), content_type="text/plain;utf8")