Fix SDK downloads for builds
cover Fix SDK downloads for builds
Artifacts could not be downloaded for a build as they were not being listed. It was not possible to download them manually either, as the artifact download code was broken for SDK artifacts produced by command line builds.
Fix how toaster.bbclass hooks onto bitbake's build tasks, so that the SDK artifacts are picked up after do_populate_sdk runs.
Fix Toaster code for returning SDK artifacts in HTTP responses.
Changes since 81850bb (toaster-next) are ingit://git.yoctoproject.org/poky-contrib, elliot/toaster/sdk_artifacts-7603
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=elliot/toaster/sdk_artifacts-7603
NB one of the commits on this branch (61e93de) has been submitted to oe-core:
http://lists.openembedded.org/pipermail/openembedded-core/2016-January/115366.html
This patch set contains the other commits on the branch.
Related bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7603
To test:
1. Ensure that your database has no build artifacts in it, either by removing the database, clearing the relevant table with SQL via the command line (delete from orm_buildartifact), or removing the objects via the Django shell (orm.models.BuildArtifact.objects.all().delete()).
Note that the current behaviour, where we only associate SDK artifacts with the first build which produces them, has not been modified. So if you have already run a build and have files in tmp/deploy/sdk associated with it, subsequent builds will not be associated with those files.
2. Start a new build from the command line or Toaster, invoking the populate_sdk target:
# command line bitbake -c populate_sdk core-image-minimal
# Toaster
run a build like "core-image-minimal:populate_sdk"
3. View the build dashboard for the build when it completes and ensure it contains an "Other artifacts" section, as shown in the bug report.
4. Click on one of the "Other artifact" links and ensure that the artifact downloads correctly.
As this code slightly modifies all other artifact downloads, you could also check downloads for the following, too:
* cooker logs
* task logs
* image files
* licence manifests
Elliot Smith (3):
toaster: toasterui Listen for bb.event.MetadataEvent
toaster: toasterui Log OSErrorException metadata events
toaster: toastergui Make artifact download more robust
bitbake/lib/bb/ui/toasterui.py | 5 +- .../toastergui/templates/unavailable_artifact.html | 13 ++- bitbake/lib/toaster/toastergui/views.py | 100 +++++++++------------ 3 files changed, 51 insertions(+), 67 deletions(-)
--
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/3 toaster: toasterui Listen for bb.event.MetadataEvent
The event mask for toasterui doesn't include MetadataEvents. This means that we're missing the ArtifactFileSize event (among others), which is the one we use to populate the SDK artifact table.
Add that event type to the toasterui event mask so we can record SDK artifacts as they are created.
[YOCTO #7603]
--- bitbake/lib/bb/ui/toasterui.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
bitbake/lib/bb/ui/toasterui.py +2 -1
@@ -99,7 +99,8 @@ _evt_list = [ "bb.runqueue.runQueueExitWait", "bb.event.LogExecTTY", "logging.Lo "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.BuildBase", "bb.build.TaskStarted", "bb.build.TaskSucceeded", "bb.build.TaskFailedSilent", + "bb.event.MetadataEvent"] def main(server, eventHandler, params): # set to a logging.FileHandler instance when a build starts;
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.
PATCH 2/3 toaster: toasterui Log OSErrorException metadata events
In reply to Elliot SmithOSErrors occurring in toaster.bbclass are converted to OSErrorException metadata events. They were then being swallowed as unprocessed events by toasterui, which made them difficult to spot.
Explicitly catch OSErrorException events and log them so they are easier to spot and debug.
--- bitbake/lib/bb/ui/toasterui.py | 2 ++ 1 file changed, 2 insertions(+)
bitbake/lib/bb/ui/toasterui.py +2 -0
@@ -366,6 +366,8 @@ def main(server, eventHandler, params): buildinfohelper.store_license_manifest_path(event) elif event.type == "SetBRBE": buildinfohelper.brbe = buildinfohelper._get_data_from_event(event) + elif event.type == "OSErrorException": + logger.error(event) else: logger.error("Unprocessed MetadataEvent %s ", str(event)) continue
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.
PATCH 3/3 toaster: toastergui Make artifact download more robust
In reply to Elliot SmithWhen an artifact download is requested, Toaster goes through a convoluted series of conditions to decide which file to push to the response. In the case of build artifact downloads for command line builds, this caused an ugly exception, as command line builds don't have a build request.
To simplify and catch more corner cases, remove the code which fetches files via the build environment (we only support the local build environment anyway). Then push all requests along a single path, catching any missing file errors, missing object errors or poorly-formed URLs in a single except clause which always returns a valid response.
Also modify the text on the "unavailable artifact" page so it says that the artifact doesn't exist, rather than it "no longer" exists (exceptions may occur because an invalid artifact was requested, rather than an artifact which was removed).
[YOCTO #7603]
--- .../toastergui/templates/unavailable_artifact.html | 13 ++- bitbake/lib/toaster/toastergui/views.py | 100 +++++++++------------ 2 files changed, 47 insertions(+), 66 deletions(-)
bitbake/lib/toaster/toastergui/templates/unavailable_artifact.html +6 -7
@@ -3,15 +3,14 @@ {% load humanize %} {% load static %} -{% block title %} Build artifact no longer exists - Toaster {% endblock %} +{% block title %} Build artifact does not exist - Toaster {% endblock %} {% block pagecontent %} - -<div class="row-fluid air"> - <div class="alert alert-info span8 lead"> - <p"> The build artifact you are trying to download no longer exists.</p> - <p><a href="javascript:window.history.back()">Back to previous page</a></p> + <div class="row-fluid air"> + <div class="alert alert-info span8 lead"> + <p>The build artifact you are trying to download does not exist.</p> + <p><a href="javascript:window.history.back()">Back to previous page</a></p> + </div> </div> -</div> {% endblock %}
bitbake/lib/toaster/toastergui/views.py +41 -59
132 lines not on this page · raw message
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.