Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id D4892E00D7B; Tue, 10 May 2016 09:39:49 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [134.134.136.65 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 7D9FDE00D71 for ; Tue, 10 May 2016 09:39:45 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 10 May 2016 09:39:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,605,1455004800"; d="scan'208";a="100645295" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by fmsmga004.fm.intel.com with ESMTP; 10 May 2016 09:39:14 -0700 Received: from irsmsx110.ger.corp.intel.com ([169.254.15.57]) by IRSMSX102.ger.corp.intel.com ([169.254.2.35]) with mapi id 14.03.0248.002; Tue, 10 May 2016 17:39:13 +0100 From: "Barros Pena, Belen" To: "toaster@yoctoproject.org" Thread-Topic: [Toaster] [PATCH 3/3] toaster: toastertables port table for Built packages Thread-Index: AQHRqeF+F6Asv8vfhkO6pduyp6thgZ+yYTKA Date: Tue, 10 May 2016 16:39:12 +0000 Message-ID: References: <1462568497-11378-1-git-send-email-michael.g.wood@intel.com> <1462568497-11378-3-git-send-email-michael.g.wood@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.6.3.160329 x-originating-ip: [10.237.224.39] MIME-Version: 1.0 Subject: [PATCH 3/3] toaster: toastertables port table for Built packages X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2016 16:39:49 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-ID: <5B156F8C807598428706574A850999E4@intel.com> Content-Transfer-Encoding: quoted-printable Apologies, the email below should have gone to the mailing list too, not just the person who submitted the patch. On 09/05/2016 11:56, "Barros Pena, Belen" wrote: > >>This is the table that displays all the packages built in the build. >>Build -> Packages > >This is mostly working. Just a couple of small issues: > >1. Something is not quite right with the default sorting. When you load >the table, the 'Package' column shows as the selected sorting criteria, >but the first package shown for my build is "qemuwrapper-cross-dev". >That's not quite right: the first package in that table given the sorting >criteria should be "base-files". Clicking on the heading sorts properly. > >2. In the dependencies and reverse dependencies popovers, the package name >in the popover title needs to be a link to the applicable information in >the package details page (dependencies or reverse dependencies). Each >package listed in the popover content should be a link to the >corresponding package details pages. You can see an example in the >'packages included' table. > > >3. We have a small issue with the 'Size' sorting: on the first click, >packages should be sorted in descending order (i.e. biggest package on >top). Just bringing it up for completeness: we have an issue in Bugzilla >for this (https://bugzilla.yoctoproject.org/show_bug.cgi?id=3D8859) so no >need to fix as part of this series. > >Thanks! > >Bel=E9n > >> >>Signed-off-by: Michael Wood >>--- >> bitbake/lib/toaster/toastergui/buildtables.py | 77 >>+++++++++++++++++ >> bitbake/lib/toaster/toastergui/tables.py | 1 + >> .../lib/toaster/toastergui/templates/bpackage.html | 97 >>++++------------------ >> bitbake/lib/toaster/toastergui/urls.py | 7 +- >> bitbake/lib/toaster/toastergui/views.py | 90 >>-------------------- >> 5 files changed, 99 insertions(+), 173 deletions(-) >> create mode 100644 bitbake/lib/toaster/toastergui/buildtables.py >> >>diff --git a/bitbake/lib/toaster/toastergui/buildtables.py >>b/bitbake/lib/toaster/toastergui/buildtables.py >>new file mode 100644 >>index 0000000..365fd5c >>--- /dev/null >>+++ b/bitbake/lib/toaster/toastergui/buildtables.py >>@@ -0,0 +1,77 @@ >>+# >>+# ex:ts=3D4:sw=3D4:sts=3D4: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 >>+ >>+class BuiltPackagesTable(tables.PackagesTable): >>+ def __init__(self, *args, **kwargs): >>+ super(BuiltPackagesTable, self).__init__(*args, **kwargs) >>+ self.title =3D "Packages built" >>+ >>+ def setup_queryset(self, *args, **kwargs): >>+ build =3D Build.objects.get(pk=3Dkwargs['build_id']) >>+ self.static_context_extra['build'] =3D build >>+ self.queryset =3D build.package_set.all().exclude(recipe=3DNone) >>+ >>+ def get_context_data(self, **kwargs): >>+ # Chain up to ToasterTable as we don't need anything from >>+ # PackagesTable >>+ context =3D super(tables.PackagesTable, >>self).get_context_data(**kwargs) >>+ context['build'] =3D Build.objects.get(pk=3Dkwargs['build_id']) >>+ return context >>+ >>+ def setup_columns(self, *args, **kwargs): >>+ super(BuiltPackagesTable, self).setup_columns(**kwargs) >>+ >>+ add_pkg_link_to =3D ['name', 'version', 'size', 'license'] >>+ add_recipe_link_to =3D ['recipe__name', 'recipe__version'] >>+ >>+ def get_link_value(column): >>+ >>+ column['static_data_name'] =3D column['field_name'] >>+ >>+ if column['static_data_template']: >>+ # Make sure any existing template is used >>+ return column['static_data_template'] >>+ else: >>+ # convert to the template style of variable >>+ return ('{{data.%s}}' % >>+ column['field_name'].replace('__', '.')) >>+ >>+ for column in self.columns: >>+ if column['field_name'] in add_pkg_link_to: >>+ column['static_data_template'] =3D ''' >>+ >+ {%% url "package_built_detail" extra.build.pk data.pk >>%%} >>+ ">%s >>+ ''' % get_link_value(column) >>+ >>+ elif column['field_name'] in add_recipe_link_to: >>+ column['static_data_template'] =3D (''' >>+ {%% if data.recipe %%} >>+ >+ {%% url "recipe" extra.build.pk data.recipe.pk %%} >>+ ">%(value)s >>+ {%% else %%} >>+ %(value)s >>+ {%% endif %%} >>+ ''') % {'value': get_link_value(column)} >>diff --git a/bitbake/lib/toaster/toastergui/tables.py >>b/bitbake/lib/toaster/toastergui/tables.py >>index 29b68de..94d757b 100644 >>--- a/bitbake/lib/toaster/toastergui/tables.py >>+++ b/bitbake/lib/toaster/toastergui/tables.py >>@@ -699,6 +699,7 @@ class PackagesTable(ToasterTable): >>=20 >> self.add_column(title=3D"Approx Size", >> orderable=3DTrue, >>+ field_name=3D"size", >> static_data_name=3D"size", >> static_data_template=3D"{% load projecttags %} \ >> {{data.size|filtered_filesizeformat}}") >>diff --git a/bitbake/lib/toaster/toastergui/templates/bpackage.html >>b/bitbake/lib/toaster/toastergui/templates/bpackage.html >>index 81973cb..a27586e 100644 >>--- a/bitbake/lib/toaster/toastergui/templates/bpackage.html >>+++ b/bitbake/lib/toaster/toastergui/templates/bpackage.html >>@@ -14,95 +14,28 @@ >> {% block buildinfomain %} >>
>>=20 >>-{% if not request.GET.filter and not request.GET.search and not >>objects.paginator.count %} >>- >>- >>-
>>+ {% if build.package_set.count =3D=3D 0 %} >>+ >>+
>>

>>- Packages >>+ Packages >>

>>-
>>-
>>+
>>+
>> No packages were built. 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. >>-
>>- >>-{% else %} >>- >>-
>>-

>>- {% if request.GET.search and objects.paginator.count > 0 %} >>- {{objects.paginator.count}} >>package{{objects.paginator.count|pluralize}} found >>- {%elif request.GET.search and objects.paginator.count =3D=3D 0%} >>- No packages found >>- {%else%} >>- Packages >>- {%endif%} >>-

>>-
>>- >>- {% if objects.paginator.count =3D=3D 0 %} >>-
>>-
>>-
>>- >type=3D"text" value=3D"{{request.GET.search}}"/>{% if request.GET.search = %}>href=3D"javascript:$('#search').val('');searchform.submit()" class=3D"add= -on >>btn" tabindex=3D"-1">{% endif %} >>- >>- >>-
>>-
>>
>>=20 >> {% else %} >>- {% include "basetable_top.html" %} >>- >>- {% for package in objects %} >>=20 >>- >>- >>- >>- >build.pk package.pk %}">{{package.name}} >>- >>- {%if package.version%}>url "package_built_detail" build.pk package.pk >>%}">{{package.version}}-{{package.revision}}{%endif%} >>- >>- >sizecol">{{package.size|filtered_filesizeformat}} >>- >>- {{package.license}} >>- >>- {%if package.recipe%} >>- >>- >package.recipe.pk %}">{{package.recipe.name}} >>- >>- >build.pk package.recipe.pk %}">{{package.recipe.version}} >>- >>- >>- >class=3D"recipe__layer_version__layer__name">{{package.recipe.layer_versi= on >>. >>layer.name}} >>- >>- >class=3D"recipe__layer_version__branch">{{package.recipe.layer_version.br= an >>c >>h}} >>- >>- >>- >- data-content=3D"
    >>-
  • {{package.recipe.layer_version.commit}}
  • >>-
"> >>- =20 >>{{package.recipe.layer_version.commit|truncatechars:13}} >>-
>>- >>- >>- {%else%} >>- >>- >>- >>- >>- >>- >>- {%endif%} >>- >>- >>- {% endfor %} >>- >>- {% include "basetable_bottom.html" %} >>- {% endif %} {# objects.paginator.count #} >>-{% endif %} {# Empty #} >>-
>>+ {% url 'builtpackagestable' build.id as xhr_table_url %} >>+
>>+

>>+ {{title}} (0) >>

>>+ >>+
>>+ {% include "toastertable.html" %} >>+ {% endif %} {# end if packages #} >>+
>> {% endblock %} >>diff --git a/bitbake/lib/toaster/toastergui/urls.py >>b/bitbake/lib/toaster/toastergui/urls.py >>index 27b0baa..b4c7e0e 100644 >>--- a/bitbake/lib/toaster/toastergui/urls.py >>+++ b/bitbake/lib/toaster/toastergui/urls.py >>@@ -21,6 +21,7 @@ from django.views.generic import RedirectView, >>TemplateView >>=20 >> from django.http import HttpResponseBadRequest >> from toastergui import tables >>+from toastergui import buildtables >> from toastergui import typeaheads >> from toastergui import api >>=20 >>@@ -44,7 +45,11 @@ urlpatterns =3D patterns('toastergui.views', >> url(r'^build/(?P\d+)/recipe/(?P\d+)$', >>'recipe', name=3D'recipe'), >> =20 >>url(r'^build/(?P\d+)/recipe_packages/(?P\d+)$', >>'recipe_packages', name=3D'recipe_packages'), >>=20 >>- url(r'^build/(?P\d+)/packages/$', 'bpackage', >>name=3D'packages'), >>+ url(r'^build/(?P\d+)/packages/$', >>+ buildtables.BuiltPackagesTable.as_view( >>+ template_name=3D"bpackage.html"), >>+ name=3D'packages'), >>+ >> url(r'^build/(?P\d+)/package/(?P\d+)$', >>'package_built_detail', >> name=3D'package_built_detail'), >> =20 >>url(r'^build/(?P\d+)/package_built_dependencies/(?P >>\ >>d+)$', >>diff --git a/bitbake/lib/toaster/toastergui/views.py >>b/bitbake/lib/toaster/toastergui/views.py >>index bd5bf63..6e34008 100755 >>--- a/bitbake/lib/toaster/toastergui/views.py >>+++ b/bitbake/lib/toaster/toastergui/views.py >>@@ -1474,96 +1474,6 @@ def configvars(request, build_id): >> _set_parameters_values(pagesize, orderby, request) >> return response >>=20 >>-def bpackage(request, build_id): >>- template =3D 'bpackage.html' >>- (pagesize, orderby) =3D _get_parameters_values(request, 100, 'name:+= ') >>- mandatory_parameters =3D { 'count' : pagesize, 'page' : 1, 'orderby= ' >>: orderby } >>- retval =3D _verify_parameters( request.GET, mandatory_parameters ) >>- if retval: >>- return _redirect_parameters( 'packages', request.GET, >>mandatory_parameters, build_id =3D build_id) >>- (filter_string, search_term, ordering_string) =3D >>_search_tuple(request, Package) >>- queryset =3D Package.objects.filter(build =3D >>build_id).filter(size__gte=3D0) >>- queryset =3D _get_queryset(Package, queryset, filter_string, >>search_term, ordering_string, 'name') >>- >>- packages =3D _build_page_range(Paginator(queryset, >>pagesize),request.GET.get('page', 1)) >>- >>- build =3D Build.objects.get( pk =3D build_id ) >>- >>- context =3D { >>- 'objectname': 'packages built', >>- 'build': build, >>- 'project': build.project, >>- 'objects' : packages, >>- 'default_orderby' : 'name:+', >>- 'tablecols':[ >>- { >>- 'name':'Package', >>- 'qhelp':'Packaged output resulting from building a >>recipe', >>- 'orderfield': _get_toggle_order(request, "name"), >>- 'ordericon':_get_toggle_order_icon(request, "name"), >>- }, >>- { >>- 'name':'Package version', >>- 'qhelp':'The package version and revision', >>- }, >>- { >>- 'name':'Size', >>- 'qhelp':'The size of the package', >>- 'orderfield': _get_toggle_order(request, "size", True), >>- 'ordericon':_get_toggle_order_icon(request, "size"), >>- 'orderkey' : 'size', >>- 'clclass': 'size', 'hidden': 0, >>- 'dclass' : 'span2', >>- }, >>- { >>- 'name':'License', >>- 'qhelp':'The license under which the package is >>distributed. 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', >>- 'orderfield': _get_toggle_order(request, "license"), >>- 'ordericon':_get_toggle_order_icon(request, "license"), >>- 'orderkey' : 'license', >>- 'clclass': 'license', 'hidden': 1, >>- }, >>- { >>- 'name':'Recipe', >>- 'qhelp':'The name of the recipe building the package', >>- 'orderfield': _get_toggle_order(request, >>"recipe__name"), >>- 'ordericon':_get_toggle_order_icon(request, >>"recipe__name"), >>- 'orderkey' : 'recipe__name', >>- 'clclass': 'recipe__name', 'hidden': 0, >>- }, >>- { >>- 'name':'Recipe version', >>- 'qhelp':'Version and revision of the recipe building the >>package', >>- 'clclass': 'recipe__version', 'hidden': 1, >>- }, >>- { >>- 'name':'Layer', >>- 'qhelp':'The name of the layer providing the recipe that >>builds the package', >>- 'orderfield': _get_toggle_order(request, >>"recipe__layer_version__layer__name"), >>- 'ordericon':_get_toggle_order_icon(request, >>"recipe__layer_version__layer__name"), >>- 'orderkey' : 'recipe__layer_version__layer__name', >>- 'clclass': 'recipe__layer_version__layer__name', >>'hidden': 1, >>- }, >>- { >>- 'name':'Layer branch', >>- 'qhelp':'The Git branch of the layer providing the >>recipe that builds the package', >>- 'orderfield': _get_toggle_order(request, >>"recipe__layer_version__branch"), >>- 'ordericon':_get_toggle_order_icon(request, >>"recipe__layer_version__branch"), >>- 'orderkey' : 'recipe__layer_version__branch', >>- 'clclass': 'recipe__layer_version__branch', 'hidden': 1, >>- }, >>- { >>- 'name':'Layer commit', >>- 'qhelp':'The Git commit of the layer providing the >>recipe that builds the package', >>- 'clclass': 'recipe__layer_version__layer__commit', >>'hidden': 1, >>- }, >>- ] >>- } >>- >>- response =3D render(request, template, context) >>- _set_parameters_values(pagesize, orderby, request) >>- return response >>- >> def bfile(request, build_id, package_id): >> template =3D 'bfile.html' >> files =3D Package_File.objects.filter(package =3D package_id) >>--=20 >>2.7.4 >> >>--=20 >>_______________________________________________ >>toaster mailing list >>toaster@yoctoproject.org >>https://lists.yoctoproject.org/listinfo/toaster >