summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-12-08 11:29:23 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-10 13:29:18 +0000
commit9ea4de6d801d57a35e46cb6e433b3fbcc71d378f (patch)
tree9b5a2d4543bd8fab21d51017f790d23c733b1462 /bitbake
parent20f400b7bdfa492881cff6ce255676c8d4c518ca (diff)
downloadpoky-9ea4de6d801d57a35e46cb6e433b3fbcc71d378f.tar.gz
bitbake: toaster: tables Change SelectPackagesTable to use ProjectPackage
This changes the SelectPackagesTable to use the ProjectPackage table instead of very large expensive queries to retrieve a list of currently available packages for the project. (Bitbake rev: 4b4b7e28d602ac5283659f806d695cc0451d292e) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/tables.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py
index ecca22037a..48829351b4 100644
--- a/bitbake/lib/toaster/toastergui/tables.py
+++ b/bitbake/lib/toaster/toastergui/tables.py
@@ -22,8 +22,8 @@
22from toastergui.widgets import ToasterTable 22from toastergui.widgets import ToasterTable
23from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project 23from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project
24from orm.models import CustomImageRecipe, Package, Target, Build, LogMessage, Task 24from orm.models import CustomImageRecipe, Package, Target, Build, LogMessage, Task
25from orm.models import ProjectTarget 25from orm.models import CustomImagePackage, ProjectTarget
26from django.db.models import Q, Max, Count, When, Case, Value, IntegerField 26from django.db.models import Q, Max, Sum, Count, When, Case, Value, IntegerField
27from django.conf.urls import url 27from django.conf.urls import url
28from django.core.urlresolvers import reverse, resolve 28from django.core.urlresolvers import reverse, resolve
29from django.http import HttpResponse 29from django.http import HttpResponse
@@ -731,15 +731,19 @@ class SelectPackagesTable(PackagesTable):
731 cust_recipe = CustomImageRecipe.objects.get(pk=kwargs['recipeid']) 731 cust_recipe = CustomImageRecipe.objects.get(pk=kwargs['recipeid'])
732 prj = Project.objects.get(pk = kwargs['pid']) 732 prj = Project.objects.get(pk = kwargs['pid'])
733 733
734 current_packages = cust_recipe.packages.all() 734 current_packages = self.cust_recipe.get_all_packages()
735 735
736 # Get all the packages that are in the custom image 736 current_recipes = prj.get_available_recipes()
737 # Get all the packages built by builds in the current project 737
738 # but not those ones that are already in the custom image 738 # Exclude ghost packages and ones which have locale in the name
739 self.queryset = Package.objects.filter( 739 # This is a work around locale packages being dynamically created
740 Q(pk__in=current_packages) | 740 # and therefore not recognised as packages by bitbake.
741 (Q(build__project=prj) & 741 # We also only show packages which recipes->layers are in the project
742 ~Q(name__in=current_packages.values_list('name')))) 742 self.queryset = CustomImagePackage.objects.filter(
743 ~Q(recipe=None) &
744 Q(recipe__in=current_recipes) &
745 ~Q(name__icontains="locale") &
746 ~Q(name__icontains="packagegroup"))
743 747
744 self.queryset = self.queryset.order_by('name') 748 self.queryset = self.queryset.order_by('name')
745 749
@@ -752,7 +756,8 @@ class SelectPackagesTable(PackagesTable):
752 custom_recipe = CustomImageRecipe.objects.get(pk=kwargs['recipe_id']) 756 custom_recipe = CustomImageRecipe.objects.get(pk=kwargs['recipe_id'])
753 757
754 context['recipe'] = custom_recipe 758 context['recipe'] = custom_recipe
755 context['approx_pkg_size'] = custom_recipe.package_set.aggregate(Sum('size')) 759 context['approx_pkg_size'] = \
760 custom_recipe.get_all_packages().aggregate(Sum('size'))
756 return context 761 return context
757 762
758 763