[Toaster] [PATCH 2/2] toasterui: use BuildInit to capture builds with bad targets

Elliot Smith elliot.smith at intel.com
Mon Apr 25 08:26:09 PDT 2016


If a build has bad targets which cause bitbake to fail before
BuildStarted is fired, we are unable to represent this in Toaster,
as the build was not detected at all.

Use the BuildInit event so we can capture these failures.

BuildStarted is retained as the event which causes a build object
to be created, to support older versions of bitbake which don't
have BuildInit.

[YOCTO #8440]

Signed-off-by: Elliot Smith <elliot.smith at intel.com>
---
 bitbake/lib/bb/ui/buildinfohelper.py | 17 ++++++++++-------
 bitbake/lib/bb/ui/toasterui.py       | 19 ++++++++-----------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 9397905..da8ec00 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -1017,7 +1017,17 @@ class BuildInfoHelper(object):
 
         self.internal_state['build'] = build_obj
 
+        # create target information
+        target_information = {}
+        target_information['targets'] = event._pkgs
+        target_information['build'] = build_obj
+
+        self.internal_state['targets'] = self.orm_wrapper.get_or_create_targets(target_information)
+
+    def save_build_layers_and_variables(self, event):
         # save layer version information for this build
+        build_obj = self.internal_state['build']
+
         if not 'lvs' in self.internal_state:
             logger.error("Layer version information not found; Check if the bitbake server was configured to inherit toaster.bbclass.")
         else:
@@ -1026,13 +1036,6 @@ class BuildInfoHelper(object):
 
             del self.internal_state['lvs']
 
-        # create target information
-        target_information = {}
-        target_information['targets'] = event._pkgs
-        target_information['build'] = build_obj
-
-        self.internal_state['targets'] = self.orm_wrapper.get_or_create_targets(target_information)
-
         # Save build configuration
         data = self.server.runCommand(["getAllKeysWithFlags", ["doc", "func"]])[0]
 
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index 6bf4c1f..6d0dea9 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -103,6 +103,7 @@ _evt_list = [
     "bb.command.CommandFailed",
     "bb.cooker.CookerExit",
     "bb.event.BuildCompleted",
+    "bb.event.BuildInit",
     "bb.event.BuildStarted",
     "bb.event.CacheLoadCompleted",
     "bb.event.CacheLoadProgress",
@@ -231,19 +232,15 @@ def main(server, eventHandler, params):
             # pylint: disable=protected-access
             # the code will look into the protected variables of the event; no easy way around this
 
-            # we treat ParseStarted as the first event of toaster-triggered
-            # builds; that way we get the Build Configuration included in the log
-            # and any errors that occur before BuildStarted is fired
-            if isinstance(event, bb.event.ParseStarted):
+            # create a build object in buildinfohelper from either BuildInit (if available)
+            # or BuildStarted (for jethro and previous versions)
+            if isinstance(event, (bb.event.BuildStarted, bb.event.BuildInit)):
                 if not (build_log and build_log_file_path):
                     build_log, build_log_file_path = _open_build_log(log_dir)
-                continue
-
-            if isinstance(event, bb.event.BuildStarted):
-                if not (build_log and build_log_file_path):
-                    build_log, build_log_file_path = _open_build_log(log_dir)
-
-                buildinfohelper.store_started_build(event, build_log_file_path)
+                    buildinfohelper.store_started_build(event, build_log_file_path)
+                # get additional data from BuildStarted
+                if isinstance(event, bb.event.BuildStarted):
+                    buildinfohelper.save_build_layers_and_variables(event)
                 continue
 
             if isinstance(event, (bb.build.TaskStarted, bb.build.TaskSucceeded, bb.build.TaskFailedSilent)):
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



More information about the toaster mailing list