summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster
diff options
context:
space:
mode:
authorDave Lerner <dave.lerner@windriver.com>2014-03-21 13:43:18 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-25 21:32:17 +0000
commit7fa51314bdac0afccf2ddd6f57581eec7d78d57f (patch)
tree9ae3cda5d0ba4c1202eb6e4f725d5f545ce39744 /bitbake/lib/toaster
parent64ba1fa80518cab3fba8d4dd418ebd0e79ebb6d1 (diff)
downloadpoky-7fa51314bdac0afccf2ddd6f57581eec7d78d57f.tar.gz
bitbake: toaster: format packages with size = -1
Packages that have a size of -1 are virtual packages with limited information. Such packages should be suppressed from the package list page for an image. On dependency and reverse dependency lists of package, such packages should appear in muted rows, without links, and with help information. The formatting rules are encapsulated into projecttags filters when possible to minimize tests on size==-1 in the templates. Testing the relevant pages with an HTML5 validator found a stray end tag in package_detail_base which has been fixed in this commit. [YOCTO #5966] (Bitbake rev: 6cdd4067f766ef5680076c33a32b2dc5d622362c) Signed-off-by: Dave Lerner <dave.lerner@windriver.com> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/package_detail_base.html2
-rw-r--r--bitbake/lib/toaster/toastergui/templates/package_included_dependencies.html19
-rw-r--r--bitbake/lib/toaster/toastergui/templates/package_included_reverse_dependencies.html9
-rw-r--r--bitbake/lib/toaster/toastergui/templatetags/projecttags.py21
-rw-r--r--bitbake/lib/toaster/toastergui/views.py2
5 files changed, 46 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/package_detail_base.html b/bitbake/lib/toaster/toastergui/templates/package_detail_base.html
index 79f135cd92..6925aecb4d 100644
--- a/bitbake/lib/toaster/toastergui/templates/package_detail_base.html
+++ b/bitbake/lib/toaster/toastergui/templates/package_detail_base.html
@@ -97,8 +97,8 @@
97 # decision on index search algorithm 97 # decision on index search algorithm
98 <a href="http://layers.openembedded.org" target="_blank"> 98 <a href="http://layers.openembedded.org" target="_blank">
99 <i class="icon-share get-info"></i> 99 <i class="icon-share get-info"></i>
100 {% endcomment %}
101 </a> 100 </a>
101 {% endcomment %}
102 {% endif %} 102 {% endif %}
103 </dd> 103 </dd>
104 104
diff --git a/bitbake/lib/toaster/toastergui/templates/package_included_dependencies.html b/bitbake/lib/toaster/toastergui/templates/package_included_dependencies.html
index 71043ec1ac..c76774ac9c 100644
--- a/bitbake/lib/toaster/toastergui/templates/package_included_dependencies.html
+++ b/bitbake/lib/toaster/toastergui/templates/package_included_dependencies.html
@@ -23,12 +23,19 @@
23 </thead> 23 </thead>
24 <tbody> 24 <tbody>
25 {% for runtime_dep in runtime_deps %} 25 {% for runtime_dep in runtime_deps %}
26 <tr> 26 <tr {{runtime_dep.size|format_vpackage_rowclass}} >
27 {% if runtime_dep.size != -1 %}
27 <td> 28 <td>
28 <a href="{% url 'package_included_detail' build.id target.id runtime_dep.depends_on_id %}"> 29 <a href="{% url 'package_included_detail' build.id target.id runtime_dep.depends_on_id %}">
29 {{runtime_dep.name}} 30 {{runtime_dep.name}}
30 </a> 31 </a>
31 </td> 32 </td>
33 {% else %}
34 <td>
35 {{runtime_dep.name|format_vpackage_namehelp}}
36 </td>
37 {% endif %}
38
32 <td>{{runtime_dep.version}}</td> 39 <td>{{runtime_dep.version}}</td>
33 <td>{{runtime_dep.size|filtered_filesizeformat}}</td> 40 <td>{{runtime_dep.size|filtered_filesizeformat}}</td>
34 </tr> 41 </tr>
@@ -58,12 +65,18 @@
58 <tbody> 65 <tbody>
59 {% for other_dep in other_deps %} 66 {% for other_dep in other_deps %}
60 {% if other_dep.installed %} 67 {% if other_dep.installed %}
61 <tr> 68 <tr {{other_dep.size|format_vpackage_rowclass}}>
69 {% if other_dep.size != -1 %}
62 <td> 70 <td>
63 <a href="{% url 'package_included_detail' build.id target.id other_dep.depends_on_id %}"> 71 <a href="{% url 'package_included_detail' build.id target.id other_dep.depends_on_id %}">
64 {{other_dep.name}} 72 {{other_dep.name}}
65 </a> 73 </a>
66 </td> 74 </td>
75 {% else %}
76 <td>
77 {{other_dep.name|format_vpackage_namehelp}}
78 </td>
79 {% endif %}
67 <td>{{other_dep.version}}</td> 80 <td>{{other_dep.version}}</td>
68 <td>{{other_dep.size|filtered_filesizeformat}}</td> 81 <td>{{other_dep.size|filtered_filesizeformat}}</td>
69 <td> 82 <td>
diff --git a/bitbake/lib/toaster/toastergui/templates/package_included_reverse_dependencies.html b/bitbake/lib/toaster/toastergui/templates/package_included_reverse_dependencies.html
index 0eb39d3f4f..8653ae0fe2 100644
--- a/bitbake/lib/toaster/toastergui/templates/package_included_reverse_dependencies.html
+++ b/bitbake/lib/toaster/toastergui/templates/package_included_reverse_dependencies.html
@@ -28,12 +28,19 @@
28 </thead> 28 </thead>
29 <tbody> 29 <tbody>
30 {% for reverse_dep in reverse_deps|dictsort:"name" %} 30 {% for reverse_dep in reverse_deps|dictsort:"name" %}
31 <tr> 31 <tr {{reverse_dep.size|format_vpackage_rowclass}} >
32 {% if reverse_dep.size != -1 %}
32 <td> 33 <td>
33 <a href="{% url 'package_included_detail' build.id target.id reverse_dep.dependent_id %}"> 34 <a href="{% url 'package_included_detail' build.id target.id reverse_dep.dependent_id %}">
34 {{reverse_dep.name}} 35 {{reverse_dep.name}}
35 </a> 36 </a>
36 </td> 37 </td>
38 {% else %}
39 <td>
40 {{reverse_dep.name|format_vpackage_namehelp}}
41 </td>
42 {% endif %}
43
37 <td>{{reverse_dep.version}}</td> 44 <td>{{reverse_dep.version}}</td>
38 <td>{{reverse_dep.size|filtered_filesizeformat}}</td> 45 <td>{{reverse_dep.size|filtered_filesizeformat}}</td>
39 </tr> 46 </tr>
diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
index 12c2468fa1..34c3c21d20 100644
--- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
+++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
@@ -110,8 +110,14 @@ def format_none_and_zero(value):
110 110
111@register.filter 111@register.filter
112def filtered_filesizeformat(value): 112def filtered_filesizeformat(value):
113 """Change output from fileformatsize to suppress trailing '.0' and change 'bytes' to 'B'
114 """ 113 """
114 If the value is -1 return an empty string. Otherwise,
115 change output from fileformatsize to suppress trailing '.0'
116 and change 'bytes' to 'B'.
117 """
118 if value == -1:
119 return ''
120
115 return filesizeformat(value).replace("bytes", "B").replace(".0", "") 121 return filesizeformat(value).replace("bytes", "B").replace(".0", "")
116 122
117@register.filter 123@register.filter
@@ -228,4 +234,17 @@ def filter_sizeovertotal(package_object, total_size):
228 234
229 return '{:.1%}'.format(float(size)/float(total_size)) 235 return '{:.1%}'.format(float(size)/float(total_size))
230 236
237from django.utils.safestring import mark_safe
238@register.filter
239def format_vpackage_rowclass(size):
240 if size == -1:
241 return mark_safe('class="muted"')
242 return ''
231 243
244@register.filter
245def format_vpackage_namehelp(name):
246 r = name + '&nbsp;'
247 r += '<i class="icon-question-sign get-help hover-help"'
248 r += ' title = "' + name + ' only has dependency information available.">'
249 r += '</i>'
250 return mark_safe(r)
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 92814cef15..d1234fe804 100644
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -425,7 +425,7 @@ def target(request, build_id, target_id):
425 (filter_string, search_term, ordering_string) = _search_tuple(request, Package) 425 (filter_string, search_term, ordering_string) = _search_tuple(request, Package)
426 426
427 # FUTURE: get rid of nested sub-queries replacing with ManyToMany field 427 # FUTURE: get rid of nested sub-queries replacing with ManyToMany field
428 queryset = Package.objects.filter(id__in=Target_Installed_Package.objects.filter(target_id=target_id).values('package_id')) 428 queryset = Package.objects.filter(size__gte=0, id__in=Target_Installed_Package.objects.filter(target_id=target_id).values('package_id'))
429 packages_sum = queryset.aggregate(Sum('installed_size')) 429 packages_sum = queryset.aggregate(Sum('installed_size'))
430 queryset = _get_queryset(Package, queryset, filter_string, search_term, ordering_string) 430 queryset = _get_queryset(Package, queryset, filter_string, search_term, ordering_string)
431 packages = _build_page_range(Paginator(queryset, request.GET.get('count', 25)),request.GET.get('page', 1)) 431 packages = _build_page_range(Paginator(queryset, request.GET.get('count', 25)),request.GET.get('page', 1))