From bae133add9b5a23d9c0f29ecdf2fe0db6f7677c2 Mon Sep 17 00:00:00 2001 From: David Reyna Date: Tue, 25 Mar 2014 10:42:55 -0700 Subject: bitbake: toaster: added file types to the Outputs column in the build The file types are displayed in the Outputs column in the build page. The file types are derived from the target image filenames. [YOCTO #5947] (Bitbake rev: 842abf6759894690d5bc770f4ea2ac15b127e5e2) Signed-off-by: Farrell Wymore Signed-off-by: David Reyna Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- .../lib/toaster/toastergui/templates/build.html | 6 +++++- .../toaster/toastergui/templatetags/projecttags.py | 9 ++++++++ bitbake/lib/toaster/toastergui/views.py | 24 ++++++++++++++++++++-- 3 files changed, 36 insertions(+), 3 deletions(-) (limited to 'bitbake/lib/toaster') diff --git a/bitbake/lib/toaster/toastergui/templates/build.html b/bitbake/lib/toaster/toastergui/templates/build.html index 38ab2bfd7b..7d13cc89a1 100644 --- a/bitbake/lib/toaster/toastergui/templates/build.html +++ b/bitbake/lib/toaster/toastergui/templates/build.html @@ -122,7 +122,11 @@ {% if build.warnings_no %}{{build.warnings_no}} warning{{build.warnings_no|pluralize}}{%endif%} {{build.timespent|sectohms}} {{build.cooker_log_path}} - {% if build.outcome == 0 %}{% for t in build.target_set.all %}{% if t.is_image %}TODO: compute image output fstypes{% endif %}{% endfor %}{% endif %} + + {% if build.outcome == build.SUCCEEDED %} + {{fstypes|get_dict_value:build.id}} + {% endif %} + {% endfor %} diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py index 76166ca945..aa0ba3909e 100644 --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py @@ -240,3 +240,12 @@ def format_vpackage_namehelp(name): r += ' title="' + name + ' only has dependency information available.">' r += '' return mark_safe(r) + +@register.filter +def get_dict_value(dictionary, key): + """ return the value of a dictionary key + """ + try: + return dictionary[key] + except KeyError: + return '' diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 0f92caf56b..d323b37013 100644 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -19,13 +19,13 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -import operator +import operator,re from django.db.models import Q, Sum from django.shortcuts import render, redirect 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 Target_Installed_Package, Target_Image_File +from orm.models import Target_Installed_Package, Target_File, Target_Image_File from django.views.decorators.cache import cache_control from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.http import HttpResponseBadRequest @@ -231,6 +231,25 @@ def builds(request): else: b.eta = 0 + # set up list of fstypes for each build + fstypes_map = {}; + for build in build_info: + targets = Target.objects.filter( build_id = build.id ) + comma = ""; + extensions = ""; + for t in targets: + if ( not t.is_image ): + continue + tif = Target_Image_File.objects.filter( target_id = t.id ) + for i in tif: + s=re.sub('.*tar.bz2', 'tar.bz2', i.file_name) + if s == i.file_name: + s=re.sub('.*\.', '', i.file_name) + if None == re.search(s,extensions): + extensions += comma + s + comma = ", " + fstypes_map[build.id]=extensions + # send the data to the template context = { # specific info for @@ -238,6 +257,7 @@ def builds(request): # TODO: common objects for all table views, adapt as needed 'objects' : build_info, 'objectname' : "builds", + 'fstypes' : fstypes_map, 'search_term' : search_term, 'total_count' : queryset_with_search.count(), # Specifies the display of columns for the table, appearance in "Edit columns" box, toggling default show/hide, and specifying filters for columns -- cgit v1.2.3-54-g00ecf