All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: toaster@yoctoproject.org
Subject: [PATCH v6 39/41] toasterui: detect build run start correctly on Jethro
Date: Wed, 23 Mar 2016 10:15:30 +0200	[thread overview]
Message-ID: <f9b080127060a82d0d4a8318538be947aee20f16.1458720709.git.ed.bartosh@linux.intel.com> (raw)
In-Reply-To: <cover.1458720709.git.ed.bartosh@linux.intel.com>
In-Reply-To: <cover.1458720709.git.ed.bartosh@linux.intel.com>

From: Elliot Smith <elliot.smith@intel.com>

We currently use the TargetsAcquired event fired by the XMLRPC
server to mark the start of a build run from the command line.
At this point, we create the Build object in buildinfohelper,
then append targets etc. to it as the run continues.

However, on Jethro, this event isn't fired. This means that we
can't support builds with the Jethro release correctly, as
a Build object is never created.

Add a condition so that we can create a Build object when building
with Jethro by falling back to the BuildStarted event. Jethro
builds which fail early (bad target, bad MACHINE, bad DISTRO etc.)
will not be captured (as we need the TargetsAcquired event for
that), but other builds which succeed or fail later will be
captured.

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/bb/ui/buildinfohelper.py |  9 +++------
 bitbake/lib/bb/ui/toasterui.py       | 26 +++++++++++++++++++-------
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 406f608..328020f 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -979,18 +979,15 @@ class BuildInfoHelper(object):
         build_information = self._get_build_information(build_log_path)
         self.internal_state['build'] = self.orm_wrapper.create_build_object(build_information, self.brbe)
 
-    def store_targets(self, event):
+    def store_targets(self, targets):
         """
         store targets for the current build, if that build was started from
         the command line; targets for non-cli builds are irrelevant, as we
         create them from the BuildRequest anyway
 
-        event: a TargetsAcquired event with a task property (e.g. "build")
-        and a targetsList property (e.g. ["zlib", "dropbear"])
+        targets: a list of targets for the build, e.g.
+        ["zlib:build", "dropbear:build"]
         """
-        targets = map(lambda target: target + ':' + event.task,
-                      event.targetsList)
-
         target_information = {
             'targets': targets,
             'build': self.internal_state['build']
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index 8467978..c4fce63 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -232,18 +232,30 @@ 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
 
-            # start of build: this event is fired just before the buildTargets()
-            # command is invoked on the XMLRPC server
-            if isinstance(event, bb.event.TargetsAcquired):
+            # start of build: TargetsAcquired event is fired just before the
+            # buildTargets() command is invoked on the XMLRPC server; if
+            # we are on Jethro, we don't get TargetsAcquired, so treat
+            # BuildStarted as the start of the build instead
+            targets_acquired = isinstance(event, bb.event.TargetsAcquired)
+            build_started = isinstance(event, bb.event.BuildStarted)
+
+            if targets_acquired or build_started:
                 if not (build_log and build_log_file_path):
                     build_log, build_log_file_path = _open_build_log(log_dir)
-                buildinfohelper.store_new_build(build_log_file_path)
-                buildinfohelper.store_targets(event)
-                continue
+                    buildinfohelper.store_new_build(build_log_file_path)
+
+                    # BuildStarted signals the start of the build on Toaster 2.0,
+                    # TargetsAcquired signals it on Toaster 2.1+
+                    if build_started:
+                        targets = event._pkgs
+                    else:
+                        targets = map(lambda target: target + ':' + event.task, event.targetsList)
+
+                    buildinfohelper.store_targets(targets)
 
             # when the build proper starts, we extract information about
             # any layers and config data
-            if isinstance(event, bb.event.BuildStarted):
+            if build_started:
                 buildinfohelper.update_build(event)
                 continue
 
-- 
2.1.4



  parent reply	other threads:[~2016-03-23 10:37 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-23  8:14 [PATCH v6 00/41] per project build directory + build cancel + DL_DIR/SSTATE_DIR Ed Bartosh
2016-03-23  8:14 ` [PATCH v6 01/41] toaster: don't start bitbake server Ed Bartosh
2016-03-23  8:14 ` [PATCH v6 02/41] toaster: get rid of noui option Ed Bartosh
2016-03-23  8:14 ` [PATCH v6 03/41] toaster: set BITBAKE_UI environment variable Ed Bartosh
2016-03-23  8:14 ` [PATCH v6 04/41] toasterui: add brbe parameter to buildinfohelper Ed Bartosh
2016-03-23  8:14 ` [PATCH v6 05/41] uievent: improve BBUIEventQueue code Ed Bartosh
2016-03-23  8:14 ` [PATCH v6 06/41] buildinfohelper: improve handling of providermap Ed Bartosh
2016-03-23  8:14 ` [PATCH v6 07/41] toasterui: fix brbe reporting Ed Bartosh
2016-03-23  8:14 ` [PATCH v6 08/41] toaster: remove startBBServer API Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 09/41] toaster: remove release API Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 10/41] toaster: add brbe parameter to triggerBuild Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 11/41] toaster: modified setLayers API Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 12/41] toaster: reimplement triggerBuild Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 13/41] toaster: add new parameter to _shellcmd Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 14/41] toaster: stop bitbake server after the build Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 15/41] toaster: update conf/local.conf Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 16/41] toaster: fix jethro build Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 17/41] toaster: use bash explicitly Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 18/41] toasterui: shutdown on BuildCompleted event Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 19/41] toaster: bldcontrol Add forceShutDown function to BitbakeController Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 20/41] toaster: Move xhr calls for starting and stopping builds Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 21/41] toaster: xhr Update the implementation of the build cancellation request Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 22/41] toaster: libtoaster Update implementation of startABuild and cancelABuild Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 23/41] toaster: update BuildEnvironmentController and BitbakeController Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 24/41] toaster: models Add cancelled state to build outcome Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 25/41] toaster: bldcontrol models Add a cancelling state the BuildRequest Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 26/41] buildinfohelper: Add handler for cancelling a build Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 27/41] toaster: tables BuildsTable exclude cancelled builds Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 28/41] toaster: mrb_section template Add build cancel button Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 29/41] toaster: models Exclude the CANCELLED builds from get_number_of_builds Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 30/41] toaster: runbuilds Make runbuilds aware of the build CANCELLED state Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 31/41] toaster: runbuilds Clean up runbuilds Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 32/41] toaster: fix conflicting migrations Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 33/41] toaster: use empty token Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 34/41] toaster: add DL_DIR and SSTATE_DIR to poky toasterconf Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 35/41] toaster: add DL_DIR and SSTATE_DIR to oe toasterconf Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 36/41] toaster: update view to support DL_DIR and SSTATE_DIR Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 37/41] toaster: update projectconf.html for " Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 38/41] toaster: use bitbake from sourcedir/bitbake/bin Ed Bartosh
2016-03-23  8:15 ` Ed Bartosh [this message]
2016-03-23  8:15 ` [PATCH v6 40/41] buildinfohelper: fix KeyError Ed Bartosh
2016-03-23  8:15 ` [PATCH v6 41/41] toasterui: fix warning 'Unknown event' Ed Bartosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f9b080127060a82d0d4a8318538be947aee20f16.1458720709.git.ed.bartosh@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=toaster@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.