bitbake: toaster: Guard against builds with no targets

Although this probably can't happen in practice (builds without
targets), this constraint is not currently enforced in the data model.

In the unlikely event that a build has no target (e.g. in test cases),
this causes a template rendering error.

Rather than rework the data model, add a guard to the template
to prevent it from rendering the target name if there are no
targets associated with the build.

(Bitbake rev: 4f409d8c01bae898ea142bd1417db99e12067753)

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Elliot Smith 2015-10-15 15:45:15 +03:00 committed by Richard Purdie
parent 65e8bde9f1
commit eb8b2b9ec8
1 changed files with 7 additions and 2 deletions

View File

@ -3,7 +3,12 @@
{% load projecttags %}
{% block parentbreadcrumb %}
{{build.get_sorted_target_list.0.target}} {%if build.target_set.all.count > 1%}(+ {{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|date:"d/m/y H:i"}})
{% if build.get_sorted_target_list.count > 0 %}
{{build.get_sorted_target_list.0.target}}
&nbsp;
{% endif %}
{%if build.target_set.all.count > 1%}(+ {{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|date:"d/m/y H:i"}})
{% endblock %}
{% block buildinfomain %}
@ -62,7 +67,7 @@
<div class="accordion-inner">
<div class="span10">
{% for error in build.errors %}
<div class="alert alert-error">
<div class="alert alert-error" data-error="{{ error.id }}">
<pre>{{error.message}}</pre>
</div>
{% endfor %}