Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 2BD92E00870; Mon, 23 May 2016 13:44:30 -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=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FSL_HELO_HOME,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [74.125.82.54 listed in list.dnswl.org] * 1.0 FSL_HELO_HOME FSL_HELO_HOME * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 27125E007E8 for ; Mon, 23 May 2016 13:44:24 -0700 (PDT) Received: by mail-wm0-f54.google.com with SMTP id n129so98035297wmn.1 for ; Mon, 23 May 2016 13:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2ABKudCN0y1702Fd6Krx6o6AZ3O4V9/KuigGOA0HYLc=; b=frcfuor2al5T8dTgXYwpVXUZuIsgMbc/yaxjaYPhrsGiH1dEk68ccRDg2KT+QYag2r DapcSo/mhG4SiWNKkJsdz/PqZCgqusmhy5zgR9l80z5jLZn5ZmO8+fNzixI+mPE0rinD M7ytIj2eGNj8TTQu373Zh93UDxZ4pTDw6EAHqKr5mYlWUnnWYweHQpdSnJuX08DhRMr+ PqsQbJ8T01LbUflvaxQBXiJKiGtfC2On438VvtATp1NzFaph1LZ1FfLO7TUFNdEnV/j6 nQ2GuY6rFGgfYWMQvxr3vwKYF1FOhfRt1bkcCsaswWnLcErV9ZAN5ksBJKloOnI2129d lDoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2ABKudCN0y1702Fd6Krx6o6AZ3O4V9/KuigGOA0HYLc=; b=Bg1okW1IU/oAdE/RI44AYBOZwwbM3g8Z9ATn6R92i0HBpztJ1bsxwCd/5k08Ok/uWh ZBGkWTIDqWhuFLQckPoj+FsX2kcsdWlBLkFjWzZR356y/Bi42X8Fc0pp2P18iihd2dRv ASS4kC4FyZhFrlPEaY+6AmJRBHf6+2M6BwmBP2qU0ZdvPP0SzNED1jBd8rGoFv5TmpQK Qr4y84eOnoGWWyTfbVvklL8kkkzbLN7str/PdWYF6ftCBh4t+9XGiykwkBKCtYjobFT1 /nhR3n5qw0EZ7E5b6pBIywrdrJbFNzNKz7km46VQVR+4PUs9RIubcUKq2CkkwEelTBo/ UwxA== X-Gm-Message-State: ALyK8tI4utl/6/xbweA85Vmc/LYI6mkmNg44ifOt6P+xWdta7TuNDJyVYj9OR2VJ3fV0Osyq X-Received: by 10.194.145.9 with SMTP id sq9mr733256wjb.140.1464036263560; Mon, 23 May 2016 13:44:23 -0700 (PDT) Received: from orion.home (host31-48-249-108.range31-48.btcentralplus.com. [31.48.249.108]) by smtp.gmail.com with ESMTPSA id h14sm12035619wme.1.2016.05.23.13.44.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 May 2016 13:44:22 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Mon, 23 May 2016 21:44:13 +0100 Message-Id: <1464036257-23434-4-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464036257-23434-1-git-send-email-michael.g.wood@intel.com> References: <1464036257-23434-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 3/7] toaster: port Built recipes table to toastertables 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: Mon, 23 May 2016 20:44:30 -0000 Signed-off-by: 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 diff --git a/bitbake/lib/toaster/toastergui/buildtables.py b/bitbake/lib/toaster/toastergui/buildtables.py index cf07ea8..dc742b9 100644 --- a/bitbake/lib/toaster/toastergui/buildtables.py +++ b/bitbake/lib/toaster/toastergui/buildtables.py @@ -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 =\ + ''\ + '{{data.name}}'\ + '' + + recipe_version_tmpl =\ + ''\ + '{{data.version}}'\ + '' + + recipe_file_tmpl =\ + '{{data.file_path}}'\ + '{% if data.pathflags %}({{data.pathflags}})'\ + '{% 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 %} + + {{data.name}} dependencies" + data-content=""> + {{count}} + + {% endif %}{% endwith %}{% endwith %} + ''' + + rev_depends_tmpl = ''' + {% with revs=data.r_dependencies_depends.all %} + {% with count=revs|length %} + {% if count %} + + {{data.name}} reverse dependencies" + data-content=""> + {{count}} + + {% 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) diff --git a/bitbake/lib/toaster/toastergui/templates/recipes.html b/bitbake/lib/toaster/toastergui/templates/recipes.html deleted file mode 100644 index d144893..0000000 --- a/bitbake/lib/toaster/toastergui/templates/recipes.html +++ /dev/null @@ -1,113 +0,0 @@ -{% extends "basebuildpage.html" %} - -{% load projecttags %} - -{% block title %} Recipes - {{build.target_set.all|dictsort:"target"|join:", "}} {{build.machine}} - {{build.project.name}} - Toaster {% endblock %} -{% block localbreadcrumb %} -
  • Recipes
  • -{% endblock %} - -{% block nav-recipes %} -
  • Recipes
  • -{% endblock %} - -{% block buildinfomain %} -
    - - -{% if objects.paginator.count == 0 %} -
    -
    -
    - {% if request.GET.search %}{% endif %} - - -
    -
    -
    - -{% else %} -{% include "basetable_top.html" %} - - {% for recipe in objects %} - - - - {{recipe.name}} - - - {{recipe.version}} - - - - {% with deps=recipe_deps|get_dict_value:recipe.pk %} - {% with count=deps|length %} - {% if count %} - {{recipe.name}} dependencies" - data-content=""> - {{count}} - - {% endif %} - {% endwith %} - {% endwith %} - - - - {% with revs=recipe_revs|get_dict_value:recipe.pk %} - {% with count=revs|length %} - {% if count %} - {{recipe.name}} reverse dependencies" - data-content=""> - {{count}} - - {% endif %} - {% endwith %} - {% endwith %} - - - {{recipe.file_path}} {% if recipe.pathflags %}({{recipe.pathflags}}){% endif %} - - {{recipe.section}} - - {{recipe.license}} - - {{recipe.layer_version.layer.name}} - - {{recipe.layer_version.branch}} - - - - {{recipe.layer_version.commit|truncatechars:13}} - - - - - {% endfor %} - -{% include "basetable_bottom.html" %} -{% endif %} -
    -{% endblock %} diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index 3ce0d51..0636c95 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py @@ -40,8 +40,13 @@ urlpatterns = patterns('toastergui.views', url(r'^build/(?P\d+)/tasks/(?P\d+)/$', 'tasks_task', name='tasks_task'), url(r'^build/(?P\d+)/task/(?P\d+)$', 'task', name='task'), - url(r'^build/(?P\d+)/recipes/$', 'recipes', name='recipes'), + url(r'^build/(?P\d+)/recipes/$', + buildtables.BuiltRecipesTable.as_view( + template_name="buildinfo-toastertable.html"), + name='recipes'), + url(r'^build/(?P\d+)/recipe/(?P\d+)/active_tab/(?P\d{1})$', 'recipe', name='recipe'), + url(r'^build/(?P\d+)/recipe/(?P\d+)$', 'recipe', name='recipe'), url(r'^build/(?P\d+)/recipe_packages/(?P\d+)$', 'recipe_packages', name='recipe_packages'), diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 3c19ec6..4995e9b 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -1255,117 +1255,6 @@ def diskio(request, build_id): def cputime(request, build_id): return tasks_common(request, build_id, 'cputime', '') -def recipes(request, build_id): - template = 'recipes.html' - (pagesize, orderby) = _get_parameters_values(request, 100, 'name:+') - mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby' : orderby } - retval = _verify_parameters( request.GET, mandatory_parameters ) - if retval: - return _redirect_parameters( 'recipes', request.GET, mandatory_parameters, build_id = build_id) - (filter_string, search_term, ordering_string) = _search_tuple(request, Recipe) - - build = Build.objects.get(pk=build_id) - - queryset = build.get_recipes() - queryset = _get_queryset(Recipe, queryset, filter_string, search_term, ordering_string, 'name') - - recipes = _build_page_range(Paginator(queryset, pagesize),request.GET.get('page', 1)) - - # prefetch the forward and reverse recipe dependencies - deps = { } - revs = { } - queryset_dependency=Recipe_Dependency.objects.filter(recipe__layer_version__build_id = build_id).select_related("depends_on", "recipe") - for recipe in recipes: - deplist = [ ] - for recipe_dep in [x for x in queryset_dependency if x.recipe_id == recipe.id]: - deplist.append(recipe_dep) - deps[recipe.id] = deplist - revlist = [ ] - for recipe_dep in [x for x in queryset_dependency if x.depends_on_id == recipe.id]: - revlist.append(recipe_dep) - revs[recipe.id] = revlist - - context = { - 'objectname': 'recipes', - 'build': build, - 'project': build.project, - 'objects': recipes, - 'default_orderby' : 'name:+', - 'recipe_deps' : deps, - 'recipe_revs' : revs, - 'tablecols':[ - { - 'name':'Recipe', - 'qhelp':'Information about a single piece of software, including where to download the source, configuration options, how to compile the source files and how to package the compiled output', - 'orderfield': _get_toggle_order(request, "name"), - 'ordericon':_get_toggle_order_icon(request, "name"), - }, - { - 'name':'Recipe version', - 'qhelp':'The recipe version and revision', - }, - { - 'name':'Dependencies', - 'qhelp':'Recipe build-time dependencies (i.e. other recipes)', - 'clclass': 'depends_on', 'hidden': 1, - }, - { - 'name':'Reverse dependencies', - 'qhelp':'Recipe build-time reverse dependencies (i.e. the recipes that depend on this recipe)', - 'clclass': 'depends_by', 'hidden': 1, - }, - { - 'name':'Recipe file', - 'qhelp':'Path to the recipe .bb file', - 'orderfield': _get_toggle_order(request, "file_path"), - 'ordericon':_get_toggle_order_icon(request, "file_path"), - 'orderkey' : 'file_path', - 'clclass': 'recipe_file', 'hidden': 0, - }, - { - 'name':'Section', - 'qhelp':'The section in which recipes should be categorized', - 'orderfield': _get_toggle_order(request, "section"), - 'ordericon':_get_toggle_order_icon(request, "section"), - 'orderkey' : 'section', - 'clclass': 'recipe_section', 'hidden': 0, - }, - { - 'name':'License', - 'qhelp':'The list of source licenses for the recipe. 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': 'recipe_license', 'hidden': 0, - }, - { - 'name':'Layer', - 'qhelp':'The name of the layer providing the recipe', - 'orderfield': _get_toggle_order(request, "layer_version__layer__name"), - 'ordericon':_get_toggle_order_icon(request, "layer_version__layer__name"), - 'orderkey' : 'layer_version__layer__name', - 'clclass': 'layer_version__layer__name', 'hidden': 0, - }, - { - 'name':'Layer branch', - 'qhelp':'The Git branch of the layer providing the recipe', - 'orderfield': _get_toggle_order(request, "layer_version__branch"), - 'ordericon':_get_toggle_order_icon(request, "layer_version__branch"), - 'orderkey' : 'layer_version__branch', - 'clclass': 'layer_version__branch', 'hidden': 1, - }, - { - 'name':'Layer commit', - 'qhelp':'The Git commit of the layer providing the recipe', - 'clclass': 'layer_version__layer__commit', 'hidden': 1, - }, - ] - } - - response = render(request, template, context) - _set_parameters_values(pagesize, orderby, request) - return response - def configuration(request, build_id): template = 'configuration.html' -- 2.7.4