1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 13:29:49 +00:00

bitbake: toastergui: implement UI changes to allow file download

This patchset adds download links in the build analisys pages
if toaster runs in managed mode. This allows the user to access
data directly from the web interface.

[YOCTO #6837]

(Bitbake rev: 6000e1ae5c846e51932ecd0dc21e0fa02eb10357)

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexandru DAMIAN
2014-12-05 15:19:55 +00:00
committed by Richard Purdie
parent 85a17f86ea
commit aa9816ad79
11 changed files with 277 additions and 136 deletions
@@ -3,14 +3,14 @@
<html lang="en"> <html lang="en">
<head> <head>
<title>{% if objectname %} {{objectname|title}} - {% endif %}Toaster</title> <title>{% if objectname %} {{objectname|title}} - {% endif %}Toaster</title>
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}" type="text/css"> <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}" type="text/css"/>
<link rel="stylesheet" href="{% static 'css/bootstrap-responsive.min.css' %}" type='text/css'> <link rel="stylesheet" href="{% static 'css/bootstrap-responsive.min.css' %}" type='text/css'/>
<link rel="stylesheet" href="{% static 'css/font-awesome.min.css' %}" type='text/css'> <link rel="stylesheet" href="{% static 'css/font-awesome.min.css' %}" type='text/css'/>
<link rel="stylesheet" href="{% static 'css/prettify.css' %}" type='text/css'> <link rel="stylesheet" href="{% static 'css/prettify.css' %}" type='text/css'/>
<link rel="stylesheet" href="{% static 'css/default.css' %}" type='text/css'> <link rel="stylesheet" href="{% static 'css/default.css' %}" type='text/css'/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<script src="{% static 'js/jquery-2.0.3.min.js' %}"> <script src="{% static 'js/jquery-2.0.3.min.js' %}">
</script> </script>
<script src="{% static 'js/jquery.cookie.js' %}"> <script src="{% static 'js/jquery.cookie.js' %}">
@@ -64,7 +64,7 @@
</div> </div>
<!-- New build popover --> <!-- New build popover -->
<div class="btn-group pull-right" id="new-build-button"> <div class="btn-group pull-right" id="new-build-button">
<button class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <button class="btn dropdown-toggle" data-toggle="dropdown">
New build New build
<i class="icon-caret-down"></i> <i class="icon-caret-down"></i>
</button> </button>
@@ -78,7 +78,7 @@
</span> </span>
<form id="change-project-form" style="display:none;"> <form id="change-project-form" style="display:none;">
<div class="input-append"> <div class="input-append">
<input type="text" class="input-medium" id="project-name-input" placeholder="Type a project name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead"> <input type="text" class="input-medium" id="project-name-input" placeholder="Type a project name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead"/>
<button id="save-project-button" class="btn" type="button">Save</button> <button id="save-project-button" class="btn" type="button">Save</button>
<a href="#" id="cancel-change-project" class="btn btn-link">Cancel</a> <a href="#" id="cancel-change-project" class="btn btn-link">Cancel</a>
</div> </div>
@@ -92,7 +92,7 @@
<li id="targets-form"> <li id="targets-form">
<h6>Target(s):</h6> <h6>Target(s):</h6>
<form> <form>
<input type="text" class="input-xlarge" id="build-target-input" placeholder="Type a target name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead" > <input type="text" class="input-xlarge" id="build-target-input" placeholder="Type a target name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead" />
<div> <div>
<a class="btn btn-primary" id="build-button" disabled="disabled" data-project-id="{{project.id}}">Build</a> <a class="btn btn-primary" id="build-button" disabled="disabled" data-project-id="{{project.id}}">Build</a>
</div> </div>
@@ -45,11 +45,34 @@
<td class="machine"><a href="{% url "builddashboard" build.id %}">{{build.machine}}</a></td> <td class="machine"><a href="{% url "builddashboard" build.id %}">{{build.machine}}</a></td>
<td class="started_on"><a href="{% url "builddashboard" build.id %}">{{build.started_on|date:"d/m/y H:i"}}</a></td> <td class="started_on"><a href="{% url "builddashboard" build.id %}">{{build.started_on|date:"d/m/y H:i"}}</a></td>
<td class="completed_on"><a href="{% url "builddashboard" build.id %}">{{build.completed_on|date:"d/m/y H:i"}}</a></td> <td class="completed_on"><a href="{% url "builddashboard" build.id %}">{{build.completed_on|date:"d/m/y H:i"}}</a></td>
<td class="failed_tasks error">{% query build.task_build outcome=4 order__gt=0 as exectask%}{% if exectask.count == 1 %}<a href="{% url "task" build.id exectask.0.id %}">{{exectask.0.recipe.name}}.{{exectask.0.task_name}}</a>{% elif exectask.count > 1%}<a href="{% url "tasks" build.id %}?filter=outcome%3A4">{{exectask.count}}</a>{%endif%}</td> <td class="failed_tasks error">
<td class="errors_no">{% if build.errors_no %}<a class="errors_no error" href="{% url "builddashboard" build.id %}#errors">{{build.errors_no}} error{{build.errors_no|pluralize}}</a>{%endif%}</td> {% query build.task_build outcome=4 order__gt=0 as exectask%}
{% if exectask.count == 1 %}
<a href="{% url "task" build.id exectask.0.id %}">{{exectask.0.recipe.name}}.{{exectask.0.task_name}}</a>
{% if MANAGED and build.project %}
<a href="{% url 'build_artifact' build.id "tasklogfile" exectask.0.id %}">
<i class="icon-download-alt" title="" data-original-title="Download task log file"></i>
</a>
{% endif %}
{% elif exectask.count > 1%}
<a href="{% url "tasks" build.id %}?filter=outcome%3A4">{{exectask.count}} task{{exectask.count|pluralize}}</a>
{%endif%}
</td>
<td class="errors_no">
{% if build.errors_no %}
<a class="errors_no error" href="{% url "builddashboard" build.id %}#errors">{{build.errors_no}} error{{build.errors_no|pluralize}}</a>
{% if MANAGED and build.project %}
<a href="{% url 'build_artifact' build.id "cookerlog" build.id %}">
<i class="icon-download-alt" title="" data-original-title="Download build log"></i>
</a>
{% endif %}
{%endif%}
</td>
<td class="warnings_no">{% if build.warnings_no %}<a class="warnings_no warning" href="{% url "builddashboard" build.id %}#warnings">{{build.warnings_no}} warning{{build.warnings_no|pluralize}}</a>{%endif%}</td> <td class="warnings_no">{% if build.warnings_no %}<a class="warnings_no warning" href="{% url "builddashboard" build.id %}#warnings">{{build.warnings_no}} warning{{build.warnings_no|pluralize}}</a>{%endif%}</td>
<td class="time"><a href="{% url "buildtime" build.id %}">{{build.timespent|sectohms}}</a></td> <td class="time"><a href="{% url "buildtime" build.id %}">{{build.timespent|sectohms}}</a></td>
<td class="log">{{build.cooker_log_path}}</td> {% if not MANAGED or not build.project %}
<td class="log">{{build.cooker_log_path}}</td>
{% endif %}
<td class="output"> <td class="output">
{% if build.outcome == build.SUCCEEDED %} {% if build.outcome == build.SUCCEEDED %}
<a href="{%url "builddashboard" build.id%}#images">{{fstypes|get_dict_value:build.id}}</a> <a href="{%url "builddashboard" build.id%}#images">{{fstypes|get_dict_value:build.id}}</a>
@@ -42,9 +42,9 @@
{% if build.toaster_exceptions.count > 0 %} {% if build.toaster_exceptions.count > 0 %}
<div class="row"> <div class="row">
<small class="pull-right"> <small class="pull-right">
<i class="icon-question-sign get-help get-help-blue" title="" data-original-title="Toaster exceptions do not affect your build: only the operation of Toaster"></i> <i class="icon-question-sign get-help get-help-blue" title="" data-original-title="Toaster exceptions do not affect your build: only the operation of Toaster"></i>
<a class="show-exceptions" href="#exceptions">Toaster threw {{build.toaster_exceptions.count}} exception{{build.toaster_exceptions.count|pluralize}}</a> <a class="show-exceptions" href="#exceptions">Toaster threw {{build.toaster_exceptions.count}} exception{{build.toaster_exceptions.count|pluralize}}</a>
</small> </small>
</div> </div>
{% endif %} {% endif %}
</div> </div>
@@ -54,6 +54,9 @@
<div class="accordion span10 pull-right" id="errors"> <div class="accordion span10 pull-right" id="errors">
<div class="accordion-group"> <div class="accordion-group">
<div class="accordion-heading"> <div class="accordion-heading">
{% if MANAGED and build.project %}
<a class="btn btn-large pull-right" href="{% url 'build_artifact' build.id "cookerlog" build.id %}" style="margin:15px;">Download build log</a>
{% endif %}
<a class="accordion-toggle error toggle-errors"> <a class="accordion-toggle error toggle-errors">
<h2 id="error-toggle"> <h2 id="error-toggle">
<i class="icon-minus-sign"></i> <i class="icon-minus-sign"></i>
@@ -66,13 +69,10 @@
<div class="span10"> <div class="span10">
{% for error in logmessages %}{% if error.level == 2 %} {% for error in logmessages %}{% if error.level == 2 %}
<div class="alert alert-error"> <div class="alert alert-error">
{% if MANAGED and error.pathname %}
<pre><a href="{% url 'build_artifact' build.pk 'logmessagefile' error.pk %}" target="_blanc">{{error.message}}</pre>
{% else %}
<pre>{{error.message}}</pre> <pre>{{error.message}}</pre>
{% endif %}
</div> </div>
{% endif %}{% endfor %} {% endif %}
{% endfor %}
</div> </div>
</div> </div>
</div> </div>
@@ -84,21 +84,21 @@
<!-- built images --> <!-- built images -->
{% if hasImages %} {% if hasImages %}
<div class="row-fluid span10 pull-right"> <div class="row-fluid span10 pull-right">
<h2>Images</h2> <h2>Images</h2>
{% for target in targets %} {% for target in targets %}
{% if target.target.is_image %} {% if target.target.is_image %}
<div class="well dashboard-section"> <div class="well dashboard-section">
<h3><a href="{% url 'target' build.pk target.target.pk %}">{{target.target}}</a> <h3><a href="{% url 'target' build.pk target.target.pk %}">{{target.target}}</a>
</h3> </h3>
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>Packages included</dt> <dt>Packages included</dt>
<dd><a href="{% url 'target' build.pk target.target.pk %}">{{target.npkg}}</a></dd> <dd><a href="{% url 'target' build.pk target.target.pk %}">{{target.npkg}}</a></dd>
<dt>Total package size</dt> <dt>Total package size</dt>
<dd>{{target.pkgsz|filtered_filesizeformat}}</dd> <dd>{{target.pkgsz|filtered_filesizeformat}}</dd>
{% if target.targetHasNoImages %} {% if target.targetHasNoImages %}
</dl> </dl>
<div class="row-fluid"> <div class="row-fluid">
<div class="alert alert-info span7"> <div class="alert alert-info span7">
<p> <p>
<b>This build did not create any image files</b> <b>This build did not create any image files</b>
</p> </p>
@@ -111,30 +111,45 @@
license manifest information</a> in Toaster. license manifest information</a> in Toaster.
</p> </p>
</div> </div>
</div> </div>
{% else %} {% else %}
<dt> <dt>
<i class="icon-question-sign get-help" title="The location in disk of the license manifest, a document listing all packages installed in your image and their licenses"></i> <i class="icon-question-sign get-help" title="The location in disk of the license manifest, a document listing all packages installed in your image and their licenses"></i>
<a href="{% url 'targetpkg' build.pk target.target.pk %}">License manifest</a>
</dt> {% if MANAGED and build.project %}
<dd><code>{{target.target.license_manifest_path}}</code></dd> License manifest
<dt> {% else %}
<i class="icon-question-sign get-help" title="Image files are stored in <code>/build/tmp/deploy/images/</code>"></i> <a href="{% url 'targetpkg' build.pk target.target.pk %}">License manifest</a>
Image files {% endif %}
</dt> </dt>
<dd> {% if MANAGED and build.project %}
<ul> <dd>
<a href="{% url 'targetpkg' build.pk target.target.pk %}">View in Toaster</a> |
<a href="{% url 'build_artifact' build.pk 'licensemanifest' target.target.pk %}">Download</a></dd>
{% else %}
<dd><code>{{target.target.license_manifest_path}}</code></dd>
{% endif %}
<dt>
<i class="icon-question-sign get-help" title="Image files are stored in <code>/build/tmp/deploy/images/</code>"></i>
Image files
</dt>
<dd>
<ul>
{% for i in target.imageFiles %} {% for i in target.imageFiles %}
<li>{{i.path}} {% if build.project %}
({{i.size|filtered_filesizeformat}})</li> <li><a href="{% url 'build_artifact' build.pk 'imagefile' i.id %}">{{i.path}}</a>
{% else %}
<li>{{i.path}}
{% endif %}
({{i.size|filtered_filesizeformat}})</li>
{% endfor %} {% endfor %}
</ul> </ul>
</dd> </dd>
</dl> </dl>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
@@ -142,6 +157,35 @@
<!-- error dump --> <!-- error dump -->
{%endif%} {%endif%}
<!-- other artifacts -->
{% if build.buildartifact_set.all.count > 0 %}
<div class="row-fluid span10 pull-right">
<h2>Other artifacts</h2>
<div class="well dashboard-section">
<dl class="dl-horizontal">
<dt>
<i class="icon-question-sign get-help" title="Build artifacts discovered in <i>tmp/deploy/images</i>. Usually kernel images and kernel modules."></i>
Other artifacts</dt>
<dd><div>
{% for ba in build.buildartifact_set.all|dictsort:"file_name" %}
{% if MANAGED and build.project %}
<a href="{%url 'build_artifact' build.id 'buildartifact' ba.id %}">
{% endif %}
{{ba.get_local_file_name}}
{% if MANAGED and build.project %}
</a>
{% endif %}
({{ba.file_size|filtered_filesizeformat}}) <br/>
{% endfor %}
</div>
</dd>
</div>
</div>
{% endif %}
<!-- build summary --> <!-- build summary -->
<div class="row-fluid span10 pull-right"> <div class="row-fluid span10 pull-right">
<h2>Build summary</h2> <h2>Build summary</h2>
@@ -158,12 +202,19 @@
<dl> <dl>
{% query build.task_build outcome=4 order__gt=0 as exectask%} {% query build.task_build outcome=4 order__gt=0 as exectask%}
{% if exectask.count > 0 %} {% if exectask.count > 0 %}
<dt>Failed tasks</td> <dt>Failed tasks</dt>
<dd> <dd>
{% if exectask.count == 1 %} {% if exectask.count == 1 %}
<a class="error" href="{% url "task" build.id exectask.0.id %}"> <a class="error" href="{% url "task" build.id exectask.0.id %}">
{{exectask.0.recipe.name}} {{exectask.0.recipe.name}}
<span class="task-name">{{exectask.0.task_name}}</span> <span class="task-name">{{exectask.0.task_name}}</span>
{% if MANAGED and build.project %}
<a href="{% url 'build_artifact' build.id "tasklogfile" exectask.0.id %}">
<i class="icon-download-alt" title="" data-original-title="Download task log file"></i>
</a>
{% endif %}
</a> </a>
{% elif exectask.count > 1%} {% elif exectask.count > 1%}
<a class="error" href="{% url "tasks" build.id %}?filter=outcome%3A4">{{exectask.count}}</a> <a class="error" href="{% url "tasks" build.id %}?filter=outcome%3A4">{{exectask.count}}</a>
@@ -50,7 +50,9 @@
<th>Layer</th> <th>Layer</th>
<th>Layer branch</th> <th>Layer branch</th>
<th>Layer commit</th> <th>Layer commit</th>
<th>Layer directory</th> {% if not MANAGED or not build.project %}
<th>Layer directory</th>
{% endif %}
</tr> </tr>
</thead> </thead>
<tbody>{% for lv in build.layer_version_build.all|dictsort:"layer.name" %} <tbody>{% for lv in build.layer_version_build.all|dictsort:"layer.name" %}
@@ -61,7 +63,9 @@
<li>{{lv.commit}}</li> </ul>"> <li>{{lv.commit}}</li> </ul>">
{{lv.commit|truncatechars:13}} {{lv.commit|truncatechars:13}}
</a></td> </a></td>
{% if not MANAGED or not build.project %}
<td>{{lv.layer.local_path}}</td> <td>{{lv.layer.local_path}}</td>
{% endif %}
</tr>{% endfor %} </tr>{% endfor %}
</tbody> </tbody>
</table> </table>
@@ -135,11 +135,14 @@
</dt> </dt>
<dd class="iscommit">{{package.recipe.layer_version.commit}}</dd> <dd class="iscommit">{{package.recipe.layer_version.commit}}</dd>
{% if not MANAGED or not build.project %}
<dt> <dt>
Layer directory Layer directory
<i class="icon-question-sign get-help" title="Path to the layer providing the recipe that builds this package"></i> <i class="icon-question-sign get-help" title="Path to the layer providing the recipe that builds this package"></i>
</dt> </dt>
<dd><code>{{package.recipe.layer_version.layer.local_path}}</code></dd> <dd><code>{{package.recipe.layer_version.layer.local_path}}</code></dd>
{% endif %}
</dl> </dl>
</div> <!-- row4 well --> </div> <!-- row4 well -->
{% endblock twocolumns %} {% endblock twocolumns %}
@@ -52,16 +52,19 @@
Layer Layer
</dt> </dt>
<dd>{{layer.name}}</dd> <dd>{{layer.name}}</dd>
{% if not MANAGED or not build.project %}
<dt> <dt>
<i class="icon-question-sign get-help" title="Path to the layer providing the recipe"></i> <i class="icon-question-sign get-help" title="Path to the layer providing the recipe"></i>
Layer directory Layer directory
</dt> </dt>
<dd><code>{{layer.local_path}}</code></dd> <dd><code>{{layer.local_path}}</code></dd>
{% endif %}
<dt> <dt>
<i class="icon-question-sign get-help" title="Path to the recipe .bb file"></i> <i class="icon-question-sign get-help" title="Path to the recipe .bb file"></i>
Recipe file Recipe file
</dt> </dt>
<dd><code>{{object.file_path}}</code></dd> <dd><code>{{object.get_local_path}}</code></dd>
{% if layer_version.branch %} {% if layer_version.branch %}
<dt> <dt>
<i class="icon-question-sign get-help" title="The Git branch of the layer providing the recipe"></i> <i class="icon-question-sign get-help" title="The Git branch of the layer providing the recipe"></i>
@@ -126,6 +129,12 @@
<td> <td>
{% ifnotequal task.sstate_result task.SSTATE_NA %} {% ifnotequal task.sstate_result task.SSTATE_NA %}
<a {{ task|task_color }} href="{% url "task" build.pk task.pk %}">{{task.get_sstate_result_display}}</a> <a {{ task|task_color }} href="{% url "task" build.pk task.pk %}">{{task.get_sstate_result_display}}</a>
{% if MANAGED and build.project and task.outcome = task.OUTCOME_FAILED %}
<a href="{% url 'build_artifact' build.pk "tasklogfile" task.pk %}">
<i class="icon-download-alt" title="" data-original-title="Download task log file"></i>
</a>
{% endif %}
{% endifnotequal %} {% endifnotequal %}
</td> </td>
@@ -98,8 +98,11 @@
{{recipe.layer_version.commit|truncatechars:13}} {{recipe.layer_version.commit|truncatechars:13}}
</a> </a>
</td> </td>
<!-- Layer directory -->
<td class="layer_version__layer__local_path">{{recipe.layer_version.layer.local_path}}</td> {% if not MANAGED or not build.project %}
<!-- Layer directory -->
<td class="layer_version__layer__local_path">{{recipe.layer_version.layer.local_path}}</td>
{% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
@@ -152,9 +152,11 @@
{{package.recipe.layer_version.commit|truncatechars:13}} {{package.recipe.layer_version.commit|truncatechars:13}}
</a> </a>
</td> </td>
<td class="layer_directory"> {% if not MANAGED or not build.project %}
{{ package.recipe.layer_version.layer.local_path }} <td class="layer_directory">
</td> {{ package.recipe.layer_version.layer.local_path }}
</td>
{% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
@@ -24,17 +24,17 @@
{# executed tasks outcome #} {# executed tasks outcome #}
<dl class="dl-horizontal"> <dl class="dl-horizontal">
{% if task.logfile %} {% if task.logfile %}
{% if MANAGED and build.project %}
<a class="btn btn-large" href="{% url 'build_artifact' build.id "tasklogfile" task.pk %}" style="margin:15px;">Download task log</a>
{% else %}
<dt> <dt>
<i class="icon-question-sign get-help" title="Path the task log file"></i> Log file <i class="icon-question-sign get-help" title="Path the task log file"></i> Log file
</dt> </dt>
<dd> <dd>
{% if MANAGED %} <code>{{task.logfile}}</code>
<code><a href="{% url 'build_artifact' build.pk 'tasklogfile' task.pk %}" target="_blanc">{{task.logfile}}</a></code>
{% else %}
<code>{{task.logfile}}</code>
{% endif %}
</dd> </dd>
{% endif %} {% endif %}
{% endif %}
{# show stack trace for failed task #} {# show stack trace for failed task #}
{% if task.outcome == task.OUTCOME_FAILED and log_head %} {% if task.outcome == task.OUTCOME_FAILED and log_head %}
<h3>Python stack trace</h3> <h3>Python stack trace</h3>
@@ -191,6 +191,9 @@
<strong>Failed</strong> to restore output from sstate cache. The file was found but could not be unpacked. <strong>Failed</strong> to restore output from sstate cache. The file was found but could not be unpacked.
</div> </div>
<dl class="dl-horizontal"> <dl class="dl-horizontal">
{% if MANAGED and build.project %}
<a href="{% url 'build_artifact' build.id "tasklogfile" task.pk %}" style="margin:15px;">Download log</a>
{% else %}
<dt> <dt>
<i class="icon-question-sign get-help" title="Path to the cache attempt log file"></i> <i class="icon-question-sign get-help" title="Path to the cache attempt log file"></i>
Log file Log file
@@ -201,6 +204,7 @@
Time (secs) Time (secs)
</dt> </dt>
<dd>{{task.elapsed_time|format_none_and_zero}}</dd> <dd>{{task.elapsed_time|format_none_and_zero}}</dd>
{% endif %}
</dl> </dl>
<div class="alert alert-info"> <div class="alert alert-info">
Running the real task instead. Running the real task instead.
@@ -94,6 +94,11 @@
<td class="outcome"> <td class="outcome">
<a href="{%url "task" build.pk task.pk%} ">{{task.get_outcome_display}} </a> <a href="{%url "task" build.pk task.pk%} ">{{task.get_outcome_display}} </a>
<i class="icon-question-sign get-help hover-help" title="{{task.get_outcome_help}}"></i> <i class="icon-question-sign get-help hover-help" title="{{task.get_outcome_help}}"></i>
{% if MANAGED and build.project and task.outcome = task.OUTCOME_FAILED %}
<a href="{% url 'build_artifact' build.pk "tasklogfile" task.pk %}">
<i class="icon-download-alt" title="" data-original-title="Download task log file"></i>
</a>
{% endif %}
</td> </td>
<td class="cache_attempt"> <td class="cache_attempt">
<a href="{%url "task" build.pk task.pk%} ">{{task.get_sstate_result_display|format_none_and_zero}}</a> <a href="{%url "task" build.pk task.pk%} ">{{task.get_sstate_result_display|format_none_and_zero}}</a>
@@ -107,9 +112,12 @@
<td class="disk_io"> <td class="disk_io">
{{task.disk_io|format_none_and_zero}} {{task.disk_io|format_none_and_zero}}
</td> </td>
{% if not MANAGED or not build.project %}
<td class="task_log"> <td class="task_log">
{{task.logfile}} {{task.logfile}}
</td> </td>
{% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
+102 -68
View File
@@ -27,7 +27,7 @@ from django.db import IntegrityError
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable
from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency
from orm.models import Target_Installed_Package, Target_File, Target_Image_File from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact
from django.views.decorators.cache import cache_control from django.views.decorators.cache import cache_control
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
@@ -421,30 +421,36 @@ def builds(request):
'ordericon':_get_toggle_order_icon(request, "timespent"), 'ordericon':_get_toggle_order_icon(request, "timespent"),
'orderkey' : 'timespent', 'orderkey' : 'timespent',
}, },
{'name': 'Log', {'name': 'Image files', 'clclass': 'output',
'dclass': "span4",
'qhelp': "Path to the build main log file",
'clclass': 'log', 'hidden': 1,
'orderfield': _get_toggle_order(request, "cooker_log_path"),
'ordericon':_get_toggle_order_icon(request, "cooker_log_path"),
'orderkey' : 'cooker_log_path',
},
{'name': 'Output', 'clclass': 'output',
'qhelp': "The root file system types produced by the build. You can find them in your <code>/build/tmp/deploy/images/</code> directory", 'qhelp': "The root file system types produced by the build. You can find them in your <code>/build/tmp/deploy/images/</code> directory",
# TODO: compute image fstypes from Target_Image_File # TODO: compute image fstypes from Target_Image_File
}, },
] ]
} }
if not toastermain.settings.MANAGED:
context['tablecols'].insert(-2,
{'name': 'Log1',
'dclass': "span4",
'qhelp': "Path to the build main log file",
'clclass': 'log', 'hidden': 1,
'orderfield': _get_toggle_order(request, "cooker_log_path"),
'ordericon':_get_toggle_order_icon(request, "cooker_log_path"),
'orderkey' : 'cooker_log_path',
}
)
if toastermain.settings.MANAGED: if toastermain.settings.MANAGED:
context['tablecols'].append( context['tablecols'].append(
{'name': 'Project', 'clclass': 'project', {'name': 'Project', 'clclass': 'project',
'filter': {'class': 'project', 'filter': {'class': 'project',
'label': 'Project:', 'label': 'Project:',
'options': map(lambda x: (x.name,'',x.build_set.filter(outcome__lt=Build.IN_PROGRESS).count()), Project.objects.all()), 'options': map(lambda x: (x.name,'',x.build_set.filter(outcome__lt=Build.IN_PROGRESS).count()), Project.objects.all()),
} }
}) }
)
response = render(request, template, context) response = render(request, template, context)
@@ -481,12 +487,8 @@ def builddashboard( request, build_id ):
hasImages = True hasImages = True
npkg = 0 npkg = 0
pkgsz = 0 pkgsz = 0
pid= 0
tp = Target_Installed_Package.objects.filter( target_id = t.id )
package = None package = None
for p in tp: for package in Package.objects.filter(id__in = [x.package_id for x in t.target_installed_package_set.all()]):
pid = p.package_id
package = Package.objects.get( pk = p.package_id )
pkgsz = pkgsz + package.size pkgsz = pkgsz + package.size
if ( package.installed_name ): if ( package.installed_name ):
npkg = npkg + 1 npkg = npkg + 1
@@ -499,7 +501,7 @@ def builddashboard( request, build_id ):
if ( ndx < 0 ): if ( ndx < 0 ):
ndx = 0; ndx = 0;
f = i.file_name[ ndx + 1: ] f = i.file_name[ ndx + 1: ]
imageFiles.append({ 'path': f, 'size' : i.file_size }) imageFiles.append({ 'id': i.id, 'path': f, 'size' : i.file_size })
if ( t.is_image and if ( t.is_image and
(( len( imageFiles ) <= 0 ) or ( len( t.license_manifest_path ) <= 0 ))): (( len( imageFiles ) <= 0 ) or ( len( t.license_manifest_path ) <= 0 ))):
targetHasNoImages = True targetHasNoImages = True
@@ -517,6 +519,8 @@ def builddashboard( request, build_id ):
if ( p.installed_name ): if ( p.installed_name ):
packageCount = packageCount + 1 packageCount = packageCount + 1
logmessages = list(LogMessage.objects.filter( build = build_id ))
context = { context = {
'build' : build, 'build' : build,
'hasImages' : hasImages, 'hasImages' : hasImages,
@@ -524,7 +528,7 @@ def builddashboard( request, build_id ):
'targets' : targets, 'targets' : targets,
'recipecount' : recipeCount, 'recipecount' : recipeCount,
'packagecount' : packageCount, 'packagecount' : packageCount,
'logmessages' : LogMessage.objects.filter( build = build_id ), 'logmessages' : logmessages,
} }
return render( request, template, context ) return render( request, template, context )
@@ -637,6 +641,9 @@ def target_common( request, build_id, target_id, variant ):
Package, queryset, filter_string, search_term, ordering_string, 'name' ) Package, queryset, filter_string, search_term, ordering_string, 'name' )
packages = _build_page_range( Paginator(queryset, pagesize), request.GET.get( 'page', 1 )) packages = _build_page_range( Paginator(queryset, pagesize), request.GET.get( 'page', 1 ))
build = Build.objects.get( pk = build_id )
# bring in package dependencies # bring in package dependencies
for p in packages.object_list: for p in packages.object_list:
p.runtime_dependencies = p.package_dependencies_source.filter( p.runtime_dependencies = p.package_dependencies_source.filter(
@@ -697,8 +704,7 @@ eans multiple licenses exist that cover different parts of the source',
tc_dependencies[ "hidden" ] = 1 tc_dependencies[ "hidden" ] = 1
tc_rdependencies = { tc_rdependencies = {
'name' : 'Reverse dependencies', 'name' : 'Reverse dependencies',
'qhelp' : 'Package run-time reverse dependencies (i.e. which other packages depend on t\ 'qhelp' : 'Package run-time reverse dependencies (i.e. which other packages depend on this package',
his package',
'clclass' : 'brought_in_by', 'clclass' : 'brought_in_by',
} }
if ( variant == 'target' ): if ( variant == 'target' ):
@@ -741,18 +747,10 @@ his package',
'clclass' : 'layer_commit', 'clclass' : 'layer_commit',
'hidden' : 1, 'hidden' : 1,
} }
tc_layerDir = {
'name':'Layer directory',
'qhelp':'Location in disk of the layer providing the recipe that builds the package',
'orderfield' : _get_toggle_order( request, "recipe__layer_version__layer__local_path" ),
'ordericon' : _get_toggle_order_icon( request, "recipe__layer_version__layer__local_path" )\
,
'clclass' : 'layer_directory',
'hidden' : 1,
}
context = { context = {
'objectname': variant, 'objectname': variant,
'build' : Build.objects.filter( pk = build_id )[ 0 ], 'build' : build,
'target' : Target.objects.filter( pk = target_id )[ 0 ], 'target' : Target.objects.filter( pk = target_id )[ 0 ],
'objects' : packages, 'objects' : packages,
'packages_sum' : packages_sum[ 'installed_size__sum' ], 'packages_sum' : packages_sum[ 'installed_size__sum' ],
@@ -771,10 +769,21 @@ his package',
tc_layer, tc_layer,
tc_layerBranch, tc_layerBranch,
tc_layerCommit, tc_layerCommit,
tc_layerDir,
] ]
} }
if not toastermain.settings.MANAGED or build.project is None:
tc_layerDir = {
'name':'Layer directory',
'qhelp':'Location in disk of the layer providing the recipe that builds the package',
'orderfield' : _get_toggle_order( request, "recipe__layer_version__layer__local_path" ),
'ordericon' : _get_toggle_order_icon( request, "recipe__layer_version__layer__local_path" ),
'clclass' : 'layer_directory',
'hidden' : 1,
}
context['tablecols'].append(tc_layerDir)
response = render(request, template, context) response = render(request, template, context)
_save_parameters_cookies(response, pagesize, orderby, request) _save_parameters_cookies(response, pagesize, orderby, request)
return response return response
@@ -1136,12 +1145,13 @@ def tasks_common(request, build_id, variant, task_anchor):
} }
if 'diskio' == variant: tc_diskio['hidden']='0'; del tc_diskio['clclass']; tc_cache['hidden']='1'; if 'diskio' == variant: tc_diskio['hidden']='0'; del tc_diskio['clclass']; tc_cache['hidden']='1';
build = Build.objects.get(pk=build_id)
context = { 'objectname': variant, context = { 'objectname': variant,
'object_search_display': object_search_display, 'object_search_display': object_search_display,
'filter_search_display': filter_search_display, 'filter_search_display': filter_search_display,
'title': title_variant, 'title': title_variant,
'build': Build.objects.get(pk=build_id), 'build': build,
'objects': tasks, 'objects': tasks,
'default_orderby' : orderby, 'default_orderby' : orderby,
'search_term': search_term, 'search_term': search_term,
@@ -1157,9 +1167,12 @@ def tasks_common(request, build_id, variant, task_anchor):
tc_time, tc_time,
tc_cpu, tc_cpu,
tc_diskio, tc_diskio,
tc_log,
]} ]}
if not toastermain.settings.MANAGED or build.project is None:
context['tablecols'].append(tc_log)
response = render(request, template, context) response = render(request, template, context)
_save_parameters_cookies(response, pagesize, orderby, request) _save_parameters_cookies(response, pagesize, orderby, request)
return response return response
@@ -1206,9 +1219,11 @@ def recipes(request, build_id):
revlist.append(recipe_dep) revlist.append(recipe_dep)
revs[recipe.id] = revlist revs[recipe.id] = revlist
build = Build.objects.get(pk=build_id)
context = { context = {
'objectname': 'recipes', 'objectname': 'recipes',
'build': Build.objects.get(pk=build_id), 'build': build,
'objects': recipes, 'objects': recipes,
'default_orderby' : 'name:+', 'default_orderby' : 'name:+',
'recipe_deps' : deps, 'recipe_deps' : deps,
@@ -1279,6 +1294,11 @@ def recipes(request, build_id):
'qhelp':'The Git commit of the layer providing the recipe', 'qhelp':'The Git commit of the layer providing the recipe',
'clclass': 'layer_version__layer__commit', 'hidden': 1, 'clclass': 'layer_version__layer__commit', 'hidden': 1,
}, },
]
}
if not toastermain.settings.MANAGED or build.project is None:
context['tablecols'].append(
{ {
'name':'Layer directory', 'name':'Layer directory',
'qhelp':'Path to the layer prodiving the recipe', 'qhelp':'Path to the layer prodiving the recipe',
@@ -1286,9 +1306,8 @@ def recipes(request, build_id):
'ordericon':_get_toggle_order_icon(request, "layer_version__layer__local_path"), 'ordericon':_get_toggle_order_icon(request, "layer_version__layer__local_path"),
'orderkey' : 'layer_version__layer__local_path', 'orderkey' : 'layer_version__layer__local_path',
'clclass': 'layer_version__layer__local_path', 'hidden': 1, 'clclass': 'layer_version__layer__local_path', 'hidden': 1,
}, })
]
}
response = render(request, template, context) response = render(request, template, context)
_save_parameters_cookies(response, pagesize, orderby, request) _save_parameters_cookies(response, pagesize, orderby, request)
@@ -2685,41 +2704,53 @@ if toastermain.settings.MANAGED:
return render(request, template, context) return render(request, template, context)
def _file_name_for_artifact(b, artifact_type, artifact_id):
file_name = None
# Target_Image_File file_name
if artifact_type == "imagefile":
file_name = Target_Image_File.objects.get(target__build = b, pk = artifact_id).file_name
elif artifact_type == "cookerlog":
file_name = b.cooker_log_path
elif artifact_type == "buildartifact":
file_name = BuildArtifact.objects.get(build = b, pk = artifact_id).file_name
elif artifact_type == "licensemanifest":
file_name = Target.objects.get(build = b, pk = artifact_id).license_manifest_path
elif artifact_type == "tasklogfile":
file_name = Task.objects.get(build = b, pk = artifact_id).logfile
elif artifact_type == "logmessagefile":
file_name = LogMessage.objects.get(build = b, pk = artifact_id).pathname
else:
raise Exception("FIXME: artifact type %s not implemented" % (artifact_type))
return file_name
def build_artifact(request, build_id, artifact_type, artifact_id): def build_artifact(request, build_id, artifact_type, artifact_id):
try: b = Build.objects.get(pk=build_id)
b = Build.objects.get(pk=build_id) if b.buildrequest is None or b.buildrequest.environment is None:
if b.buildrequest is None or b.buildrequest.environment is None: raise Exception("Artifact not available for download (missing build request or build environment)")
raise Exception("Cannot download file")
file_name = None file_name = _file_name_for_artifact(b, artifact_type, artifact_id)
fsock = None fsock = None
content_type='application/force-download' content_type='application/force-download'
# Target_Image_File file_name
# Task logfile
if artifact_type == "tasklogfile":
file_name = Task.objects.get(build = b, pk = artifact_id).logfile
# Task path_to_sstate_obj if file_name is None:
# Package_File path raise Exception("Could not handle artifact %s id %s" % (artifact_type, artifact_id))
# Recipe file_path else:
# VariableHistory file_name content_type = b.buildrequest.environment.get_artifact_type(file_name)
# LogMessage pathname fsock = b.buildrequest.environment.get_artifact(file_name)
if artifact_type == "logmessagefile": file_name = os.path.basename(file_name) # we assume that the build environment system has the same path conventions as host
file_name = LogMessage.objects.get(build = b, pk = artifact_id).pathname
if file_name is not None: response = HttpResponse(fsock, content_type = content_type)
content_type = b.buildrequest.environment.get_artifact_type(file_name)
fsock = b.buildrequest.environment.get_artifact(file_name)
file_name = os.path.basename(file_name)
response = HttpResponse(fsock, content_type = content_type) # returns a file from the environment
response['Content-Disposition'] = 'attachment; filename=' + file_name
# returns a file from the environment return response
response['Content-Disposition'] = 'attachment; filename=' + file_name
return response
except:
raise
@@ -2856,3 +2887,6 @@ else:
def projects(request): def projects(request):
raise Exception("page not available in interactive mode") raise Exception("page not available in interactive mode")
def xhr_importlayer(request):
raise Exception("page not available in interactive mode")