Skip to contentSkip to conversation

toaster patchset pull request

PATCH New Alex DAMIAN 1 participant 10 messages Apr 9, 2014

lore
Share & tools
lore
#0 lore raw

cover toaster patchset pull request

From: Alexandru DAMIAN <[email protected]>

Hello,

This is a pull request for toaster.

All the patches have been reviewed on the toaster mailing list. Patches have been tested invidividually and in this patchset.

Can you please pull at your convenience ?

Thank you,
Alex

The following changes since commit 4fafea4fa69542b491e84463f6eae0d5bf645673:

bitbake: knotty: Clear footer before outputting to stderr (2014-04-08 18:05:19 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib adamian/20140409-bb-submission
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=adamian/20140409-bb-submission

Alexandru DAMIAN (3):
toaster: do not load all available timezones
toaster: keep number of rows across searches
toaster: fix filtering query for multiple filters

Dave Lerner (2):
toaster: disable 'size over total' sort
toaster: sort on size in detail pages

David Reyna (4):
toaster: show unique set-in files in configvar
toaster: regex alternation filter caused django error
toaster: hide tasks without order or outcome
toaster: add URI search path list

 lib/toaster/toastergui/static/css/default.css      |   4 +-
 .../toastergui/templates/basetable_top.html        |   1 +
 lib/toaster/toastergui/templates/bpackage.html     |   2 +-
 lib/toaster/toastergui/templates/dirinfo.html      |   2 +-
 .../templates/package_built_dependencies.html      |   8 +-
 .../toastergui/templates/package_built_detail.html |  14 +-
 .../templates/package_included_dependencies.html   |   8 +-
 .../templates/package_included_detail.html         |  14 +-
 .../package_included_reverse_dependencies.html     |  19 +--
 lib/toaster/toastergui/templates/recipe.html       |   4 +-
 lib/toaster/toastergui/templates/tablesort.html    |  38 +++++
 lib/toaster/toastergui/templates/target.html       |   4 +-
 lib/toaster/toastergui/templates/task.html         |   2 +-
 lib/toaster/toastergui/templatetags/projecttags.py |  20 +--
 lib/toaster/toastergui/views.py                    | 158 ++++++++++++++++-----
 lib/toaster/toastermain/settings.py                |  10 +-
 16 files changed, 211 insertions(+), 97 deletions(-)
 create mode 100644 lib/toaster/toastergui/templates/tablesort.html
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/9 toaster: do not load all available timezones

From: Alexandru DAMIAN <[email protected]>

This patch makes sure that we only load pytz-recognized timezones. Pytz is used to transform the timezone information for the database queries, and needs to be able to deal with the TIME_ZONE value that we set up.

[YOCTO #6093]

---
 lib/toaster/toastermain/settings.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
lib/toaster/toastermain/settings.py +9 -1
index e26ee3c..6e9d85d 100644
@@ -64,7 +64,15 @@ else:
     for dirpath, dirnames, filenames in os.walk(ZONEINFOPATH):
         for fn in filenames:
             filepath = os.path.join(dirpath, fn)
-            zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = filepath.lstrip(ZONEINFOPATH).strip()
+            try:
+                import pytz
+                from pytz.exceptions import UnknownTimeZoneError
+                zonename = filepath.lstrip(ZONEINFOPATH).strip()
+                if pytz.timezone(zonename) is not None:
+                    zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename
+            except UnknownTimeZoneError, ValueError:
+                # we expect timezone failures here, just move over
+                pass
 
     TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()]
 
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/9 toaster: disable 'size over total' sort

From: Dave Lerner <[email protected]>

[YOCTO 6061]

Disable size-over-total table column sorts in the image installed packages view because that field is a computed field and only model fields are sortable in the current table toaster implementation.

---
 lib/toaster/toastergui/views.py | 2 --
 1 file changed, 2 deletions(-)
lib/toaster/toastergui/views.py +0 -2
index 910b3b9..96ce4d7 100644
@@ -568,8 +568,6 @@ def target(request, build_id, target_id):
                 {
                     'name':'Size over total (%)',
                     'qhelp':'Proportion of the overall included package size represented by this package',
-                    'orderfield': _get_toggle_order(request, "size"),
-                    'ordericon':_get_toggle_order_icon(request, "size"),
                     'clclass': 'size_over_total',
                     'hidden' : 1,
                 },
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/9 toaster: show unique set-in files in configvar

In reply to Alex DAMIAN

From: David Reyna <[email protected]>

When listing the set-in files in the configure varaible table, only show each file once in that summary view.

[YOCTO #6048]

---
 lib/toaster/toastergui/templatetags/projecttags.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
lib/toaster/toastergui/templatetags/projecttags.py +8 -4
index ee08ab7..aa1ebf8 100644
@@ -164,21 +164,25 @@ def filter_setin_files(file_list,matchstr):
     if search == '':
         for i in range(len(file_list)):   
             if file_list[i].file_name.find(filter) >= 0:
-                htmlstr += file_list[i].file_name + "<p>"
+                if htmlstr.find(file_list[i].file_name + "<p>") < 0:
+                    htmlstr += file_list[i].file_name + "<p>"
         return htmlstr
        
     # match only search string, plus always last file
     if filter == "":
         for i in range(len(file_list)-1):   
             if file_list[i].file_name.find(search) >= 0:
-                htmlstr += file_list[i].file_name + "<p>"
-        htmlstr += file_list[len(file_list)-1].file_name
+                if htmlstr.find(file_list[i].file_name + "<p>") < 0:
+                    htmlstr += file_list[i].file_name + "<p>"
+        if htmlstr.find(file_list[len(file_list)-1].file_name) < 0:
+            htmlstr += file_list[len(file_list)-1].file_name
         return htmlstr
        
     # match filter or search string
     for i in range(len(file_list)):   
         if (file_list[i].file_name.find(filter) >= 0) or (file_list[i].file_name.find(search) >= 0):
-            htmlstr += file_list[i].file_name + "<p>"
+            if htmlstr.find(file_list[i].file_name + "<p>") < 0:
+                htmlstr += file_list[i].file_name + "<p>"
     return htmlstr
 
 
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/9 toaster: keep number of rows across searches

In reply to Alex DAMIAN

From: Alexandru DAMIAN <[email protected]>

This patch will make Toaster remember the selected number of rows to be displayed in tables across different searches.

The number of rows setting will not be remembered if the the user leaves the page and subsequently returns to it.

---
 lib/toaster/toastergui/templates/basetable_top.html | 1 +
 1 file changed, 1 insertion(+)
lib/toaster/toastergui/templates/basetable_top.html +1 -0
index f625901..22c3897 100644
@@ -33,6 +33,7 @@
             <input class="input-xxlarge" id="search" name="search" type="text" placeholder="Search {%if object_search_display %}{{object_search_display}}{%else%}{{objectname}}{%endif%}" value="{{request.GET.search}}"/>{% if request.GET.search %}<a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>{%endif%}
             <input type="hidden" name="orderby" value="{{request.GET.orderby}}">
             <input type="hidden" name="page" value="1">
+            <input type="hidden" name="count" value="{{request.GET.count}}">
             <button class="btn" type="submit" value="Search">Search</button>
         </form>
         <div class="pull-right">
Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/9 toaster: fix filtering query for multiple filters

In reply to Alex DAMIAN

From: Alexandru DAMIAN <[email protected]>

This is a fix for using multiple expressions in filters. Three different issues are touched:
* added an explicit error message for incorrect filter usage
* changed the value separator to something that will pass through from the browser to the actual code
* changed the "and" operator for combining Q from a dubios lambda function to the standard operator.and_

---
 lib/toaster/toastergui/views.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/toaster/toastergui/views.py +3 -3
index 96ce4d7..4ed9940 100644
@@ -80,7 +80,7 @@ def _redirect_parameters(view, g, mandatory_parameters, *args, **kwargs):
     return redirect(url + "?%s" % urllib.urlencode(params), *args, **kwargs)
 
 FIELD_SEPARATOR = ":"
-VALUE_SEPARATOR = ";"
+VALUE_SEPARATOR = "!"
 DESCENDING = "-"
 
 def __get_q_for_val(name, value):
@@ -102,7 +102,7 @@ def _get_filtering_query(filter_string):
     values = search_terms[1].split(VALUE_SEPARATOR)
 
     querydict = dict(zip(keys, values))
-    return reduce(lambda x, y: x & y, map(lambda x: __get_q_for_val(k, querydict[k]),[k for k in querydict]))
+    return reduce(operator.and_, map(lambda x: __get_q_for_val(x, querydict[x]), [k for k in querydict]))
 
 def _get_toggle_order(request, orderkey, reverse = False):
     if reverse:
@@ -128,7 +128,7 @@ def _validate_input(input, model):
 
         # Check we have only one colon
         if len(input_list) != 2:
-            invalid = "We have an invalid number of separators"
+            invalid = "We have an invalid number of separators: " + input + " -> " + str(input_list)
             return None, invalid
 
         # Check we have an equal number of terms both sides of the colon
Signature · 1 line
1.9.1
#6 lore raw

PATCH 6/9 toaster: regex alternation filter caused django error

In reply to Alex DAMIAN

From: David Reyna <[email protected]>

The combination of a regex filter specification that uses alternate, plus a search string, plus multiple search_allowed_fields, leads to a Django fatal error. Replace this regex filter for variables in local files with a simpler 'contains' against the project's directory plus a '/conf/' string.

Alex rebased this on top of fix for #6048.

[YOCTO #5962]

---
 lib/toaster/toastergui/templatetags/projecttags.py |  6 +++---
 lib/toaster/toastergui/views.py                    | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)
lib/toaster/toastergui/templatetags/projecttags.py +3 -3
index aa1ebf8..e863457 100644
@@ -163,7 +163,7 @@ def filter_setin_files(file_list,matchstr):
     # match only filters
     if search == '':
         for i in range(len(file_list)):   
-            if file_list[i].file_name.find(filter) >= 0:
+            if re.search(filter, file_list[i].file_name):
                 if htmlstr.find(file_list[i].file_name + "<p>") < 0:
                     htmlstr += file_list[i].file_name + "<p>"
         return htmlstr
@@ -171,7 +171,7 @@ def filter_setin_files(file_list,matchstr):
     # match only search string, plus always last file
     if filter == "":
         for i in range(len(file_list)-1):   
-            if file_list[i].file_name.find(search) >= 0:
+            if re.search(search,file_list[i].file_name):
                 if htmlstr.find(file_list[i].file_name + "<p>") < 0:
                     htmlstr += file_list[i].file_name + "<p>"
         if htmlstr.find(file_list[len(file_list)-1].file_name) < 0:
@@ -180,7 +180,7 @@ def filter_setin_files(file_list,matchstr):
        
     # match filter or search string
     for i in range(len(file_list)):   
-        if (file_list[i].file_name.find(filter) >= 0) or (file_list[i].file_name.find(search) >= 0):
+        if re.search(filter, file_list[i].file_name) or re.search(search,file_list[i].file_name):
             if htmlstr.find(file_list[i].file_name + "<p>") < 0:
                 htmlstr += file_list[i].file_name + "<p>"
     return htmlstr
lib/toaster/toastergui/views.py +5 -5
index 4ed9940..78726a8 100644
@@ -1154,17 +1154,17 @@ def configvars(request, build_id):
 
     variables = _build_page_range(Paginator(queryset, request.GET.get('count', 50)), request.GET.get('page', 1))
 
+    # show all matching files (not just the last one)
     file_filter= search_term + ":"
-    if filter_string.find('conf/local.conf') > 0:
-        file_filter += 'conf/local.conf'
-    if filter_string.find('conf/bblayers.conf') > 0:
-        file_filter += 'conf/bblayers.conf'
+    if filter_string.find('/conf/') > 0:
+        file_filter += 'conf/(local|bblayers).conf'
     if filter_string.find('conf/machine/') > 0:
         file_filter += 'conf/machine/'
     if filter_string.find('conf/distro/') > 0:
         file_filter += 'conf/distro/'
     if filter_string.find('/bitbake.conf') > 0:
         file_filter += '/bitbake.conf'
+    build_dir=re.sub("/tmp/log/.*","",Build.objects.filter(pk=build_id)[0].cooker_log_path)
 
     context = {
                 'objectname': 'configvars',
@@ -1193,7 +1193,7 @@ def configvars(request, build_id):
                     'class' : 'vhistory__file_name',
                     'label': 'Show:',
                     'options' : [
-                               ('Local configuration variables', 'vhistory__file_name__regex:conf/(local|bblayers).conf', queryset_with_search.filter(vhistory__file_name__regex='conf/(local|bblayers).conf').count(), 'Select this filter to see variables set by the <code>local.conf</code> and <code>bblayers.conf</code> configuration files inside the <code>/build/conf/</code> directory'),
+                               ('Local configuration variables', 'vhistory__file_name__contains:'+build_dir+'/conf/',queryset_with_search.filter(vhistory__file_name__contains=build_dir+'/conf/').count(), 'Select this filter to see variables set by the <code>local.conf</code> and <code>bblayers.conf</code> configuration files inside the <code>/build/conf/</code> directory'),
                                ('Machine configuration variables', 'vhistory__file_name__contains:conf/machine/',queryset_with_search.filter(vhistory__file_name__contains='conf/machine').count(), 'Select this filter to see variables set by the configuration file(s) inside your layers <code>/conf/machine/</code> directory'),
                                ('Distro configuration variables', 'vhistory__file_name__contains:conf/distro/',queryset_with_search.filter(vhistory__file_name__contains='conf/distro').count(), 'Select this filter to see variables set by the configuration file(s) inside your layers <code>/conf/distro/</code> directory'),
                                ('Layer configuration variables', 'vhistory__file_name__contains:conf/layer.conf',queryset_with_search.filter(vhistory__file_name__contains='conf/layer.conf').count(), 'Select this filter to see variables set by the <code>layer.conf</code> configuration file inside your layers'),
Signature · 1 line
1.9.1
#7 lore raw

PATCH 7/9 toaster: hide tasks without order or outcome

In reply to Alex DAMIAN

From: David Reyna <[email protected]>

Hide the incomplete tasks, those without order numbers and/or outcomes.

[YOCTO #6060]

---
 lib/toaster/toastergui/views.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
lib/toaster/toastergui/views.py +8 -5
index 78726a8..f5fa72e 100644
@@ -496,7 +496,8 @@ def task( request, build_id, task_id ):
         context[ 'showing_matches' ] = True
         context[ 'matching_tasks' ] = Task.objects.filter( 
             sstate_checksum=task.sstate_checksum ).filter( 
-            build__completed_on__lt=task.build.completed_on ).order_by('-build__completed_on')
+            build__completed_on__lt=task.build.completed_on).exclude(
+            order__isnull=True).exclude(outcome=Task.OUTCOME_NA).order_by('-build__completed_on')
 
     return render( request, template, context )
 
@@ -509,7 +510,7 @@ def recipe(request, build_id, recipe_id):
     object = Recipe.objects.filter(pk=recipe_id)[0]
     layer_version = Layer_Version.objects.filter(pk=object.layer_version_id)[0]
     layer  = Layer.objects.filter(pk=layer_version.layer_id)[0]
-    tasks  = Task.objects.filter(recipe_id = recipe_id).filter(build_id = build_id).exclude(task_name__endswith='_setscene')
+    tasks  = Task.objects.filter(recipe_id = recipe_id, build_id = build_id).exclude(order__isnull=True).exclude(task_name__endswith='_setscene').exclude(outcome=Task.OUTCOME_NA)
     packages = Package.objects.filter(recipe_id = recipe_id).filter(build_id = build_id).filter(size__gte=0)
 
     context = {
@@ -762,14 +763,16 @@ def dirinfo(request, build_id, target_id, file_path=None):
 def _find_task_dep(task):
     tp = []
     for p in Task_Dependency.objects.filter(task=task):
-        tp.append(p.depends_on);
+        if (p.depends_on.order > 0) and (p.depends_on.outcome != Task.OUTCOME_NA):
+            tp.append(p.depends_on);
     return tp
 
 
 def _find_task_revdep(task):
     tp = []
     for p in Task_Dependency.objects.filter(depends_on=task):
-        tp.append(p.task);
+        if (p.task.order > 0) and (p.task.outcome != Task.OUTCOME_NA):
+            tp.append(p.task);
     return tp
 
 def _find_task_provider(task):
@@ -836,7 +839,7 @@ def tasks_common(request, build_id, variant, task_anchor):
 	        mandatory_parameters['anchor']=task_anchor
         return _redirect_parameters( variant, request.GET, mandatory_parameters, build_id = build_id)
     (filter_string, search_term, ordering_string) = _search_tuple(request, Task)
-    queryset_all = Task.objects.filter(build=build_id, order__gt=0)
+    queryset_all = Task.objects.filter(build=build_id).exclude(order__isnull=True).exclude(outcome=Task.OUTCOME_NA)
     queryset_with_search = _get_queryset(Task, queryset_all, None , search_term, ordering_string, 'order')
     queryset = _get_queryset(Task, queryset_all, filter_string, search_term, ordering_string, 'order')
 
Signature · 1 line
1.9.1
#8 lore raw

PATCH 8/9 toaster: sort on size in detail pages

In reply to Alex DAMIAN

From: Dave Lerner <[email protected]>

[YOCTO 5778]

Implements the features described in the attachment to bugzilla 5778
- new global changes to the format of size data, and
- adding sorts by selected columns to specific detail pages.

Although new pagination and row search capabilities are shown on the screen shots for the 5778 attachment, those features are specified in a different bugzilla entry 5777 and are not implemented in this commit.

Also, the 5778 spec includes table sorting for the recipe package detail page, but sorting for that page was not implemented in this commit due to complications with sorting then returning to a page that is only one URL fragment in a template.

The scope of file changes are described below. Changes to support new 'size' field column formats...
default.css - added sizecol class style (right justified) projecttags.py - changed filtered_filesizeformat to allow
".0" suffixes

Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or <td> size columns were made to...
dirinfo.py,
package_built_dependencies.html, package_included_dependencies.html,
recipe.html,
bpackage.html, and
target.html

More significant changes to support detail page table sorting are:
- tablesort.html: New created to implement the sort icons, directions, and table headings, and
suppress sort handling if 'disable_sort' in context, without search or pagination elements ingrained
in basetable_top. Confining the changes to this small file reduces the impact (testing and risk) on the larger set of files that arleady include basetable_top/bottom files.
- view.py: Modified the following view functions with
- trivial changes for size formatting to the views: target,
- changes to package_built_detail, package_included_detail, package_included_reverse_dependencies to handle the sorting implementation as well as moving headings and size formatting for size columns from templates to the views.
- Implementation of the detail sorting using above in:
package_built_detail.html, package_included_detail.html, and package_included_reverse_dependencies.html
to include the tablesort heading setup, format the size column, and iterate over the new sorted objects, suppressing sorts if table row count less than 2.

---
 lib/toaster/toastergui/static/css/default.css      |   4 +-
 lib/toaster/toastergui/templates/bpackage.html     |   2 +-
 lib/toaster/toastergui/templates/dirinfo.html      |   2 +-
 .../templates/package_built_dependencies.html      |   8 +-
 .../toastergui/templates/package_built_detail.html |  14 +--
 .../templates/package_included_dependencies.html   |   8 +-
 .../templates/package_included_detail.html         |  14 +--
 .../package_included_reverse_dependencies.html     |  19 ++--
 lib/toaster/toastergui/templates/recipe.html       |   4 +-
 lib/toaster/toastergui/templates/tablesort.html    |  38 +++++++
 lib/toaster/toastergui/templates/target.html       |   4 +-
 lib/toaster/toastergui/templatetags/projecttags.py |   2 +-
 lib/toaster/toastergui/views.py                    | 115 ++++++++++++++++-----
 13 files changed, 161 insertions(+), 73 deletions(-)
 create mode 100644 lib/toaster/toastergui/templates/tablesort.html
lib/toaster/toastergui/static/css/default.css +3 -1
index e33f177..2c283fe 100644
@@ -62,6 +62,9 @@ td a:hover { color: #000000; text-decoration: underline; }
 .table tbody tr.error > td { background-color: #FFFFFF; } /* override default Bootstrap behaviour */
 .table-hover tbody tr.error:hover > td { background-color: #F5F5F5;} /* override default Bootstrap behaviour */
 
+/* Right justify Bootstrap table columns for size fields */
+.table .sizecol { text-align: right; }
+
 /* Set error, warning, success and muted styles */
 .error, .red, td.error a, tr.error a { color: #b94a48; }
 a.error:hover, a.error:focus, tr.error a:hover { color: #943A38; text-decoration: underline; }
@@ -127,4 +130,3 @@ select { width: auto; }
 
 
 
-
lib/toaster/toastergui/templates/bpackage.html +1 -1
index c6ec634..2d4948b 100644
@@ -64,7 +64,7 @@
         <!-- Package Version -->
         <td>{%if package.version%}<a href="{% url "package_built_detail" build.pk package.pk %}">{{package.version}}-{{package.revision}}</a>{%endif%}</td>
         <!-- Package Size -->
-        <td class="size">{{package.size|filtered_filesizeformat}}</td>
+        <td class="size sizecol">{{package.size|filtered_filesizeformat}}</td>
         <!-- License -->
         <td class="license">{{package.license}}</td>
 
lib/toaster/toastergui/templates/dirinfo.html +1 -1
index 9b76a1c..749ae24 100644
@@ -76,7 +76,7 @@
 
         /* setup td specific formatting */
         var link_to = td(o.link_to);
-        var size = td(o.size);
+        var size = '<td class = "sizecol">' + o.size + '</td>'
         var permission = td(o.permission);
         var owner = td(o.owner);
         var group = td(o.group);
lib/toaster/toastergui/templates/package_built_dependencies.html +4 -4
index 4e86da5..a0c5a1e 100644
@@ -31,7 +31,7 @@
                         <tr>
                             <th>Package</th>
                             <th>Version</th>
-                            <th>Size</th>
+                            <th class="sizecol span2">Size</th>
                         </tr>
                     </thead>
                     <tbody>
@@ -49,7 +49,7 @@
                             </td>
                             {% endif %}
                             <td>{{runtime_dep.version}}</td>
-                            <td>{{runtime_dep.size|filtered_filesizeformat}}</td>
+                            <td class="sizecol">{{runtime_dep.size|filtered_filesizeformat}}</td>
                         </tr>
 						{% endfor %}
                     </tbody>
@@ -62,7 +62,7 @@
                         <tr>
                             <th>Package</th>
                             <th>Version</th>
-                            <th>Size</th>
+                            <th class="sizecol span2">Size</th>
                             <th>
                                 <i class="icon-question-sign get-help" title="Five relationship types exist: recommends, suggests, provides, replaces and conflicts"></i>
                                 Relationship type
@@ -84,7 +84,7 @@
                             </td>
                         {% endif %}
                             <td>{{other_dep.version}}</td>
-                            <td>{{other_dep.size|filtered_filesizeformat}}</td>
+                            <td class="sizecol">{{other_dep.size|filtered_filesizeformat}}</td>
                             <td>
                                 {{other_dep.dep_type_display}}
                                 <i class="icon-question-sign get-help hover-help" title="{{other_dep.dep_type_help}}" ></i>
lib/toaster/toastergui/templates/package_built_detail.html +4 -10
index 3aa1b2a..0fe0116 100644
@@ -23,18 +23,12 @@
                 <div class="alert alert-info">
                     <strong>{{package.fullpackagespec}}</strong> is <strong>not included</strong> in any image. This page shows you the files added to an image root file system if you include <strong>{{package.fullpackagespec}}</strong> in future builds.
                 </div>
-                <table class="table table-bordered table-hover">
-                    <thead>
-                        <tr>
-                            <th>File</th>
-                            <th>Size</th>
-                        </tr>
-                    </thead>
+                {% include "tablesort.html" %}
                     <tbody>
-						{% for file in package.buildfilelist_package.all|dictsort:"path" %}
+						{% for file in objects %}
                             <tr>
-                                <td>{{file.path}}</td>
-                                <td>{{file.size|filtered_filesizeformat}}</td>
+                                <td class="path">{{file.path}}</td>
+                                <td class="filesize sizecol">{{file.size|filtered_filesizeformat}}</td>
                             </tr>
 						{% endfor %}
                     </tbody>
lib/toaster/toastergui/templates/package_included_dependencies.html +4 -4
index 9169ee9..642ca69 100644
@@ -20,7 +20,7 @@
                     <tr>
                         <th>Package</th>
                         <th>Version</th>
-                        <th>Size</th>
+                        <th class='sizecol span2'>Size</th>
                     </tr>
                 </thead>
                 <tbody>
@@ -39,7 +39,7 @@
                             </td>
                             {% endif %}
                             <td>{{runtime_dep.version}}&nbsp;</td>
-                            <td>{{runtime_dep.size|filtered_filesizeformat}}&nbsp;</td>
+                            <td class='sizecol'>{{runtime_dep.size|filtered_filesizeformat}}&nbsp;</td>
                         </tr>
 					{% endfor %}
                  </tbody>
@@ -57,7 +57,7 @@
                     <tr>
                         <th>Package</th>
                         <th>Version</th>
-                        <th>Size</th>
+                        <th class='sizecol span2'>Size</th>
                         <th>
                             <i class="icon-question-sign get-help" title="Five relationship types exist: recommends, suggests, provides, replaces and conflicts"></i>
                             Relationship type
@@ -83,7 +83,7 @@
                                     </td>
                                 {% endif %}
                                 <td>{{other_dep.version}}&nbsp;</td>
-                                <td>{{other_dep.size|filtered_filesizeformat}}&nbsp;</td>
+                                <td class='sizecol'>{{other_dep.size|filtered_filesizeformat}}&nbsp;</td>
                                 <td>
                                     {{other_dep.dep_type_display}}
                                     <i class="icon-question-sign get-help hover-help" title="{{other_dep.dep_type_help}}" ></i>
lib/toaster/toastergui/templates/package_included_detail.html +4 -10
index e89ebdf..d2aa26e 100644
@@ -17,22 +17,16 @@
     <div class="tab-content">
         <div class="tab-pane active" id="files">
             {% if packageFileCount > 0 %}
-            <table class="table table-bordered table-hover">
-                <thead>
-                    <tr>
-                        <th>File</th>
-                        <th>Size</th>
-                    </tr>
-                </thead>
+            {% include "tablesort.html" %}
                 <tbody>
-					{% for file in package.buildfilelist_package.all|dictsort:"path" %}
+					{% for file in objects %}
                         <tr>
-                            <td>
+                            <td class="path">
                                 <a href="{% url 'dirinfo_filepath' build.id target.id file.path %}">
                                     {{file.path}}
                                 </a>
                              </td>
-                            <td>{{file.size|filtered_filesizeformat}}</td>
+                            <td class="filesize sizecol" >{{file.size|filtered_filesizeformat}}</td>
                         </tr>
 					{% endfor %}
                 </tbody>
lib/toaster/toastergui/templates/package_included_reverse_dependencies.html +6 -13
index 1efcb1a..a36464c 100644
@@ -20,21 +20,14 @@
                 <strong>{{package.fullpackagespec}}</strong> has no reverse runtime dependencies.
             </div>
         {% else %}
-            <table class="table table-bordered table-hover">
-                <thead>
-                    <tr>
-                        <th>Package</th>
-                        <th>Version</th>
-                        <th>Size</th>
-                    </tr>
-                </thead>
+            {% include "tablesort.html" %}
                 <tbody>
-					{% for reverse_dep in reverse_deps|dictsort:"name" %}
+					{% for reverse_dep in objects %}
                         <tr {{reverse_dep.size|format_vpackage_rowclass}} >
                         {% if reverse_dep.size != -1 %}
                             <td>
-                                <a href="{% url 'package_included_detail' build.id target.id reverse_dep.dependent_id %}">
-                                    {{reverse_dep.name}}
+                                <a href="{% url 'package_included_detail' build.id target.id reverse_dep.package_id %}">
+                                    {{reverse_dep.package.name}}
                                 </a>
                                 <script>fmtAliasHelp("{{reverse_dep.name}}", "{{reverse_dep.alias}}", true)</script>
                             </td>
@@ -44,8 +37,8 @@
                             </td>
                             {% endif %}
 
-                            <td>{{reverse_dep.version}}&nbsp;</td>
-                            <td>{{reverse_dep.size|filtered_filesizeformat}}&nbsp;</td>
+                            <td>{{reverse_dep.package.version}}&nbsp;</td>
+                            <td class='sizecol'>{{reverse_dep.package.size|filtered_filesizeformat}}&nbsp;</td>
                         </tr>
 					{% endfor %}
                 </tbody>
lib/toaster/toastergui/templates/recipe.html +2 -2
index c846aa9..6e9cd23 100644
@@ -149,7 +149,7 @@
                         <th>
                             Version
                         </th>
-                        <th>
+                        <th class="sizecol span2">
                             Size
                         </th>
                     </tr>
@@ -161,7 +161,7 @@
                     <tr>
                         <td><a href="{% url "package_built_detail" build.pk package.pk %}">{{package.name}}</a></td>
                         <td><a href="{% url "package_built_detail" build.pk package.pk %}">{{package.version}}_{{package.revision}}</a></td>
-                        <td><a href="{% url "package_built_detail" build.pk package.pk %}">{{package.size|filtered_filesizeformat}}</a></td>
+                        <td class="sizecol"><a href="{% url "package_built_detail" build.pk package.pk %}">{{package.size|filtered_filesizeformat}}</a></td>
                     </tr>
 
                     {% endfor %}
lib/toaster/toastergui/templates/tablesort.html new file +38 -0
new file mode 100644
index 0000000..bf311b6
@@ -0,0 +1,38 @@
+{% load projecttags %}
+<!-- component to display a generic table -->
+    {% if disable_sort %}
+    <table class="table table-bordered table-hover" id="detail_table">
+    <thead>
+        <tr>
+            {% for tc in tablecols %}
+            <th class="{{tc.dclass}} {{tc.clclass}}">
+                {%if tc.qhelp%}<i class="icon-question-sign get-help" title="{{tc.qhelp}}"></i>{%endif%}
+                {{tc.name}}
+            </th>
+            {% endfor %}
+        </tr>
+    </thead>
+    {% else %}
+    <table class="table table-bordered table-hover tablesorter" id="otable">
+    <thead>
+        <!-- Table header row; generated from "tablecols" entry in the context dict -->
+        <tr>
+            {% for tc in tablecols %}
+            <th class="{{tc.dclass}} {{tc.clclass}}">
+                {%if tc.qhelp%}<i class="icon-question-sign get-help" title="{{tc.qhelp}}"></i>{%endif%}
+                {%if tc.orderfield%}
+                    <a {%if tc.ordericon%} class="sorted" {%endif%}
+                        href="javascript:reload_params({'page': 1, 'orderby' : '{{tc.orderfield}}' })" >
+                        {{tc.name}}
+                    </a>
+                {%else%}
+                    <span class="muted">
+                        {{tc.name}}
+                    </span>
+                {%endif%}
+                {%if tc.ordericon%} <i class="icon-caret-{{tc.ordericon}}"></i>{%endif%}
+            </th>
+            {% endfor %}
+        </tr>
+    </thead>
+    {% endif %}
lib/toaster/toastergui/templates/target.html +2 -2
index 5db0c0c..3a0c4d7 100644
@@ -79,10 +79,10 @@
             {{package.version|filtered_packageversion:package.revision}}
             </a>
         </td>
-        <td class="package_size">
+        <td class="package-size sizecol">
             {{package.size|filtered_installedsize:package.installed_size|filtered_filesizeformat}}
         </td>
-        <td class="size_over_total">
+        <td class="size_over_total sizecol">
             {{package|filter_sizeovertotal:packages_sum}}
         </td>
         <td class="license">
lib/toaster/toastergui/templatetags/projecttags.py +1 -1
index e863457..be75b21 100644
@@ -118,7 +118,7 @@ def filtered_filesizeformat(value):
     if value == -1:
         return ''
 
-    return filesizeformat(value).replace("bytes", "B").replace(".0", "")
+    return filesizeformat(value).replace("bytes", "B")
 
 @register.filter
 def filtered_packagespec(value):
lib/toaster/toastergui/views.py +91 -24

174 lines not on this page · raw message

Signature · 1 line
1.9.1
#9 lore raw

PATCH 9/9 toaster: add URI search path list

In reply to Alex DAMIAN

From: David Reyna <[email protected]>

Display the URI paths from SSTATE_DIR and SSTATE_MIRRORS in the Task page.

[YOCTO #5996]

---
 lib/toaster/toastergui/templates/task.html |  2 +-
 lib/toaster/toastergui/views.py            | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
lib/toaster/toastergui/templates/task.html +1 -1
index 66a6695..4555999 100644
@@ -172,7 +172,7 @@
                 <i class="icon-question-sign get-help" title="The locations searched for the above file (i.e. your <code>sstate-cache</code> directory and any mirrors you have set up)"></i>
                 URI(s) searched
             </dt>
-            <dd><code>{{task.work_directory}}</code></dd>
+            <dd><ul>{% for uri in uri_list %}<li><code>{{uri}}</code></li>{% endfor %}</ul></dd>
         </dl>
     {% endif %}
     {% if task.sstate_result == task.SSTATE_MISS %}
lib/toaster/toastergui/views.py +12 -0
index 36eb0bf..e4ada14 100644
@@ -481,6 +481,17 @@ def task( request, build_id, task_id ):
     if task.outcome == task.OUTCOME_FAILED:
         pass
 
+    uri_list= [ ]
+    variables = Variable.objects.filter(build=build_id)
+    v=variables.filter(variable_name='SSTATE_DIR')
+    if v.count > 0:
+        uri_list.append(v[0].variable_value)
+    v=variables.filter(variable_name='SSTATE_MIRRORS')
+    if (v.count > 0):
+        for mirror in v[0].variable_value.split('\\n'):
+            s=re.sub('.* ','',mirror.strip(' \t\n\r'))
+            if len(s): uri_list.append(s)
+
     context = {
             'build'           : Build.objects.filter( pk = build_id )[ 0 ],
             'object'          : task,
@@ -491,6 +502,7 @@ def task( request, build_id, task_id ):
             'log_head'        : log_head,
             'log_body'        : log_body,
             'showing_matches' : False,
+			'uri_list'        : uri_list,
     }
     if request.GET.get( 'show_matches', "" ):
         context[ 'showing_matches' ] = True
Signature · 1 line
1.9.1