bitbake: toaster: better display of targets which produced no images

SDK targets (populate_sdk) produce SDK artifacts but no image files.
Currently, these targets appear under the "Images" heading in the
build dashboard, even though they aren't strictly image targets.

Change the heading to "Build artifacts". Also remove the section
which states that a build produced no image files: this is not
correct for populate_sdk targets (those targets don't produce
image files under any circumstances); and other changes mean
that all targets which do produce images will now show those
files.

The check for whether to display the "Build artifacts" section also
needs to change, as we show targets here which didn't produce any
images but did produce SDK artifacts.

[YOCTO #8556]

(Bitbake rev: b4dce68045c4615e7a6a474e952f670721a3b54e)

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: bavery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Elliot Smith 2016-07-12 15:54:53 -07:00 committed by Richard Purdie
parent adbf206526
commit 1027e0e313
2 changed files with 36 additions and 44 deletions

View File

@ -69,11 +69,11 @@
{%if build.outcome == build.SUCCEEDED%} {%if build.outcome == build.SUCCEEDED%}
<!-- built images --> <!-- built images -->
{% if hasImages %} {% if hasArtifacts %}
<h2>Images</h2> <h2>Build artifacts</h2>
{% for target in targets %} {% for target in targets %}
{% if target.target.is_image %} {% if target.target.is_image %}
<div class="well well-transparent dashboard-section"> <div class="well well-transparent dashboard-section" data-artifacts-for-target="{{target.target.pk}}">
<h3><a href="{% url 'target' build.pk target.target.pk %}">{{target.target.target}}</a></h3> <h3><a href="{% url 'target' build.pk target.target.pk %}">{{target.target.target}}</a></h3>
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>Packages included</dt> <dt>Packages included</dt>
@ -81,26 +81,7 @@
<dt>Total package size</dt> <dt>Total package size</dt>
<dd>{{target.pkgsz|filtered_filesizeformat}}</dd> <dd>{{target.pkgsz|filtered_filesizeformat}}</dd>
</dl> </dl>
{% if target.targetHasNoImages %} {% if target.targetHasImages %}
<div class="row">
<div class="col-md-7">
<div class="alert alert-info">
<p>
<strong>This build did not create any image files</strong>
</p>
<p>
This is probably because valid image and license manifest
files from a previous build already exist in your
<code>build/tmp/deploy</code>
directory. You can
also <a href="{% url 'target' build.pk target.target.pk %}">view the
license manifest information</a> in Toaster.
</p>
</div>
</div>
</div>
{% endif %}
{% if not target.targetHasNoImages %}
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt> <dt>
Manifests Manifests
@ -163,7 +144,7 @@
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{%else%} {%else%}
<!-- error dump --> <!-- error dump -->

View File

@ -472,46 +472,57 @@ def builddashboard( request, build_id ):
tgts = Target.objects.filter( build_id = build_id ).order_by( 'target' ); tgts = Target.objects.filter( build_id = build_id ).order_by( 'target' );
# set up custom target list with computed package and image data # set up custom target list with computed package and image data
targets = [ ] targets = []
ntargets = 0 ntargets = 0
targetHasNoImages = False # True if at least one target for this build has an SDK artifact
# or image file
has_artifacts = False
for t in tgts: for t in tgts:
elem = { } elem = {}
elem[ 'target' ] = t elem['target'] = t
target_has_images = False
image_files = []
npkg = 0 npkg = 0
pkgsz = 0 pkgsz = 0
package = None package = None
for package in Package.objects.filter(id__in = [x.package_id for x in t.target_installed_package_set.all()]): for package in Package.objects.filter(id__in = [x.package_id for x in t.target_installed_package_set.all()]):
pkgsz = pkgsz + package.size pkgsz = pkgsz + package.size
if ( package.installed_name ): if package.installed_name:
npkg = npkg + 1 npkg = npkg + 1
elem[ 'npkg' ] = npkg elem['npkg'] = npkg
elem[ 'pkgsz' ] = pkgsz elem['pkgsz'] = pkgsz
ti = Target_Image_File.objects.filter( target_id = t.id ) ti = Target_Image_File.objects.filter(target_id = t.id)
imageFiles = [ ]
for i in ti: for i in ti:
ndx = i.file_name.rfind( '/' ) ndx = i.file_name.rfind('/')
if ( ndx < 0 ): if ndx < 0:
ndx = 0; ndx = 0;
f = i.file_name[ ndx + 1: ] f = i.file_name[ndx + 1:]
imageFiles.append({ image_files.append({
'id': i.id, 'id': i.id,
'path': f, 'path': f,
'size': i.file_size, 'size': i.file_size,
'suffix': i.suffix 'suffix': i.suffix
}) })
if t.is_image and (len(imageFiles) <= 0 or len(t.license_manifest_path) <= 0): if len(image_files) > 0:
targetHasNoImages = True target_has_images = True
elem[ 'imageFiles' ] = imageFiles elem['targetHasImages'] = target_has_images
elem[ 'targetHasNoImages' ] = targetHasNoImages
elem['imageFiles'] = image_files
elem['target_kernel_artifacts'] = t.targetkernelfile_set.all() elem['target_kernel_artifacts'] = t.targetkernelfile_set.all()
target_sdk_files = t.targetsdkfile_set.all() target_sdk_files = t.targetsdkfile_set.all()
elem['target_sdk_artifacts_count'] = target_sdk_files.count() target_sdk_artifacts_count = target_sdk_files.count()
elem['target_sdk_artifacts_count'] = target_sdk_artifacts_count
elem['target_sdk_artifacts'] = target_sdk_files elem['target_sdk_artifacts'] = target_sdk_files
targets.append( elem ) if target_has_images or target_sdk_artifacts_count > 0:
has_artifacts = True
targets.append(elem)
## ##
# how many packages in this build - ignore anonymous ones # how many packages in this build - ignore anonymous ones
@ -528,7 +539,7 @@ def builddashboard( request, build_id ):
context = { context = {
'build' : build, 'build' : build,
'project' : build.project, 'project' : build.project,
'hasImages' : build.has_images(), 'hasArtifacts' : has_artifacts,
'ntargets' : ntargets, 'ntargets' : ntargets,
'targets' : targets, 'targets' : targets,
'recipecount' : recipeCount, 'recipecount' : recipeCount,