summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster')
-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