Skip to contentSkip to conversation

Port main build tables to ToasterTables

PATCH Superseded Michael Wood 2 participants 9 messages May 23, 2016 – May 24, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Port main build tables to ToasterTables

Port the main build tables in the build analysis area to ToasterTables.

This is the table for Installed packages, Tasks, Recipes, Packages, Time, CPU usage and Disk I/O

Michael Wood (7):
toaster: ToasterTable widget add an 'a' to Name in Exception class
toaster: port table for Built packages to ToasterTable
toaster: port Built recipes table to toastertables
toaster: port Task tables to ToasterTables widget
toaster: port Installed packages table to ToasterTable
toaster: table.js Add the ability to highlight a particular row
toaster: tests Add new build tables to tests

 bitbake/lib/toaster/toastergui/buildtables.py      | 563 ++++++++++++++++++
 .../fixtures/toastergui-unittest-data.xml          |  91 ++-
 bitbake/lib/toaster/toastergui/static/js/table.js  |   9 +
 bitbake/lib/toaster/toastergui/tables.py           |  10 +-
 .../toastergui/templates/basebuildpage.html        |  26 +-
 .../lib/toaster/toastergui/templates/bpackage.html | 108 ----
 .../toastergui/templates/builddashboard.html       |   4 +-
 .../templates/buildinfo-toastertable.html          |  25 +
 .../toaster/toastergui/templates/buildtime.html    |   4 -
 .../lib/toaster/toastergui/templates/recipes.html  | 113 ----
 .../templates/snippets/gitrev_popover.html         |   8 +
 .../lib/toaster/toastergui/templates/target.html   | 115 +---
 bitbake/lib/toaster/toastergui/templates/task.html |   2 +-
 .../lib/toaster/toastergui/templates/tasks.html    | 143 -----
 bitbake/lib/toaster/toastergui/tests.py            |  40 +-
 bitbake/lib/toaster/toastergui/urls.py             |  46 +-
 bitbake/lib/toaster/toastergui/views.py            | 650 +--------------------
 bitbake/lib/toaster/toastergui/widgets.py          |  11 +-
 18 files changed, 763 insertions(+), 1205 deletions(-)
 create mode 100644 bitbake/lib/toaster/toastergui/buildtables.py
 delete mode 100644 bitbake/lib/toaster/toastergui/templates/bpackage.html
 create mode 100644 bitbake/lib/toaster/toastergui/templates/buildinfo-toastertable.html
 delete mode 100644 bitbake/lib/toaster/toastergui/templates/buildtime.html
 delete mode 100644 bitbake/lib/toaster/toastergui/templates/recipes.html
 create mode 100644 bitbake/lib/toaster/toastergui/templates/snippets/gitrev_popover.html
 delete mode 100644 bitbake/lib/toaster/toastergui/templates/tasks.html
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/7 toaster: ToasterTable widget add an 'a' to Name in Exception class

---
 bitbake/lib/toaster/toastergui/widgets.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
bitbake/lib/toaster/toastergui/widgets.py +6 -5
index 4117031..17c97fd 100644
@@ -46,7 +46,7 @@ logger = logging.getLogger("toaster")
 from toastergui.tablefilter import TableFilterMap
 
 
-class NoFieldOrDataNme(Exception):
+class NoFieldOrDataName(Exception):
     pass
 
 class ToasterTable(TemplateView):
@@ -326,10 +326,11 @@ class ToasterTable(TemplateView):
                     if not field:
                         field = col['static_data_name']
                     if not field:
-                        raise NoFieldOrDataNme("Must supply a field_name or"
-                                               "static_data_name for column"
-                                               "%s.%s" %
-                                               (self.__class__.__name__, col))
+                        raise NoFieldOrDataName("Must supply a field_name or"
+                                                "static_data_name for column"
+                                                "%s.%s" %
+                                                (self.__class__.__name__, col)
+                                                )
 
                     # Check if we need to process some static data
                     if "static_data_name" in col and col['static_data_name']:
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/7 toaster: port table for Built packages to ToasterTable

In reply to Michael Wood

This is the table that displays all the packages built in the build. Build -> Packages. Adds a template snippet for the git revision popover.

---
 bitbake/lib/toaster/toastergui/buildtables.py      | 152 +++++++++++++++++++++
 bitbake/lib/toaster/toastergui/tables.py           |  10 +-
 .../toastergui/templates/basebuildpage.html        |  26 ++--
 .../lib/toaster/toastergui/templates/bpackage.html | 108 ---------------
 .../templates/buildinfo-toastertable.html          |  23 ++++
 .../templates/snippets/gitrev_popover.html         |   8 ++
 bitbake/lib/toaster/toastergui/urls.py             |   7 +-
 bitbake/lib/toaster/toastergui/views.py            |  90 ------------
 8 files changed, 203 insertions(+), 221 deletions(-)
 create mode 100644 bitbake/lib/toaster/toastergui/buildtables.py
 delete mode 100644 bitbake/lib/toaster/toastergui/templates/bpackage.html
 create mode 100644 bitbake/lib/toaster/toastergui/templates/buildinfo-toastertable.html
 create mode 100644 bitbake/lib/toaster/toastergui/templates/snippets/gitrev_popover.html
bitbake/lib/toaster/toastergui/buildtables.py new file +152 -0
new file mode 100644
index 0000000..cf07ea8
@@ -0,0 +1,152 @@
+#
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# BitBake Toaster Implementation
+#
+# Copyright (C) 2016 Intel Corporation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from orm.models import Build
+import toastergui.tables as tables
+
+from toastergui.widgets import ToasterTable
+
+
+class BuildTablesMixin(ToasterTable):
+    def get_context_data(self, **kwargs):
+        # We need to be explicit about which superclass we're calling here
+        # Otherwise the MRO gets in a right mess
+        context = ToasterTable.get_context_data(self, **kwargs)
+        context['build'] = Build.objects.get(pk=kwargs['build_id'])
+        return context
+
+
+class BuiltPackagesTableBase(tables.PackagesTable):
+    """ Table to display all the packages built in a build """
+    def __init__(self, *args, **kwargs):
+        super(BuiltPackagesTableBase, self).__init__(*args, **kwargs)
+        self.title = "Packages built"
+        self.default_orderby = "name"
+
+    def setup_queryset(self, *args, **kwargs):
+        build = Build.objects.get(pk=kwargs['build_id'])
+        self.static_context_extra['build'] = build
+        self.queryset = build.package_set.all().exclude(recipe=None)
+        self.queryset = self.queryset.order_by(self.default_orderby)
+
+    def setup_columns(self, *args, **kwargs):
+        super(BuiltPackagesTableBase, self).setup_columns(*args, **kwargs)
+
+        def pkg_link_template(val):
+            """ return the template used for the link with the val as the
+            element value i.e. inside the <a></a>"""
+
+            return ('''
+                    <a href="
+                    {%% url "package_built_detail" extra.build.pk data.pk %%}
+                    ">%s</a>
+                    ''' % val)
+
+        def recipe_link_template(val):
+            return ('''
+                    {%% if data.recipe %%}
+                    <a href="
+                    {%% url "recipe" extra.build.pk data.recipe.pk %%}
+                    ">%(value)s</a>
+                    {%% else %%}
+                    %(value)s
+                    {%% endif %%}
+                    ''' % {'value': val})
+
+        add_pkg_link_to = ['name', 'version', 'size', 'license']
+        add_recipe_link_to = ['recipe__name', 'recipe__version']
+
+        # Add the recipe and pkg build links to the required columns
+        for column in self.columns:
+            # Convert to template field style accessors
+            tmplv = column['field_name'].replace('__', '.')
+            tmplv = "{{data.%s}}" % tmplv
+
+            if column['field_name'] in add_pkg_link_to:
+                # Don't overwrite an existing template
+                if column['static_data_template']:
+                    column['static_data_template'] =\
+                        pkg_link_template(column['static_data_template'])
+                else:
+                    column['static_data_template'] = pkg_link_template(tmplv)
+
+                column['static_data_name'] = column['field_name']
+
+            elif column['field_name'] in add_recipe_link_to:
+                # Don't overwrite an existing template
+                if column['static_data_template']:
+                    column['static_data_template'] =\
+                        recipe_link_template(column['static_data_template'])
+                else:
+                    column['static_data_template'] =\
+                        recipe_link_template(tmplv)
+                column['static_data_name'] = column['field_name']
+
+        self.add_column(title="Layer",
+                        field_name="recipe__layer_version__layer__name",
+                        hidden=True,
+                        orderable=True)
+
+        self.add_column(title="Layer branch",
+                        field_name="recipe__layer_version__branch",
+                        hidden=True,
+                        orderable=True)
+
+        git_rev_template = '''
+        {% with vcs_ref=data.recipe.layer_version.commit %}
+        {% include 'snippets/gitrev_popover.html' %}
+        {% endwith %}
+        '''
+
+        self.add_column(title="Layer commit",
+                        static_data_name='vcs_ref',
+                        static_data_template=git_rev_template,
+                        hidden=True)
+
+
+class BuiltPackagesTable(BuildTablesMixin, BuiltPackagesTableBase):
+    """ Show all the packages built for the selected build """
+    def __init__(self, *args, **kwargs):
+        super(BuiltPackagesTable, self).__init__(*args, **kwargs)
+        self.title = "Packages built"
+        self.default_orderby = "name"
+
+        self.empty_state =\
+            ('<strong>No packages were built.</strong> How did this happen?'
+             'Well, BitBake reuses as much stuff as possible.'
+             'If all of the packages needed were already built and available'
+             'in your build infrastructure, BitBake'
+             'will not rebuild any of them. This might be slightly confusing,'
+             'but it does make everything faster.')
+
+    def setup_columns(self, *args, **kwargs):
+        super(BuiltPackagesTable, self).setup_columns(*args, **kwargs)
+
+        def remove_dep_cols(columns):
+            for column in columns:
+                # We don't need these fields
+                if column['static_data_name'] in ['reverse_dependencies',
+                                                  'dependencies']:
+                    continue
+
+                yield column
+
+        self.columns = list(remove_dep_cols(self.columns))
bitbake/lib/toaster/toastergui/tables.py +2 -8
index 29b68de..39d3f93 100644
@@ -146,15 +146,8 @@ class LayersTable(ToasterTable):
                         static_data_template=git_dir_template)
 
         revision_template =  '''
-        {% load projecttags  %}
         {% with vcs_ref=data.get_vcs_reference %}
-        {% if vcs_ref|is_shaid %}
-        <a class="btn" data-content="<ul class='unstyled'> <li>{{vcs_ref}}</li> </ul>">
-        {{vcs_ref|truncatechars:10}}
-        </a>
-        {% else %}
-        {{vcs_ref}}
-        {% endif %}
+        {% include 'snippets/gitrev_popover.html' %}
         {% endwith %}
         '''
 
@@ -699,6 +692,7 @@ class PackagesTable(ToasterTable):
 
         self.add_column(title="Approx Size",
                         orderable=True,
+                        field_name="size",
                         static_data_name="size",
                         static_data_template="{% load projecttags %} \
                         {{data.size|filtered_filesizeformat}}")
bitbake/lib/toaster/toastergui/templates/basebuildpage.html +12 -14
index 0d8c882..52a32b6 100644
@@ -21,10 +21,19 @@
       {% block localbreadcrumb %}{% endblock %}
     </ul>
     <script>
-      $( function () {
+      $(document).ready(function(){
         $('#breadcrumb > li').append('<span class="divider">&rarr;</span>');
         $('#breadcrumb > li:last').addClass("active");
         $('#breadcrumb > li:last > span').remove();
+
+        $("#build-menu li a").each(function(){
+          /* Set the page active state in the Build menu */
+          if (window.location.href.split('?')[0] === $(this).prop("href")){
+            $(this).parent().addClass("active");
+          } else {
+            $(this).parent().removeClass("active");
+          }
+        });
       });
     </script>
   </div>
@@ -32,7 +41,7 @@
   <div class="row-fluid">
     <!-- begin left sidebar container -->
     <div id="nav" class="span2">
-      <ul class="nav nav-list well">
+      <ul class="nav nav-list well" id="build-menu">
         <li
           {% if request.resolver_match.url_name == 'builddashboard'  %}
             class="active"
@@ -51,25 +60,14 @@
         {% block nav-configuration %}
           <li><a href="{% url 'configuration' build.pk %}">Configuration</a></li>
         {% endblock %}
-        {% block nav-tasks %}
+
           <li><a href="{% url 'tasks' build.pk %}">Tasks</a></li>
-        {% endblock %}
-        {% block nav-recipes %}
           <li><a href="{% url 'recipes' build.pk %}">Recipes</a></li>
-        {% endblock %}
-        {% block nav-packages %}
           <li><a href="{% url 'packages' build.pk %}">Packages</a></li>
-        {% endblock %}
           <li class="nav-header">Performance</li>
-        {% block nav-buildtime %}
           <li><a href="{% url 'buildtime' build.pk %}">Time</a></li>
-        {% endblock %}
-        {% block nav-cputime %}
           <li><a href="{% url 'cputime' build.pk %}">CPU usage</a></li>
-        {% endblock %}
-        {% block nav-diskio %}
           <li><a href="{% url 'diskio' build.pk %}">Disk I/O</a></li>
-        {% endblock %}
 
         <li class="divider"></li>
 
bitbake/lib/toaster/toastergui/templates/bpackage.html deleted +0 -108

108 lines not on this page · raw message

bitbake/lib/toaster/toastergui/templates/buildinfo-toastertable.html new file +23 -0
new file mode 100644
index 0000000..4ce5c4a
@@ -0,0 +1,23 @@
+{% extends "basebuildpage.html" %}
+
+{% load projecttags %}
+
+{% block title %} {{title}} - {{build.target_set.all|dictsort:"target"|join:", "}} {{build.machine}} - {{build.project.name}} - Toaster {% endblock %}
+{% block localbreadcrumb %}
+<li>{{title}}</li>
+{% endblock %}
+
+{% block nav-packages %}
+{% endblock %}
+
+{% block buildinfomain %}
+<div class="span10">
+{% url 'builtpackagestable' build.id as xhr_table_url %}
+  <div class="page-header">
+     <h1>
+       {{title}} (<span class="table-count-{{table_name}}">0</span>) </h2>
+     </h1>
+  </div>
+  {% include "toastertable.html" %}
+</div>
+{% endblock %}
bitbake/lib/toaster/toastergui/templates/snippets/gitrev_popover.html new file +8 -0
new file mode 100644
index 0000000..281a3bd
@@ -0,0 +1,8 @@
+{% load projecttags  %}
+{% if vcs_ref|is_shaid %}
+<a class="btn" data-content="<ul class='unstyled'> <li>{{vcs_ref}}</li> </ul>">
+ {{vcs_ref|truncatechars:10}}
+</a>
+{% else %}
+{{vcs_ref}}
+{% endif %}
bitbake/lib/toaster/toastergui/urls.py +6 -1
index 27b0baa..3ce0d51 100644
@@ -21,6 +21,7 @@ from django.views.generic import RedirectView, TemplateView
 
 from django.http import HttpResponseBadRequest
 from toastergui import tables
+from toastergui import buildtables
 from toastergui import typeaheads
 from toastergui import api
 
@@ -44,7 +45,11 @@ urlpatterns = patterns('toastergui.views',
         url(r'^build/(?P<build_id>\d+)/recipe/(?P<recipe_id>\d+)$', 'recipe', name='recipe'),
         url(r'^build/(?P<build_id>\d+)/recipe_packages/(?P<recipe_id>\d+)$', 'recipe_packages', name='recipe_packages'),
 
-        url(r'^build/(?P<build_id>\d+)/packages/$', 'bpackage', name='packages'),
+        url(r'^build/(?P<build_id>\d+)/packages/$',
+            buildtables.BuiltPackagesTable.as_view(
+                template_name="buildinfo-toastertable.html"),
+            name='packages'),
+
         url(r'^build/(?P<build_id>\d+)/package/(?P<package_id>\d+)$', 'package_built_detail',
                 name='package_built_detail'),
         url(r'^build/(?P<build_id>\d+)/package_built_dependencies/(?P<package_id>\d+)$',
bitbake/lib/toaster/toastergui/views.py +0 -90

96 lines not on this page · raw message

Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/7 toaster: port Built recipes table to toastertables

In reply to Michael Wood
---
 bitbake/lib/toaster/toastergui/buildtables.py      | 129 +++++++++++++++++++++
 .../lib/toaster/toastergui/templates/recipes.html  | 113 ------------------
 bitbake/lib/toaster/toastergui/urls.py             |   7 +-
 bitbake/lib/toaster/toastergui/views.py            | 111 ------------------
 4 files changed, 135 insertions(+), 225 deletions(-)
 delete mode 100644 bitbake/lib/toaster/toastergui/templates/recipes.html
bitbake/lib/toaster/toastergui/buildtables.py +129 -0
index cf07ea8..dc742b9 100644
@@ -150,3 +150,132 @@ class BuiltPackagesTable(BuildTablesMixin, BuiltPackagesTableBase):
                 yield column
 
         self.columns = list(remove_dep_cols(self.columns))
+
+
+class BuiltRecipesTable(BuildTablesMixin):
+    """ Table to show the recipes that have been built in this build """
+
+    def __init__(self, *args, **kwargs):
+        super(BuiltRecipesTable, self).__init__(*args, **kwargs)
+        self.title = "Recipes built"
+        self.default_orderby = "name"
+
+    def setup_queryset(self, *args, **kwargs):
+        build = Build.objects.get(pk=kwargs['build_id'])
+        self.static_context_extra['build'] = build
+        self.queryset = build.get_recipes()
+        self.queryset = self.queryset.order_by(self.default_orderby)
+
+    def setup_columns(self, *args, **kwargs):
+        recipe_name_tmpl =\
+            '<a href="{% url "recipe" extra.build.pk data.pk %}">'\
+            '{{data.name}}'\
+            '</a>'
+
+        recipe_version_tmpl =\
+            '<a href="{% url "recipe" extra.build.pk data.pk %}">'\
+            '{{data.version}}'\
+            '</a>'
+
+        recipe_file_tmpl =\
+            '{{data.file_path}}'\
+            '{% if data.pathflags %}<i>({{data.pathflags}})</i>'\
+            '{% endif %}'
+
+        git_rev_template = '''
+        {% with vcs_ref=data.layer_version.commit %}
+        {% include 'snippets/gitrev_popover.html' %}
+        {% endwith %}
+        '''
+
+        depends_on_tmpl = '''
+        {% with deps=data.r_dependencies_recipe.all %}
+        {% with count=deps|length %}
+        {% if count %}
+        <a class="btn" title="
+        <a href='{% url "recipe" extra.build.pk data.pk %}#dependencies'>
+        {{data.name}}</a> dependencies"
+        data-content="<ul class='unstyled'>
+        {% for dep in deps|dictsort:"depends_on.name"%}
+        <li><a href='{% url "recipe" extra.build.pk dep.depends_on.pk %}'>
+        {{dep.depends_on.name}}</a></li>
+        {% endfor %}
+        </ul>">
+         {{count}}
+        </a>
+        {% endif %}{% endwith %}{% endwith %}
+        '''
+
+        rev_depends_tmpl = '''
+        {% with revs=data.r_dependencies_depends.all %}
+        {% with count=revs|length %}
+        {% if count %}
+        <a class="btn"
+        title="
+        <a href='{% url "recipe" extra.build.pk data.pk %}#brought-in-by'>
+        {{data.name}}</a> reverse dependencies"
+        data-content="<ul class='unstyled'>
+        {% for dep in revs|dictsort:"recipe.name" %}
+        <li>
+        <a href='{% url "recipe" extra.build.pk dep.recipe.pk %}'>
+        {{dep.recipe.name}}
+        </a></li>
+        {% endfor %}
+        </ul>">
+        {{count}}
+        </a>
+        {% endif %}{% endwith %}{% endwith %}
+        '''
+
+        self.add_column(title="Name",
+                        field_name="name",
+                        static_data_name='name',
+                        orderable=True,
+                        static_data_template=recipe_name_tmpl)
+
+        self.add_column(title="Version",
+                        field_name="version",
+                        static_data_name='version',
+                        static_data_template=recipe_version_tmpl)
+
+        self.add_column(title="Dependencies",
+                        static_data_name="dependencies",
+                        static_data_template=depends_on_tmpl,
+                        hidden=True)
+
+        self.add_column(title="Reverse dependencies",
+                        static_data_name="revdeps",
+                        static_data_template=rev_depends_tmpl,
+                        help_text='Recipe build-time reverse dependencies'
+                        ' (i.e. the recipes that depend on this recipe)',
+                        hidden=True)
+
+        self.add_column(title="Recipe file",
+                        field_name="file_path",
+                        static_data_name="file_path",
+                        static_data_template=recipe_file_tmpl)
+
+        self.add_column(title="Section",
+                        field_name="section",
+                        orderable=True)
+
+        self.add_column(title="License",
+                        field_name="license",
+                        help_text='Multiple license names separated by the'
+                        ' pipe character indicates a choice between licenses.'
+                        ' Multiple license names separated by the ampersand'
+                        ' character indicates multiple licenses exist that'
+                        ' cover different parts of the source',
+                        orderable=True)
+
+        self.add_column(title="Layer",
+                        field_name="layer_version__layer__name",
+                        orderable=True)
+
+        self.add_column(title="Layer branch",
+                        field_name="layer_version__branch",
+                        orderable=True)
+
+        self.add_column(title="Layer commit",
+                        static_data_name="commit",
+                        static_data_template=git_rev_template)
bitbake/lib/toaster/toastergui/templates/recipes.html deleted +0 -113

113 lines not on this page · raw message

bitbake/lib/toaster/toastergui/urls.py +6 -1
index 3ce0d51..0636c95 100644
@@ -40,8 +40,13 @@ urlpatterns = patterns('toastergui.views',
         url(r'^build/(?P<build_id>\d+)/tasks/(?P<task_id>\d+)/$', 'tasks_task', name='tasks_task'),
         url(r'^build/(?P<build_id>\d+)/task/(?P<task_id>\d+)$', 'task', name='task'),
 
-        url(r'^build/(?P<build_id>\d+)/recipes/$', 'recipes', name='recipes'),
+        url(r'^build/(?P<build_id>\d+)/recipes/$',
+            buildtables.BuiltRecipesTable.as_view(
+                template_name="buildinfo-toastertable.html"),
+            name='recipes'),
+
         url(r'^build/(?P<build_id>\d+)/recipe/(?P<recipe_id>\d+)/active_tab/(?P<active_tab>\d{1})$', 'recipe', name='recipe'),
+
         url(r'^build/(?P<build_id>\d+)/recipe/(?P<recipe_id>\d+)$', 'recipe', name='recipe'),
         url(r'^build/(?P<build_id>\d+)/recipe_packages/(?P<recipe_id>\d+)$', 'recipe_packages', name='recipe_packages'),
 
bitbake/lib/toaster/toastergui/views.py +0 -111

117 lines not on this page · raw message

Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/7 toaster: port Task tables to ToasterTables widget

In reply to Michael Wood

Port the Task based tables to ToasterTable. This is the Task, Time, CPU usage and Disk I/O tables.

---
 bitbake/lib/toaster/toastergui/buildtables.py      | 227 ++++++++++++++++-
 .../templates/buildinfo-toastertable.html          |   4 +-
 .../toaster/toastergui/templates/buildtime.html    |   4 -
 bitbake/lib/toaster/toastergui/templates/task.html |   2 +-
 .../lib/toaster/toastergui/templates/tasks.html    | 143 -----------
 bitbake/lib/toaster/toastergui/urls.py             |  23 +-
 bitbake/lib/toaster/toastergui/views.py            | 280 +--------------------
 7 files changed, 248 insertions(+), 435 deletions(-)
 delete mode 100644 bitbake/lib/toaster/toastergui/templates/buildtime.html
 delete mode 100644 bitbake/lib/toaster/toastergui/templates/tasks.html
bitbake/lib/toaster/toastergui/buildtables.py +225 -2
index dc742b9..51c136f 100644
@@ -19,10 +19,13 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-from orm.models import Build
-import toastergui.tables as tables
+from orm.models import Build, Task
+from django.db.models import Q
 
+import toastergui.tables as tables
 from toastergui.widgets import ToasterTable
+from toastergui.tablefilter import TableFilter
+from toastergui.tablefilter import TableFilterActionToggle
 
 
 class BuildTablesMixin(ToasterTable):
@@ -279,3 +282,223 @@ class BuiltRecipesTable(BuildTablesMixin):
         self.add_column(title="Layer commit",
                         static_data_name="commit",
                         static_data_template=git_rev_template)
+
+
+class BuildTasksTable(BuildTablesMixin):
+    """ Table to show the tasks that run in this build """
+
+    def __init__(self, *args, **kwargs):
+        super(BuildTasksTable, self).__init__(*args, **kwargs)
+        self.title = "Tasks"
+        self.default_orderby = "order"
+
+        # Toggle these columns on off for Time/CPU usage/Disk I/O tables
+        self.toggle_columns = {}
+
+    def setup_queryset(self, *args, **kwargs):
+        build = Build.objects.get(pk=kwargs['build_id'])
+        self.static_context_extra['build'] = build
+        self.queryset = build.task_build.filter(~Q(order=None))
+        self.queryset = self.queryset.order_by(self.default_orderby)
+
+    def setup_filters(self, *args, **kwargs):
+        # Execution outcome types filter
+        executed_outcome = TableFilter(name="execution_outcome",
+                                       title="Filter Tasks by 'Executed")
+
+        exec_outcome_action_exec = TableFilterActionToggle(
+            "executed",
+            "Executed Tasks",
+            Q(task_executed=True))
+
+        exec_outcome_action_not_exec = TableFilterActionToggle(
+            "not_executed",
+            "Not Executed Tasks",
+            Q(task_executed=False))
+
+        executed_outcome.add_action(exec_outcome_action_exec)
+        executed_outcome.add_action(exec_outcome_action_not_exec)
+
+        # Task outcome types filter
+        task_outcome = TableFilter(name="task_outcome",
+                                   title="Filter Task by 'Outcome'")
+
+        for outcome_enum, title in Task.TASK_OUTCOME:
+            action = TableFilterActionToggle(
+                title.replace(" ", "_").lower(),
+                "%s Tasks" % title,
+                Q(outcome=outcome_enum))
+
+            task_outcome.add_action(action)
+
+        # SSTATE outcome types filter
+        sstate_outcome = TableFilter(name="sstate_outcome",
+                                     title="Filter Task by 'Cache attempt'")
+
+        for sstate_result_enum, title in Task.SSTATE_RESULT:
+            action = TableFilterActionToggle(
+                title.replace(" ", "_").lower(),
+                "Tasks with '%s' attempts" % title,
+                Q(sstate_result=sstate_result_enum))
+
+            sstate_outcome.add_action(action)
+
+        self.add_filter(sstate_outcome)
+        self.add_filter(executed_outcome)
+        self.add_filter(task_outcome)
+
+    def setup_columns(self, *args, **kwargs):
+        self.toggle_columns['order'] = len(self.columns)
+
+        recipe_name_tmpl =\
+            '<a href="{% url "recipe" extra.build.pk data.recipe.pk %}">'\
+            '{{data.recipe.name}}'\
+            '</a>'
+
+        recipe_version_tmpl =\
+            '<a href="{% url "recipe" extra.build.pk data.recipe.pk %}">'\
+            '{{data.recipe.version}}'\
+            '</a>'
+
+        def task_link_tmpl(val):
+            return ('<a name="task-{{data.order}}"'
+                    'href="{%% url "task" extra.build.pk data.pk %%}">'
+                    '%s'
+                    '</a>') % str(val)
+
+        self.add_column(title="Order",
+                        static_data_name="order",
+                        static_data_template=task_link_tmpl('{{data.order}}'),
+                        orderable=True)
+
+        self.add_column(title="Recipe",
+                        static_data_name='recipe__name',
+                        static_data_template=recipe_name_tmpl,
+                        orderable=True)
+
+        self.add_column(title="Recipe version",
+                        static_data_name='recipe__version',
+                        static_data_template=recipe_version_tmpl)
+
+        self.add_column(title="Task",
+                        static_data_name="task_name",
+                        static_data_template=task_link_tmpl(
+                            "{{data.task_name}}"),
+                        orderable=True)
+
+        self.add_column(title="Executed",
+                        static_data_name="task_executed",
+                        static_data_template=task_link_tmpl(
+                            "{{data.get_executed_display}}"),
+                        filter_name='execution_outcome',
+                        orderable=True)
+
+        self.static_context_extra['OUTCOME_FAILED'] = Task.OUTCOME_FAILED
+        outcome_tmpl = task_link_tmpl("{{data.outcome_text}}")
+        outcome_tmpl = ('%s '
+                        '{%% if data.outcome = extra.OUTCOME_FAILED %%}'
+                        '<a href="{%% url "build_artifact" extra.build.pk '
+                        '          "tasklogfile" data.pk %%}">'
+                        ' <i class="icon-download-alt" '
+                        '    title="Download task log file"></i>'
+                        '</a> {%% endif %%}'
+                        '<i class="icon-question-sign get-help '
+                        'hover-help" style="visibility: hidden;" '
+                        'title="{{data.get_outcome_help}}"></i>'
+                        ) % outcome_tmpl
+
+        self.add_column(title="Outcome",
+                        static_data_name="outcome",
+                        static_data_template=outcome_tmpl,
+                        filter_name="task_outcome",
+                        orderable=True)
+
+        self.add_column(title="Cache attempt",
+                        static_data_name="sstate_result",
+                        static_data_template=task_link_tmpl(
+                            "{{data.sstate_text}}"),
+                        filter_name="sstate_outcome",
+                        orderable=True)
+
+        self.toggle_columns['elapsed_time'] = len(self.columns)
+
+        self.add_column(
+            title="Time (secs)",
+            static_data_name="elapsed_time",
+            static_data_template='{% load projecttags %}{% load humanize %}'
+            '{{data.elapsed_time|format_none_and_zero|floatformat:2}}',
+            orderable=True,
+            hidden=True)
+
+        self.toggle_columns['cpu_time_sys'] = len(self.columns)
+
+        self.add_column(
+            title="System CPU time (secs)",
+            static_data_name="cpu_time_system",
+            static_data_template='{% load projecttags %}{% load humanize %}'
+            '{{data.cpu_time_system|format_none_and_zero|floatformat:2}}',
+            hidden=True,
+            orderable=True)
+
+        self.toggle_columns['cpu_time_user'] = len(self.columns)
+
+        self.add_column(
+            title="User CPU time (secs)",
+            static_data_name="cpu_time_user",
+            static_data_template='{% load projecttags %}{% load humanize %}'
+            '{{data.cpu_time_user|format_none_and_zero|floatformat:2}}',
+            hidden=True,
+            orderable=True)
+
+        self.toggle_columns['disk_io'] = len(self.columns)
+
+        self.add_column(
+            title="Disk I/O (ms)",
+            static_data_name="disk_io",
+            static_data_template='{% load projecttags %}{% load humanize %}'
+            '{{data.disk_io|format_none_and_zero|filtered_filesizeformat}}',
+            hidden=True,
+            orderable=True)
+
+
+class BuildTimeTable(BuildTasksTable):
+    """ Same as tasks table but the Time column is default displayed"""
+
+    def __init__(self, *args, **kwargs):
+        super(BuildTimeTable, self).__init__(*args, **kwargs)
+        self.default_orderby = "-elapsed_time"
+
+    def setup_columns(self, *args, **kwargs):
+        super(BuildTimeTable, self).setup_columns(**kwargs)
+
+        self.columns[self.toggle_columns['order']]['hidden'] = True
+        self.columns[self.toggle_columns['elapsed_time']]['hidden'] = False
+
+
+class BuildCPUTimeTable(BuildTasksTable):
+    """ Same as tasks table but the CPU usage columns are default displayed"""
+
+    def __init__(self, *args, **kwargs):
+        super(BuildCPUTimeTable, self).__init__(*args, **kwargs)
+        self.default_orderby = "-cpu_time_system"
+
+    def setup_columns(self, *args, **kwargs):
+        super(BuildCPUTimeTable, self).setup_columns(**kwargs)
+
+        self.columns[self.toggle_columns['order']]['hidden'] = True
+        self.columns[self.toggle_columns['cpu_time_sys']]['hidden'] = False
+        self.columns[self.toggle_columns['cpu_time_user']]['hidden'] = False
+
+
+class BuildIOTable(BuildTasksTable):
+    """ Same as tasks table but the Disk IO column is default displayed"""
+
+    def __init__(self, *args, **kwargs):
+        super(BuildIOTable, self).__init__(*args, **kwargs)
+        self.default_orderby = "-disk_io"
+
+    def setup_columns(self, *args, **kwargs):
+        super(BuildIOTable, self).setup_columns(**kwargs)
+
+        self.columns[self.toggle_columns['order']]['hidden'] = True
+        self.columns[self.toggle_columns['disk_io']]['hidden'] = False
bitbake/lib/toaster/toastergui/templates/buildinfo-toastertable.html +3 -1
index 4ce5c4a..52cc056 100644
@@ -12,12 +12,14 @@
 
 {% block buildinfomain %}
 <div class="span10">
-{% url 'builtpackagestable' build.id as xhr_table_url %}
+{# xhr_table_url is just the current url so leave it blank #}
+{% with xhr_table_url='' %}
   <div class="page-header">
      <h1>
        {{title}} (<span class="table-count-{{table_name}}">0</span>) </h2>
      </h1>
   </div>
   {% include "toastertable.html" %}
+{% endwith %}
 </div>
 {% endblock %}
bitbake/lib/toaster/toastergui/templates/buildtime.html deleted +0 -4
deleted file mode 100644
index ea84ae7..0000000
@@ -1,4 +0,0 @@
-{% extends "basebuildpage.html" %}
-{% block localbreadcrumb %}
-<li>Build Time</li>
-{% endblock %}
bitbake/lib/toaster/toastergui/templates/task.html +1 -1
index 5768262..dcd4dbc 100644
@@ -195,7 +195,7 @@
         <i class="icon-question-sign get-help" title="The running sequence of each task in the build"></i>
         Task order
     </dt>
-    <dd><a href="{%url "tasks_task" build.pk task.order %}#{{task.order}}">{{task.order}}</a></dd>
+    <dd><a href="{%url "tasks" build.pk %}?page={{task_in_tasks_table_pg}}&limit=25#task-{{task.order}}">{{task.order}}</a></dd>
     {% if task.task_executed %}
         <dt>
             <i class="icon-question-sign get-help" title="Indicates if this task executes a Python or Shell function(s)"></i>
bitbake/lib/toaster/toastergui/templates/tasks.html deleted +0 -143

143 lines not on this page · raw message

bitbake/lib/toaster/toastergui/urls.py +18 -5
index 0636c95..c4913f1 100644
@@ -35,9 +35,11 @@ urlpatterns = patterns('toastergui.views',
 
         # build info navigation
         url(r'^build/(?P<build_id>\d+)$', 'builddashboard', name="builddashboard"),
+        url(r'^build/(?P<build_id>\d+)/tasks/$',
+            buildtables.BuildTasksTable.as_view(
+                template_name="buildinfo-toastertable.html"),
+            name='tasks'),
 
-        url(r'^build/(?P<build_id>\d+)/tasks/$', 'tasks', name='tasks'),
-        url(r'^build/(?P<build_id>\d+)/tasks/(?P<task_id>\d+)/$', 'tasks_task', name='tasks_task'),
         url(r'^build/(?P<build_id>\d+)/task/(?P<task_id>\d+)$', 'task', name='task'),
 
         url(r'^build/(?P<build_id>\d+)/recipes/$',
@@ -74,9 +76,20 @@ urlpatterns = patterns('toastergui.views',
         url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)/dirinfo_filepath/_(?P<file_path>(?:/[^/\n]+)*)$', 'dirinfo', name='dirinfo_filepath'),
         url(r'^build/(?P<build_id>\d+)/configuration$', 'configuration', name='configuration'),
         url(r'^build/(?P<build_id>\d+)/configvars$', 'configvars', name='configvars'),
-        url(r'^build/(?P<build_id>\d+)/buildtime$', 'buildtime', name='buildtime'),
-        url(r'^build/(?P<build_id>\d+)/cputime$', 'cputime', name='cputime'),
-        url(r'^build/(?P<build_id>\d+)/diskio$', 'diskio', name='diskio'),
+        url(r'^build/(?P<build_id>\d+)/buildtime$',
+            buildtables.BuildTimeTable.as_view(
+                template_name="buildinfo-toastertable.html"),
+            name='buildtime'),
+
+        url(r'^build/(?P<build_id>\d+)/cputime$',
+            buildtables.BuildCPUTimeTable.as_view(
+                template_name="buildinfo-toastertable.html"),
+            name='cputime'),
+
+        url(r'^build/(?P<build_id>\d+)/diskio$',
+            buildtables.BuildIOTable.as_view(
+                template_name="buildinfo-toastertable.html"),
+            name='diskio'),
 
         # image information dir
         url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)/packagefile/(?P<packagefile_id>\d+)$',
bitbake/lib/toaster/toastergui/views.py +1 -279

292 lines not on this page · raw message

Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/7 toaster: port Installed packages table to ToasterTable

In reply to Michael Wood
---
 bitbake/lib/toaster/toastergui/buildtables.py      |  63 +++++++-
 .../toastergui/templates/builddashboard.html       |   4 +-
 .../lib/toaster/toastergui/templates/target.html   | 115 +-------------
 bitbake/lib/toaster/toastergui/urls.py             |   9 +-
 bitbake/lib/toaster/toastergui/views.py            | 169 ---------------------
 5 files changed, 73 insertions(+), 287 deletions(-)
bitbake/lib/toaster/toastergui/buildtables.py +61 -2
index 51c136f..17de369 100644
@@ -19,8 +19,8 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-from orm.models import Build, Task
-from django.db.models import Q
+from orm.models import Build, Task, Target, Package
+from django.db.models import Q, Sum
 
 import toastergui.tables as tables
 from toastergui.widgets import ToasterTable
@@ -155,6 +155,65 @@ class BuiltPackagesTable(BuildTablesMixin, BuiltPackagesTableBase):
         self.columns = list(remove_dep_cols(self.columns))
 
 
+class InstalledPackagesTable(BuildTablesMixin, BuiltPackagesTableBase):
+    """ Show all packages installed in an image """
+    def __init__(self, *args, **kwargs):
+        super(InstalledPackagesTable, self).__init__(*args, **kwargs)
+        self.title = "Installed Packages"
+        self.default_orderby = "name"
+
+    def make_package_list(self, target):
+        # The database design means that you get the intermediate objects and
+        # not package objects like you'd really want so we get them here
+        pkgs = target.target_installed_package_set.values_list('package',
+                                                               flat=True)
+        return Package.objects.filter(pk__in=pkgs)
+
+    def get_context_data(self, **kwargs):
+        context = super(InstalledPackagesTable,
+                        self).get_context_data(**kwargs)
+
+        target = Target.objects.get(pk=kwargs['target_id'])
+        packages = self.make_package_list(target)
+
+        context['packages_sum'] = packages.aggregate(
+            Sum('installed_size'))['installed_size__sum']
+
+        context['target'] = target
+        return context
+
+    def setup_queryset(self, *args, **kwargs):
+        build = Build.objects.get(pk=kwargs['build_id'])
+        self.static_context_extra['build'] = build
+
+        target = Target.objects.get(pk=kwargs['target_id'])
+        self.queryset = self.make_package_list(target)
+
+    def setup_columns(self, *args, **kwargs):
+        super(InstalledPackagesTable, self).setup_columns(**kwargs)
+        self.add_column(title="Installed size",
+                        static_data_name="installed_size",
+                        static_data_template="{% load projecttags %}"
+                        "{{data.size|filtered_filesizeformat}}",
+                        orderable=True)
+
+        # Add the template to show installed name for installed packages
+        install_name_tmpl =\
+            ('{{data.name}} '
+             '{% if data.installed_name and data.installed_name !='
+             ' data.name %}'
+             '<span class="muted"> as {{data.installed_name}}</span>'
+             ' <i class="icon-question-sign get-help hover-help"'
+             ' title="{{data.name}} was renamed at packaging time and'
+             ' was installed in your image as {{data.installed_name}}'
+             '"></i>{% endif %} ')
+
+        for column in self.columns:
+            if column['static_data_name'] == 'name':
+                column['static_data_template'] = install_name_tmpl
+                break
+
+
 class BuiltRecipesTable(BuildTablesMixin):
     """ Table to show the recipes that have been built in this build """
 
bitbake/lib/toaster/toastergui/templates/builddashboard.html +2 -2
index a0da71e..dfb659c 100644
@@ -105,7 +105,7 @@
                                     files from a previous build already exist in your
                                     <code>.../poky/build/tmp/deploy</code>
                                     directory. You can
-                                    also <a href="{% url 'targetpkg' build.pk target.target.pk %}">view the
+                                    also <a href="{% url 'target' build.pk target.target.pk %}">view the
                                       license manifest information</a> in Toaster.
                                   </p>
                     </div>
@@ -117,7 +117,7 @@
                 License manifest
             </dt>
             <dd>
-                <a href="{% url 'targetpkg' build.pk target.target.pk %}">View in Toaster</a> |
+                <a href="{% url 'target' build.pk target.target.pk %}">View in Toaster</a> |
                 <a href="{% url 'build_artifact' build.pk 'licensemanifest' target.target.pk %}">Download</a></dd>
             <dt>
                 <i class="icon-question-sign get-help" title="Image files are stored in <code>/build/tmp/deploy/images/</code>"></i>
bitbake/lib/toaster/toastergui/templates/target.html +4 -111

133 lines not on this page · raw message

bitbake/lib/toaster/toastergui/urls.py +6 -3
index c4913f1..9510a38 100644
@@ -68,9 +68,12 @@ urlpatterns = patterns('toastergui.views',
         url(r'^build/(?P<build_id>\d+)/package_included_reverse_dependencies/(?P<target_id>\d+)/(?P<package_id>\d+)$',
             'package_included_reverse_dependencies', name='package_included_reverse_dependencies'),
 
-        # images are known as targets in the internal model
-        url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)$', 'target', name='target'),
-        url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)/targetpkg$', 'targetpkg', name='targetpkg'),
+        url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)$',
+            buildtables.InstalledPackagesTable.as_view(
+                template_name="target.html"),
+            name='target'),
+
+
         url(r'^dentries/build/(?P<build_id>\d+)/target/(?P<target_id>\d+)$', 'xhr_dirinfo', name='dirinfo_ajax'),
         url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)/dirinfo$', 'dirinfo', name='dirinfo'),
         url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)/dirinfo_filepath/_(?P<file_path>(?:/[^/\n]+)*)$', 'dirinfo', name='dirinfo_filepath'),
bitbake/lib/toaster/toastergui/views.py +0 -169

175 lines not on this page · raw message

Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/7 toaster: table.js Add the ability to highlight a particular row

In reply to Michael Wood

As in the old build tables it's useful to jump and highlight a particular row in the table using the #hash in the URL.

---
 bitbake/lib/toaster/toastergui/static/js/table.js | 9 +++++++++
 1 file changed, 9 insertions(+)
bitbake/lib/toaster/toastergui/static/js/table.js +9 -0
index 7f76f55..7f9c44f 100644
@@ -162,6 +162,15 @@ function tableInit(ctx){
     table.css("padding-bottom", 0);
     tableContainer.css("visibility", "visible");
 
+    /* If we have a hash in the url try and highlight that item in the table */
+    if (window.location.hash){
+      var highlight = $("table a[name="+window.location.hash.replace('#',''));
+      if (highlight.length > 0){
+        highlight.parents("tr").addClass('highlight');
+        window.scroll(0, highlight.position().top - 50);
+      }
+    }
+
     table.trigger("table-done", [tableData.total, tableParams]);
   }
 
Signature · 1 line
2.7.4
#7 lore raw

PATCH 7/7 toaster: tests Add new build tables to tests

In reply to Michael Wood

- Add new build tables to be tested
- Add required data into the fixture and clean up a few empty fields
- Fix the SoftwareRecipesTable specific test so as not to rely on two particular defined recipes

---
 .../fixtures/toastergui-unittest-data.xml          | 91 ++++++++++++++++------
 bitbake/lib/toaster/toastergui/tests.py            | 40 ++++++----
 2 files changed, 94 insertions(+), 37 deletions(-)
bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml +68 -23
index cf35be4..213bf0f 100644
@@ -82,9 +82,8 @@
     <field to="orm.build" name="build" rel="ManyToOneRel">1</field>
     <field type="CharField" name="target">a image recipe</field>
     <field type="CharField" name="task"><None></None></field>
-    <field type="BooleanField" name="is_image">False</field>
-    <field type="IntegerField" name="image_size">0</field>
-    <field type="CharField" name="license_manifest_path"><None></None></field>
+    <field type="BooleanField" name="is_image">True</field>
+    <field type="IntegerField" name="image_size">290</field>
   </object>
   <object pk="2" model="orm.target">
     <field to="orm.build" name="build" rel="ManyToOneRel">2</field>
@@ -118,9 +117,9 @@
   </object>
   <object pk="2" model="orm.package">
     <field to="orm.build" name="build" rel="ManyToOneRel">1</field>
-    <field to="orm.recipe" name="recipe" rel="ManyToOneRel">2</field>
+    <field to="orm.recipe" name="recipe" rel="ManyToOneRel">1</field>
     <field type="CharField" name="name">f pkg</field>
-    <field type="CharField" name="installed_name"></field>
+    <field type="CharField" name="installed_name">f</field>
     <field type="CharField" name="version"></field>
     <field type="CharField" name="revision"></field>
     <field type="TextField" name="summary"></field>
@@ -297,6 +296,16 @@
     <field type="CharField" name="pathflags"></field>
     <field type="BooleanField" name="is_image">False</field>
   </object>
+  <!-- Added for an additional built recipe -->
+  <object pk="6" model="orm.recipe">
+    <field type="CharField" name="name">g recipe</field>
+    <field type="CharField" name="version">1.2.3</field>
+    <field to="orm.layer_version" name="layer_version" rel="ManyToOneRel">3</field>
+    <field type="CharField" name="license">g license</field>
+    <field type="FilePathField" name="file_path">/g</field>
+    <field type="BooleanField" name="is_image">False</field>
+  </object>
+
   <object pk="1" model="orm.machine">
     <field to="orm.layersource" name="layer_source" rel="ManyToOneRel"><None></None></field>
     <field type="IntegerField" name="up_id"><None></None></field>
@@ -353,8 +362,6 @@
   </object>
   <object pk="1" model="orm.branch">
     <field to="orm.layersource" name="layer_source" rel="ManyToOneRel">1</field>
-    <field type="IntegerField" name="up_id"><None></None></field>
-    <field type="DateTimeField" name="up_date"><None></None></field>
     <field type="CharField" name="name">master</field>
     <field type="CharField" name="short_description"></field>
   </object>
@@ -363,13 +370,7 @@
     <field type="IntegerField" name="up_id"><None></None></field>
     <field type="DateTimeField" name="up_date"><None></None></field>
     <field type="CharField" name="name">a layer</field>
-    <field type="CharField" name="layer_index_url"></field>
     <field type="CharField" name="vcs_url">/tmp/</field>
-    <field type="CharField" name="vcs_web_url"><None></None></field>
-    <field type="CharField" name="vcs_web_tree_base_url"><None></None></field>
-    <field type="CharField" name="vcs_web_file_base_url"><None></None></field>
-    <field type="TextField" name="summary"><None></None></field>
-    <field type="TextField" name="description"><None></None></field>
   </object>
   <object pk="2" model="orm.layer">
     <field to="orm.layersource" name="layer_source" rel="ManyToOneRel">1</field>
@@ -378,21 +379,16 @@
     <field type="CharField" name="name">z layer</field>
     <field type="CharField" name="layer_index_url"></field>
     <field type="CharField" name="vcs_url">git://two/</field>
-    <field type="CharField" name="vcs_web_url"><None></None></field>
-    <field type="CharField" name="vcs_web_tree_base_url"><None></None></field>
-    <field type="CharField" name="vcs_web_file_base_url"><None></None></field>
-    <field type="TextField" name="summary"><None></None></field>
-    <field type="TextField" name="description"><None></None></field>
   </object>
   <object pk="1" model="orm.layer_version">
-    <field to="orm.build" name="build" rel="ManyToOneRel"><None></None></field>
+    <field to="orm.build" name="build" rel="ManyToOneRel">1</field>
     <field to="orm.layer" name="layer" rel="ManyToOneRel">1</field>
     <field to="orm.layersource" name="layer_source" rel="ManyToOneRel">1</field>
     <field type="IntegerField" name="up_id"><None></None></field>
     <field type="DateTimeField" name="up_date"><None></None></field>
     <field to="orm.branch" name="up_branch" rel="ManyToOneRel">1</field>
-    <field type="CharField" name="branch"></field>
-    <field type="CharField" name="commit">master</field>
+    <field type="CharField" name="branch">master</field>
+    <field type="CharField" name="commit">abcdef123</field>
     <field type="CharField" name="dirpath">/tmp/</field>
     <field type="IntegerField" name="priority">0</field>
     <field type="FilePathField" name="local_path">/</field>
@@ -405,8 +401,22 @@
     <field type="IntegerField" name="up_id"><None></None></field>
     <field type="DateTimeField" name="up_date"><None></None></field>
     <field to="orm.branch" name="up_branch" rel="ManyToOneRel">1</field>
-    <field type="CharField" name="branch"></field>
-    <field type="CharField" name="commit">master</field>
+    <field type="CharField" name="branch">testing-branch</field>
+    <field type="CharField" name="commit">9876fedcba</field>
+    <field type="CharField" name="dirpath"><None></None></field>
+    <field type="IntegerField" name="priority">0</field>
+    <field type="FilePathField" name="local_path">/</field>
+    <field to="orm.project" name="project" rel="ManyToOneRel"><None></None></field>
+  </object>
+  <object pk="3" model="orm.layer_version">
+    <field to="orm.build" name="build" rel="ManyToOneRel">1</field>
+    <field to="orm.layer" name="layer" rel="ManyToOneRel">2</field>
+    <field to="orm.layersource" name="layer_source" rel="ManyToOneRel">1</field>
+    <field type="IntegerField" name="up_id"><None></None></field>
+    <field type="DateTimeField" name="up_date"><None></None></field>
+    <field to="orm.branch" name="up_branch" rel="ManyToOneRel">1</field>
+    <field type="CharField" name="branch">testing-branch</field>
+    <field type="CharField" name="commit">9876fedcba</field>
     <field type="CharField" name="dirpath"><None></None></field>
     <field type="IntegerField" name="priority">0</field>
     <field type="FilePathField" name="local_path">/</field>
@@ -443,4 +453,39 @@
     <field type="FilePathField" name="pathname"></field>
     <field type="IntegerField" name="lineno"><None></None></field>
   </object>
+  <!-- Some tasks for build 1 to test build tables -->
+  <object pk="1" model="orm.task">
+    <field to="orm.build" name="build" rel="ManyToOneRel">1</field>
+    <field type="IntegerField" name="order">1</field>
+    <field type="BooleanField" name="task_executed">False</field>
+    <field type="IntegerField" name="outcome">-1</field>
+    <field type="CharField" name="sstate_checksum">abcdef123</field>
+    <field type="FilePathField" name="path_to_sstate_obj">34/wefw.tar</field>
+    <field to="orm.recipe" name="recipe" rel="ManyToOneRel">1</field>
+    <field type="CharField" name="task_name">a_do_compile</field>
+    <field type="DecimalField" name="elapsed_time">100</field>
+    <field type="IntegerField" name="disk_io">10</field>
+    <field type="IntegerField" name="disk_io_read">11</field>
+    <field type="IntegerField" name="disk_io_write">12</field>
+    <field type="DecimalField" name="cpu_time_user">10.1</field>
+    <field type="DecimalField" name="cpu_time_system">10.2</field>
+    <field type="IntegerField" name="sstate_result">3</field>
+  </object>
+  <object pk="2" model="orm.task">
+    <field to="orm.build" name="build" rel="ManyToOneRel">1</field>
+    <field type="IntegerField" name="order">2</field>
+    <field type="BooleanField" name="task_executed">True</field>
+    <field type="IntegerField" name="outcome">2</field>
+    <field type="CharField" name="sstate_checksum">85bccb7802fd5f48</field>
+    <field type="FilePathField" name="path_to_sstate_obj">85/sstarpm.tgz</field>
+    <field to="orm.recipe" name="recipe" rel="ManyToOneRel">2</field>
+    <field type="CharField" name="task_name">z_do_package_write_rpm</field>
+    <field type="DecimalField" name="elapsed_time">245</field>
+    <field type="IntegerField" name="disk_io">12424</field>
+    <field type="IntegerField" name="disk_io_read">23423</field>
+    <field type="IntegerField" name="disk_io_write">83943</field>
+    <field type="DecimalField" name="cpu_time_user">20394.3</field>
+    <field type="DecimalField" name="cpu_time_system">5363.3</field>
+    <field type="IntegerField" name="sstate_result">1</field>
+  </object>
 </django-objects>
bitbake/lib/toaster/toastergui/tests.py +26 -14
index 869c39d..9af1018 100644
@@ -25,6 +25,7 @@ from django.test import TestCase
 from django.test.client import RequestFactory
 from django.core.urlresolvers import reverse
 from django.utils import timezone
+from django.db.models import Q
 
 from orm.models import Project, Release, BitbakeVersion, Package, LogMessage
 from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, Build
@@ -57,7 +58,6 @@ class ViewTests(TestCase):
 
         self.project = Project.objects.first()
         self.recipe1 = Recipe.objects.get(pk=2)
-        self.recipe2 = Recipe.objects.last()
         self.customr = CustomImageRecipe.objects.first()
         self.cust_package = CustomImagePackage.objects.first()
         self.package = Package.objects.first()
@@ -311,7 +311,6 @@ class ViewTests(TestCase):
 
         self.assertEqual(response.status_code, 200)
 
-
     def test_software_recipes_table(self):
         """Test structure returned for Software RecipesTable"""
         table = SoftwareRecipesTable()
@@ -319,27 +318,35 @@ class ViewTests(TestCase):
         response = table.get(request, pid=self.project.id)
         data = json.loads(response.content)
 
+        recipes = Recipe.objects.filter(Q(is_image=False))
+        self.assertTrue(len(recipes) > 1,
+                        "Need more than one software recipe to test "
+                        "SoftwareRecipesTable")
+
+        recipe1 = recipes[0]
+        recipe2 = recipes[1]
+
         rows = data['rows']
-        row1 = next(x for x in rows if x['name'] == self.recipe1.name)
-        row2 = next(x for x in rows if x['name'] == self.recipe2.name)
+        row1 = next(x for x in rows if x['name'] == recipe1.name)
+        row2 = next(x for x in rows if x['name'] == recipe2.name)
 
         self.assertEqual(response.status_code, 200, 'should be 200 OK status')
 
         # check other columns have been populated correctly
-        self.assertTrue(self.recipe1.name in row1['name'])
-        self.assertTrue(self.recipe1.version in row1['version'])
-        self.assertTrue(self.recipe1.description in
+        self.assertTrue(recipe1.name in row1['name'])
+        self.assertTrue(recipe1.version in row1['version'])
+        self.assertTrue(recipe1.description in
                         row1['get_description_or_summary'])
 
-        self.assertTrue(self.recipe1.layer_version.layer.name in
+        self.assertTrue(recipe1.layer_version.layer.name in
                         row1['layer_version__layer__name'])
 
-        self.assertTrue(self.recipe2.name in row2['name'])
-        self.assertTrue(self.recipe2.version in row2['version'])
-        self.assertTrue(self.recipe2.description in
+        self.assertTrue(recipe2.name in row2['name'])
+        self.assertTrue(recipe2.version in row2['version'])
+        self.assertTrue(recipe2.description in
                         row2['get_description_or_summary'])
 
-        self.assertTrue(self.recipe2.layer_version.layer.name in
+        self.assertTrue(recipe2.layer_version.layer.name in
                         row2['layer_version__layer__name'])
 
     def test_toaster_tables(self):
@@ -360,7 +367,9 @@ class ViewTests(TestCase):
                     'layerid': self.lver.pk,
                     'recipeid': self.recipe1.pk,
                     'recipe_id': image_recipe.pk,
-                    'custrecipeid': self.customr.pk}
+                    'custrecipeid': self.customr.pk,
+                    'build_id': 1,
+                    'target_id': 1}
 
             response = table.get(request, **args)
             return json.loads(response.content)
@@ -386,11 +395,14 @@ class ViewTests(TestCase):
 
         # Get a list of classes in tables module
         tables = inspect.getmembers(toastergui.tables, inspect.isclass)
+        tables.extend(inspect.getmembers(toastergui.buildtables,
+                                         inspect.isclass))
 
         for name, table_cls in tables:
             # Filter out the non ToasterTables from the tables module
             if not issubclass(table_cls, toastergui.widgets.ToasterTable) or \
-                table_cls == toastergui.widgets.ToasterTable:
+                table_cls == toastergui.widgets.ToasterTable or \
+               'Mixin' in name:
                 continue
 
             # Get the table data without any options, this also does the
Signature · 1 line
2.7.4
#8 lore raw
In reply to Michael Wood
Quoted 4 lines · On 23/05/2016 21:44, "[email protected] on behalf of Michael…

Port the main build tables in the build analysis area to ToasterTables.

This is the table for Installed packages, Tasks, Recipes, Packages, Time, CPU usage and Disk I/O

This is looking good. I've only found some small issues in the packages installed table. Here they come:

* When you load the table, the sorting by "Package" is not working properly. The first package shown is "packagegroup-core-full-cmdline-dev-utils", but it should be "acl"

* The package name should be a link to the package installed details page

* The dependencies and reverse dependencies popups are missing the links. The package name in the title should link to the 'dependencies' or 'reverse dependencies' tab in the package installed details page. Each package listed in the popovers should be a link to the corresponding package installed details page

And to finish up, a question / comment: "Approx size" and "Installed size" seem to show always the same figure. Are we sure they are different things? If they are different things but are always the same, is it worth showing both?

Thanks!

Belén

Quoted 50 lines

Michael Wood (7):
toaster: ToasterTable widget add an 'a' to Name in Exception class
toaster: port table for Built packages to ToasterTable
toaster: port Built recipes table to toastertables
toaster: port Task tables to ToasterTables widget
toaster: port Installed packages table to ToasterTable
toaster: table.js Add the ability to highlight a particular row
toaster: tests Add new build tables to tests

bitbake/lib/toaster/toastergui/buildtables.py | 563
++++++++++++++++++

.../fixtures/toastergui-unittest-data.xml          |  91 ++-
bitbake/lib/toaster/toastergui/static/js/table.js  |   9 +
bitbake/lib/toaster/toastergui/tables.py           |  10 +-
.../toastergui/templates/basebuildpage.html        |  26 +-
.../lib/toaster/toastergui/templates/bpackage.html | 108 ----
.../toastergui/templates/builddashboard.html       |   4 +-
.../templates/buildinfo-toastertable.html          |  25 +
.../toaster/toastergui/templates/buildtime.html    |   4 -
.../lib/toaster/toastergui/templates/recipes.html  | 113 ----
.../templates/snippets/gitrev_popover.html         |   8 +
.../lib/toaster/toastergui/templates/target.html   | 115 +---
bitbake/lib/toaster/toastergui/templates/task.html |   2 +-
.../lib/toaster/toastergui/templates/tasks.html    | 143 -----
bitbake/lib/toaster/toastergui/tests.py            |  40 +-
bitbake/lib/toaster/toastergui/urls.py             |  46 +-
bitbake/lib/toaster/toastergui/views.py            | 650
+--------------------
bitbake/lib/toaster/toastergui/widgets.py          |  11 +-
18 files changed, 763 insertions(+), 1205 deletions(-)

create mode 100644 bitbake/lib/toaster/toastergui/buildtables.py delete mode 100644 bitbake/lib/toaster/toastergui/templates/bpackage.html create mode 100644 bitbake/lib/toaster/toastergui/templates/buildinfo-toastertable.html delete mode 100644 bitbake/lib/toaster/toastergui/templates/buildtime.html delete mode 100644 bitbake/lib/toaster/toastergui/templates/recipes.html create mode 100644 bitbake/lib/toaster/toastergui/templates/snippets/gitrev_popover.html delete mode 100644 bitbake/lib/toaster/toastergui/templates/tasks.html

Signature · 7 lines
2.7.4

-- 
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster