aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py23
-rw-r--r--bitbake/lib/bb/ui/toasterui.py26
2 files changed, 32 insertions, 17 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 7805086b6ad..1c97183ccbc 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -968,24 +968,27 @@ 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"]
"""
- if self.internal_state['build'].project.is_default:
- targets = map(lambda target: target + ':' + event.task, event.targetsList)
- target_information = {
- 'targets': targets,
- 'build': self.internal_state['build']
- }
+ # non-command-line builds have their targets stored when the build
+ # request is created
+ if not self.internal_state['build'].project.is_default:
+ return
+
+ target_information = {
+ 'targets': targets,
+ 'build': self.internal_state['build']
+ }
- self.internal_state['targets'] = self.orm_wrapper.get_or_create_targets(target_information)
+ self.internal_state['targets'] = self.orm_wrapper.get_or_create_targets(target_information)
def update_build(self, event):
"""
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index ee4011073c8..58ce4170dd7 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