Create Build object earlier in bitbake processing
PATCH 1/1 Create Build object earlier in bitbake processing
To capture command-line build failures earlier, add an additional event to the bitbake XMLRPC server which fires just before the buildTargets command is run. This event contains the target and task information required by Toaster for annotating a build so that it displays correctly in the "recent builds" page fragment. Toaster can then capture builds which fail very early in the build process (e.g. due to bitbake misconfiguration or bad targets) and display them intelligibly.
To test, try the following on the command line:
1. Set an invalid MACHINE in conf/local.conf and do a build of a valid target, e.g. bitbake zlib.
2. Set an invalid DISTRO in conf/local.conf and do a build of a valid target, e.g. bitbake zlib.
3. Try to build an invalid target, e.g. bitbake zzz.
In all cases, the "all builds" pages should show the failed command line builds. Note that fixing bug 8443 will improve how we show these early failed builds.
Related bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8440
Changes since c0fe43b (toaster-next) are ingit://git.yoctoproject.org/poky-contrib, elliot/toaster/failed_builds-8440-v5
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=elliot/toaster/failed_builds-8440-v5
Elliot Smith (1):
toaster: create Build object earlier in bitbake processing
bitbake/lib/bb/event.py | 7 +++ bitbake/lib/bb/server/xmlrpc.py | 3 + bitbake/lib/bb/ui/buildinfohelper.py | 73 ++++++++++------------ bitbake/lib/bb/ui/toasterui.py | 21 ++++--- .../orm/migrations/0005_remove_build_build_name.py | 18 ++++++ bitbake/lib/toaster/orm/models.py | 1 - 6 files changed, 73 insertions(+), 50 deletions(-) create mode 100644 bitbake/lib/toaster/orm/migrations/0005_remove_build_build_name.py
--
Elliot Smith
Software Engineer
Intel OTC
---------------------------------------------------------------------
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.
PATCH 1/1 toaster: create Build object earlier in bitbake processing
If a build fails because of a bitbake error occurring before the BuildStarted event fires, we do not generate a Build object for command-line builds. This means that failed command-line builds don't appear in Toaster at all.
To resolve, split build creation into two steps:
1. Just before buildTargets() is invoked on the XMLRPC server: create the base Build object. Note that as soon as a Toaster-triggered build starts, targets are added to it; but this event is the earliest point when task and targets are available for command-line builds. (This requires a new TargetsAcquired event to be fired by the XMLRPC server when the buildTargets() command is called.)
2. BuildStarted event: add any layer information to either type of build (command-line or Toaster-triggered).
Note that the build_name property cannot be set until BuildStarted, as it is not available until then, which could cause problems for creating Build objects earlier; however, this property is redundant, as it's never used anywhere in Toaster, so it has been removed (along with any functions which refer to it).
[YOCTO #8440]
--- bitbake/lib/bb/event.py | 7 +++ bitbake/lib/bb/server/xmlrpc.py | 3 + bitbake/lib/bb/ui/buildinfohelper.py | 73 ++++++++++------------ bitbake/lib/bb/ui/toasterui.py | 21 ++++--- .../orm/migrations/0005_remove_build_build_name.py | 18 ++++++ bitbake/lib/toaster/orm/models.py | 1 - 6 files changed, 73 insertions(+), 50 deletions(-) create mode 100644 bitbake/lib/toaster/orm/migrations/0005_remove_build_build_name.py
bitbake/lib/bb/event.py +7 -0
@@ -444,6 +444,13 @@ class MultipleProviders(Event): """ return self._candidates +class TargetsAcquired(Event): + """Target we are aiming at known""" + def __init__(self, task, targetsList): + Event.__init__(self) + self.task = task + self.targetsList = targetsList + class ParseStarted(OperationStarted): """Recipe parsing for the runqueue has begun""" def __init__(self, total):
bitbake/lib/bb/server/xmlrpc.py +3 -0
@@ -112,6 +112,9 @@ class BitBakeServerCommands(): """ Run a cooker command on the server """ + if 'buildTargets' in command[0]: + bb.event.fire(bb.event.TargetsAcquired(command[2], command[1]), self.server.readonly) + return self.cooker.command.runCommand(command, self.server.readonly) def getEventHandle(self):
bitbake/lib/bb/ui/buildinfohelper.py +34 -39
124 lines not on this page · raw message
bitbake/lib/bb/ui/toasterui.py +11 -10
@@ -93,14 +93,14 @@ def _close_build_log(build_log): logger.removeHandler(build_log) _evt_list = [ "bb.runqueue.runQueueExitWait", "bb.event.LogExecTTY", "logging.LogRecord", - "bb.build.TaskFailed", "bb.build.TaskBase", "bb.event.ParseStarted", + "bb.build.TaskFailed", "bb.build.TaskBase", "bb.event.ParseProgress", "bb.event.ParseCompleted", "bb.event.CacheLoadStarted", "bb.event.CacheLoadProgress", "bb.event.CacheLoadCompleted", "bb.command.CommandFailed", "bb.command.CommandExit", "bb.command.CommandCompleted", "bb.cooker.CookerExit", "bb.event.MultipleProviders", "bb.event.NoProvider", "bb.runqueue.sceneQueueTaskStarted", "bb.runqueue.runQueueTaskStarted", "bb.runqueue.runQueueTaskFailed", "bb.runqueue.sceneQueueTaskFailed", "bb.event.BuildBase", "bb.build.TaskStarted", "bb.build.TaskSucceeded", "bb.build.TaskFailedSilent", - "bb.event.MetadataEvent"] + "bb.event.MetadataEvent", "bb.event.TargetsAcquired"] def main(server, eventHandler, params): # set to a logging.FileHandler instance when a build starts;
@@ -186,19 +186,20 @@ 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): + # start of build: this event is fired just before the buildTargets() + # command is invoked on the XMLRPC server + if isinstance(event, bb.event.TargetsAcquired): 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 + # when the build proper starts, we extract information about + # any layers and config data 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.update_build(event) + continue if isinstance(event, (bb.build.TaskStarted, bb.build.TaskSucceeded, bb.build.TaskFailedSilent)): buildinfohelper.update_and_store_task(event)
bitbake/lib/toaster/orm/migrations/0005_remove_build_build_name.py new file +18 -0
@@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('orm', '0004_provides'), + ] + + operations = [ + migrations.RemoveField( + model_name='build', + name='build_name', + ), + ]
bitbake/lib/toaster/orm/models.py +0 -1
@@ -370,7 +370,6 @@ class Build(models.Model): completed_on = models.DateTimeField() outcome = models.IntegerField(choices=BUILD_OUTCOME, default=IN_PROGRESS) cooker_log_path = models.CharField(max_length=500) - build_name = models.CharField(max_length=100) bitbake_version = models.CharField(max_length=50) @staticmethod
Signature · 14 lines
Elliot Smith Software Engineer Intel OTC --------------------------------------------------------------------- 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.
Quoted 10 lines · Elliot Smith
To capture command-line build failures earlier, add an additional event to the bitbake XMLRPC server which fires just before the buildTargets command is run. This event contains the target and task information required by Toaster for annotating a build so that it displays correctly in the "recent builds" page fragment. Toaster can then capture builds which fail very early
in the build process (e.g. due to bitbake misconfiguration or bad targets) and
display them intelligibly.
Note that I sent this patch with a covering letter so I could include testing instructions without polluting the patch.
Elliot
Quoted 52 lines
To test, try the following on the command line:
1. Set an invalid MACHINE in
conf/local.confand do a build of a valid target, e.g. bitbake zlib.
2. Set an invalid DISTRO inconf/local.confand do a build of a valid target, e.g. bitbake zlib.
3. Try to build an invalid target, e.g. bitbake zzz.In all cases, the "all builds" pages should show the failed command line builds. Note that fixing bug 8443 will improve how we show these early failed builds.
Related bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8440
Changes since c0fe43b (toaster-next) are in
git://git.yoctoproject.org/poky-contrib,
elliot/toaster/failed_builds-8440-v5http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=elliot/toaster/failed_builds-8440-v5
Elliot Smith (1):
toaster: create Build object earlier in bitbake processingbitbake/lib/bb/event.py | 7 +++ bitbake/lib/bb/server/xmlrpc.py | 3 + bitbake/lib/bb/ui/buildinfohelper.py | 73 ++++++++++------------ bitbake/lib/bb/ui/toasterui.py | 21 ++++--- .../orm/migrations/0005_remove_build_build_name.py | 18 ++++++ bitbake/lib/toaster/orm/models.py | 1 - 6 files changed, 73 insertions(+), 50 deletions(-) create mode 100644
bitbake/lib/toaster/orm/migrations/0005_remove_build_build_name.py--
Elliot Smith
Software Engineer
Intel OTC---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47This 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.
Signature · 3 lines
Elliot Smith Software Engineer Intel Open Source Technology Centre