[oe-commits] [bitbake] 18/44: toasterui: use BuildInit to capture builds with bad targets

git at git.openembedded.org git at git.openembedded.org
Mon Jun 13 21:11:06 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit d53b6e577c22aec26d1b0c49f4cad012bcce7c76
Author: Elliot Smith <elliot.smith at intel.com>
AuthorDate: Mon Apr 25 16:26:09 2016 +0100

    toasterui: use BuildInit to capture builds with bad targets
    
    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>
---
 lib/bb/ui/buildinfohelper.py | 17 ++++++++++-------
 lib/bb/ui/toasterui.py       | 19 ++++++++-----------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index d59d6a5..37e1555 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -1015,7 +1015,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:
@@ -1024,13 +1034,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/lib/bb/ui/toasterui.py b/lib/bb/ui/toasterui.py
index 5382935..fcfa255 100644
--- a/lib/bb/ui/toasterui.py
+++ b/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)):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list