aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-05-26 16:12:21 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-15 08:35:04 +0100
commit32d1e2dd25f288790450db48766cf115854712ba (patch)
tree0957025538fdd29b111884891f14becc55dcc018 /bitbake/lib
parenta786ac14f1c6c02c38dc141125035445413f1250 (diff)
downloadopenembedded-core-contrib-32d1e2dd25f288790450db48766cf115854712ba.tar.gz
bitbake: toaster: port Built recipes table to toastertables
(Bitbake rev: 9434d3925bb7768876aae8d649ea00b8d849c6e9) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/toaster/toastergui/buildtables.py129
-rw-r--r--bitbake/lib/toaster/toastergui/templates/recipes.html111
-rw-r--r--bitbake/lib/toaster/toastergui/urls.py7
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py111
4 files changed, 135 insertions, 223 deletions
diff --git a/bitbake/lib/toaster/toastergui/buildtables.py b/bitbake/lib/toaster/toastergui/buildtables.py
index cf07ea8789..dc742b9fe5 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 =\
+ '<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)
diff --git a/bitbake/lib/toaster/toastergui/templates/recipes.html b/bitbake/lib/toaster/toastergui/templates/recipes.html
deleted file mode 100644
index fe06f8b205..0000000000
--- a/bitbake/lib/toaster/toastergui/templates/recipes.html
+++ /dev/null
@@ -1,111 +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 %}
-<li>Recipes</li>
-{% endblock %}
-
-{% block nav-recipes %}
- <li class="active"><a href="{% url 'recipes' build.pk %}">Recipes</a></li>
-{% endblock %}
-
-{% block buildinfomain %}
-<div class="col-md-10">
-<div class="page-header">
-<h1>
- {% if request.GET.search and objects.paginator.count > 0 %}
- {{objects.paginator.count}} recipe{{objects.paginator.count|pluralize}} found
- {%elif request.GET.search and objects.paginator.count == 0%}
- No recipes found
- {%else%}
- Recipes
- {%endif%}
- </h1>
-</div>
-
-{% if objects.paginator.count == 0 %}
-<div class="alert">
- <form class="no-results input-append" id="searchform">
- <input id="search" name="search" class="input-xxlarge" type="text" value="{%if request.GET.search%}{{request.GET.search}}{%endif%}"/>{% if request.GET.search %}<a href="javascript:$('#search').val('');searchform.submit()" class="input-append-addon btn" tabindex="-1"><i class="glyphicon glyphicon-remove"></i></a>{% endif %}
- <button class="btn" type="submit" value="Search">Search</button>
- <button class="btn btn-link" onclick="javascript:$('#search').val('');searchform.submit()">Show all recipes</button>
- </form>
-</div>
-
-{% else %}
-{% include "basetable_top.html" %}
-
- {% for recipe in objects %}
-
- <tr class="data">
- <td class="recipe__name">
- <a href="{% url "recipe" build.pk recipe.pk %}">{{recipe.name}}</a>
- </td>
- <td class="recipe__version">
- <a href="{% url "recipe" build.pk recipe.pk %}">{{recipe.version}}</a>
- </td>
- <!-- Depends -->
- <td class="depends_on">
- {% with deps=recipe_deps|get_dict_value:recipe.pk %}
- {% with count=deps|length %}
- {% if count %}
- <a class="btn"
- title="<a href='{% url "recipe" build.pk recipe.pk %}#dependencies'>{{recipe.name}}</a> dependencies"
- data-content="<ul class='list-unstyled'>
- {% for i in deps|dictsort:"depends_on.name"%}
- <li><a href='{% url "recipe" build.pk i.depends_on.pk %}'>{{i.depends_on.name}}</a></li>
- {% endfor %}
- </ul>">
- {{count}}
- </a>
- {% endif %}
- {% endwith %}
- {% endwith %}
- </td>
- <!-- Brought in by -->
- <td class="depends_by">
- {% with revs=recipe_revs|get_dict_value:recipe.pk %}
- {% with count=revs|length %}
- {% if count %}
- <a class="btn"
- title="<a href='{% url "recipe" build.pk recipe.pk %}#brought-in-by'>{{recipe.name}}</a> reverse dependencies"
- data-content="<ul class='list-unstyled'>
- {% for i in revs|dictsort:"recipe.name" %}
- <li><a href='{% url "recipe" build.pk i.recipe.pk %}'>{{i.recipe.name}}</a></li>
- {% endfor %}
- </ul>">
- {{count}}
- </a>
- {% endif %}
- {% endwith %}
- {% endwith %}
- </td>
- <!-- Recipe file -->
- <td class="recipe_file">{{recipe.file_path}} {% if recipe.pathflags %}<i>({{recipe.pathflags}})</i>{% endif %}</td>
- <!-- Section -->
- <td class="recipe_section">{{recipe.section}}</td>
- <!-- License -->
- <td class="recipe_license">{{recipe.license}}</td>
- <!-- Layer -->
- <td class="layer_version__layer__name">{{recipe.layer_version.layer.name}}</td>
- <!-- Layer branch -->
- <td class="layer_version__branch">{{recipe.layer_version.branch}}</td>
- <!-- Layer commit -->
- <td class="layer_version__layer__commit">
- <a class="btn"
- data-content="<ul class='list-unstyled'>
- <li>{{recipe.layer_version.commit}}</li>
- </ul>">
- {{recipe.layer_version.commit|truncatechars:13}}
- </a>
- </td>
- </tr>
-
- {% endfor %}
-
-{% include "basetable_bottom.html" %}
-{% endif %}
-</div>
-{% endblock %}
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py
index 3ce0d51011..0636c956b2 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<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'),
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index de1e4139a1..3a25d5ea1e 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -1274,117 +1274,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'