summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/toaster/orm/models.py11
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py15
2 files changed, 16 insertions, 10 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 0f85c8fd0a..54cd5354de 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -362,11 +362,14 @@ class Task(models.Model):
362 return "Not Executed" 362 return "Not Executed"
363 363
364 def get_description(self): 364 def get_description(self):
365 helptext = HelpText.objects.filter(key=self.task_name, area=HelpText.VARIABLE, build=self.build) 365 if '_helptext' in vars(self) and self._helptext != None:
366 return self._helptext
366 try: 367 try:
367 return helptext[0].text 368 self._helptext = HelpText.objects.get(key=self.task_name, area=HelpText.VARIABLE, build=self.build).text
368 except IndexError: 369 except HelpText.DoesNotExit:
369 return '' 370 self._helptext = None
371
372 return self._helptext
370 373
371 build = models.ForeignKey(Build, related_name='task_build') 374 build = models.ForeignKey(Build, related_name='task_build')
372 order = models.IntegerField(null=True) 375 order = models.IntegerField(null=True)
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index eb323ec81d..a2e92068c5 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -75,8 +75,9 @@ def _project_recent_build_list(prj):
75 'build_time_page_url': reverse('buildtime', args=(y.pk,)), 75 'build_time_page_url': reverse('buildtime', args=(y.pk,)),
76 "errors": y.errors_no, 76 "errors": y.errors_no,
77 "warnings": y.warnings_no, 77 "warnings": y.warnings_no,
78 "completeper": y.completeper(), 78 "completeper": y.completeper() if y.outcome == Build.IN_PROGRESS else "0",
79 "eta": y.eta().strftime('%s')+"000"}, Build.objects.filter(buildrequest = x)), 79 "eta": y.eta().strftime('%s')+"000" if y.outcome == Build.IN_PROGRESS else "0",
80 }, Build.objects.filter(buildrequest = x)),
80 }, list(prj.buildrequest_set.filter(Q(state__lt=BuildRequest.REQ_COMPLETED) or Q(state=BuildRequest.REQ_DELETED)).order_by("-pk")) + 81 }, list(prj.buildrequest_set.filter(Q(state__lt=BuildRequest.REQ_COMPLETED) or Q(state=BuildRequest.REQ_DELETED)).order_by("-pk")) +
81 list(prj.buildrequest_set.filter(state__in=[BuildRequest.REQ_COMPLETED, BuildRequest.REQ_FAILED]).order_by("-pk")[:3])) 82 list(prj.buildrequest_set.filter(state__in=[BuildRequest.REQ_COMPLETED, BuildRequest.REQ_FAILED]).order_by("-pk")[:3]))
82 83
@@ -828,6 +829,8 @@ def tasks_common(request, build_id, variant, task_anchor):
828 else: 829 else:
829 queryset = _get_queryset(Task, queryset_all, filter_string, search_term, ordering_string, 'order') 830 queryset = _get_queryset(Task, queryset_all, filter_string, search_term, ordering_string, 'order')
830 831
832 queryset = queryset.select_related("recipe", "build")
833
831 # compute the anchor's page 834 # compute the anchor's page
832 if anchor: 835 if anchor:
833 request.GET = request.GET.copy() 836 request.GET = request.GET.copy()
@@ -1023,14 +1026,14 @@ def recipes(request, build_id):
1023 if retval: 1026 if retval:
1024 return _redirect_parameters( 'recipes', request.GET, mandatory_parameters, build_id = build_id) 1027 return _redirect_parameters( 'recipes', request.GET, mandatory_parameters, build_id = build_id)
1025 (filter_string, search_term, ordering_string) = _search_tuple(request, Recipe) 1028 (filter_string, search_term, ordering_string) = _search_tuple(request, Recipe)
1026 queryset = Recipe.objects.filter(layer_version__id__in=Layer_Version.objects.filter(build=build_id)) 1029 queryset = Recipe.objects.filter(layer_version__id__in=Layer_Version.objects.filter(build=build_id)).select_related("layer_version", "layer_version__layer")
1027 queryset = _get_queryset(Recipe, queryset, filter_string, search_term, ordering_string, 'name') 1030 queryset = _get_queryset(Recipe, queryset, filter_string, search_term, ordering_string, 'name')
1028 1031
1029 recipes = _build_page_range(Paginator(queryset, pagesize),request.GET.get('page', 1)) 1032 recipes = _build_page_range(Paginator(queryset, pagesize),request.GET.get('page', 1))
1030 1033
1031 # prefetch the forward and reverse recipe dependencies 1034 # prefetch the forward and reverse recipe dependencies
1032 deps = { }; revs = { } 1035 deps = { }; revs = { }
1033 queryset_dependency=Recipe_Dependency.objects.filter(recipe__layer_version__build_id = build_id) 1036 queryset_dependency=Recipe_Dependency.objects.filter(recipe__layer_version__build_id = build_id).select_related("depends_on", "recipe")
1034 for recipe in recipes: 1037 for recipe in recipes:
1035 deplist = [ ] 1038 deplist = [ ]
1036 for recipe_dep in [x for x in queryset_dependency if x.recipe_id == recipe.id]: 1039 for recipe_dep in [x for x in queryset_dependency if x.recipe_id == recipe.id]:
@@ -1804,7 +1807,7 @@ if toastermain.settings.MANAGED:
1804 (filter_string, search_term, ordering_string) = _search_tuple(request, BuildRequest) 1807 (filter_string, search_term, ordering_string) = _search_tuple(request, BuildRequest)
1805 # we don't display in-progress or deleted builds 1808 # we don't display in-progress or deleted builds
1806 queryset_all = buildrequests.exclude(state = BuildRequest.REQ_DELETED) 1809 queryset_all = buildrequests.exclude(state = BuildRequest.REQ_DELETED)
1807 queryset_all = queryset_all.annotate(Count('brerror')) 1810 queryset_all = queryset_all.select_related("build", "build__project").annotate(Count('brerror'))
1808 queryset_with_search = _get_queryset(BuildRequest, queryset_all, filter_string, search_term, ordering_string, '-updated') 1811 queryset_with_search = _get_queryset(BuildRequest, queryset_all, filter_string, search_term, ordering_string, '-updated')
1809 1812
1810 1813
@@ -2179,7 +2182,7 @@ if toastermain.settings.MANAGED:
2179 # return all project settings 2182 # return all project settings
2180 return HttpResponse(jsonfilter( { 2183 return HttpResponse(jsonfilter( {
2181 "error": "ok", 2184 "error": "ok",
2182 "layers" : map(lambda x: {"id": x.layercommit.pk, "orderid" : x.pk, "name" : x.layercommit.layer.name, "giturl" : x.layercommit.layer.vcs_url, "url": x.layercommit.layer.layer_index_url, "layerdetailurl": reverse("layerdetails", args=(x.layercommit.layer.pk,)), "branch" : { "name" : x.layercommit.up_branch.name, "layersource" : x.layercommit.up_branch.layer_source.name}}, prj.projectlayer_set.all().order_by("id")), 2185 "layers" : map(lambda x: {"id": x.layercommit.pk, "orderid" : x.pk, "name" : x.layercommit.layer.name, "giturl" : x.layercommit.layer.vcs_url, "url": x.layercommit.layer.layer_index_url, "layerdetailurl": reverse("layerdetails", args=(x.layercommit.layer.pk,)), "branch" : { "name" : x.layercommit.up_branch.name, "layersource" : x.layercommit.up_branch.layer_source.name}}, prj.projectlayer_set.all().select_related("layer").order_by("id")),
2183 "builds" : _project_recent_build_list(prj), 2186 "builds" : _project_recent_build_list(prj),
2184 "variables": map(lambda x: (x.name, x.value), prj.projectvariable_set.all()), 2187 "variables": map(lambda x: (x.name, x.value), prj.projectvariable_set.all()),
2185 "machine": {"name": prj.projectvariable_set.get(name="MACHINE").value}, 2188 "machine": {"name": prj.projectvariable_set.get(name="MACHINE").value},