From 51e83c8d31449eb314a9d7e93545f78de2898d87 Mon Sep 17 00:00:00 2001 From: Amanda Brindle Date: Fri, 15 Dec 2017 13:06:53 -0800 Subject: update_layer.py: Save and show recipe dependencies Added a model for the PACKAGECONFIG variable, which has a one to many relationship with the Recipe model. Added models for static build dependencies and dynamic build dependencies, both of which have a many to many relationship with the Recipe model. These objects are created in update_layer.py and are displayed on the Recipe detail page. Added a depends search option for recipes, allowing users to search for recipes that depend on any particular recipe. Use "depends:recipename" in the recipe search to activate this. Fixes [YOCTO #12129] Fixes [YOCTO #11415] Signed-off-by: Amanda Brindle Signed-off-by: Paul Eggleton --- layerindex/views.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'layerindex/views.py') diff --git a/layerindex/views.py b/layerindex/views.py index 414c770451..ccb85b80a2 100644 --- a/layerindex/views.py +++ b/layerindex/views.py @@ -10,7 +10,7 @@ from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidde from django.core.urlresolvers import reverse, reverse_lazy, resolve from django.core.exceptions import PermissionDenied from django.template import RequestContext -from layerindex.models import Branch, LayerItem, LayerMaintainer, LayerBranch, LayerDependency, LayerNote, Update, LayerUpdate, Recipe, Machine, Distro, BBClass, BBAppend, RecipeChange, RecipeChangeset, ClassicRecipe +from layerindex.models import Branch, LayerItem, LayerMaintainer, LayerBranch, LayerDependency, LayerNote, Update, LayerUpdate, Recipe, Machine, Distro, BBClass, BBAppend, RecipeChange, RecipeChangeset, ClassicRecipe, StaticBuildDep, DynamicBuildDep from datetime import datetime from django.views.generic import TemplateView, DetailView, ListView from django.views.generic.edit import CreateView, DeleteView, UpdateView @@ -428,6 +428,19 @@ class RecipeSearchView(ListView): for item in query_items: if item.startswith('inherits:'): inherits.append(item.split(':')[1]) + + # support searches by build dependencies + elif item.startswith('depends:'): + depsearch = item.split(':')[1] + qobj = Q(pk__in=[]) + static_build_dependencies = StaticBuildDep.objects.filter(name=depsearch).first() + dynamic_build_dependencies = DynamicBuildDep.objects.filter(name=depsearch).first() + if static_build_dependencies: + qobj |= Q(staticbuilddep=static_build_dependencies) + if dynamic_build_dependencies: + qobj |= Q(dynamicbuilddep=dynamic_build_dependencies) + init_qs = init_qs.filter(qobj).distinct() + # support searches by layer name elif item.startswith('layer:'): query_layername = item.split(':')[1].strip().lower() @@ -845,6 +858,8 @@ class RecipeDetailView(DetailView): if append.matches_recipe(recipe): verappends.append(append) context['verappends'] = verappends + context['packageconfigs'] = recipe.packageconfig_set.order_by('feature') + context['staticdependencies'] = recipe.staticbuilddep_set.order_by('name') return context -- cgit 1.2.3-korg