[bitbake-devel] [PATCH 7/9] toaster: added file types to the Outputs column in the build
Alex DAMIAN
alexandru.damian at intel.com
Thu Mar 27 16:49:59 UTC 2014
From: David Reyna <David.Reyna at windriver.com>
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]
Signed-off-by: Farrell Wymore <farrell.wymore at windriver.com>
Signed-off-by: David Reyna <David.Reyna at windriver.com>
Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
---
lib/toaster/toastergui/templates/build.html | 6 +++++-
lib/toaster/toastergui/templatetags/projecttags.py | 9 ++++++++
lib/toaster/toastergui/views.py | 24 ++++++++++++++++++++--
3 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/lib/toaster/toastergui/templates/build.html b/lib/toaster/toastergui/templates/build.html
index 38ab2bf..7d13cc8 100644
--- a/lib/toaster/toastergui/templates/build.html
+++ b/lib/toaster/toastergui/templates/build.html
@@ -122,7 +122,11 @@
<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="log">{{build.cooker_log_path}}</td>
- <td class="output">{% if build.outcome == 0 %}{% for t in build.target_set.all %}{% if t.is_image %}<a href="{%url "builddashboard" build.id%}#images">TODO: compute image output fstypes</a>{% endif %}{% endfor %}{% endif %}</td>
+ <td class="output">
+ {% if build.outcome == build.SUCCEEDED %}
+ <a href="{%url "builddashboard" build.id%}#images">{{fstypes|get_dict_value:build.id}}</a>
+ {% endif %}
+ </td>
</tr>
{% endfor %}
diff --git a/lib/toaster/toastergui/templatetags/projecttags.py b/lib/toaster/toastergui/templatetags/projecttags.py
index 76166ca..aa0ba39 100644
--- a/lib/toaster/toastergui/templatetags/projecttags.py
+++ b/lib/toaster/toastergui/templatetags/projecttags.py
@@ -240,3 +240,12 @@ def format_vpackage_namehelp(name):
r += ' title="' + name + ' only has dependency information available.">'
r += '</i>'
return mark_safe(r)
+
+ at 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/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py
index 0f92caf..d323b37 100644
--- a/lib/toaster/toastergui/views.py
+++ b/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
--
1.8.3.2
More information about the bitbake-devel
mailing list