summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2015-10-17 10:45:51 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-27 07:24:31 +0000
commit1d17109d62f072ea836349805a08523a43f0475d (patch)
tree396a2acd11328bcd63c87294f95abc7d590b769f /bitbake
parenta5804794526fa2d3033f8df71c5fb8ac835d43e2 (diff)
downloadpoky-1d17109d62f072ea836349805a08523a43f0475d.tar.gz
bitbake: toaster: Hide builds for non-cli projects in analysis mode
The "latest builds" sections of the "all builds" page show builds for all projects. This is not appropriate for analysis mode, where we can only affect the command-line builds project. Modify the "latest builds" section to only show builds for the command line builds project if in analysis mode. Also rationalise where we get the queryset of latest builds from: we have a _get_latest_builds() function which was being used to get the latest builds in most places, but not all. Also modify _get_latest_builds() to sort by started_on, rather than primary key, as assuming that a higher primary key value equates with later start time is incorrect. [YOCTO #8514] (Bitbake rev: 52de2c8cd11fa743f8fd7cb0cf776eea622ac474) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 10bbef5ca4..d675f4f2d2 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -92,9 +92,12 @@ def _get_latest_builds(prj=None):
92 if prj is not None: 92 if prj is not None:
93 queryset = queryset.filter(project = prj) 93 queryset = queryset.filter(project = prj)
94 94
95 if not toastermain.settings.BUILD_MODE:
96 queryset = queryset.exclude(project__is_default=False)
97
95 return list(itertools.chain( 98 return list(itertools.chain(
96 queryset.filter(outcome=Build.IN_PROGRESS).order_by("-pk"), 99 queryset.filter(outcome=Build.IN_PROGRESS).order_by("-started_on"),
97 queryset.filter(outcome__lt=Build.IN_PROGRESS).order_by("-pk")[:3] )) 100 queryset.filter(outcome__lt=Build.IN_PROGRESS).order_by("-started_on")[:3] ))
98 101
99 102
100# a JSON-able dict of recent builds; for use in the Project page, xhr_ updates, and other places, as needed 103# a JSON-able dict of recent builds; for use in the Project page, xhr_ updates, and other places, as needed
@@ -1926,6 +1929,11 @@ if True:
1926 1929
1927 queryset = Build.objects.all() 1930 queryset = Build.objects.all()
1928 1931
1932 # if in analysis mode, exclude builds for all projects except
1933 # command line builds
1934 if not toastermain.settings.BUILD_MODE:
1935 queryset = queryset.exclude(project__is_default=False)
1936
1929 redirect_page = resolve(request.path_info).url_name 1937 redirect_page = resolve(request.path_info).url_name
1930 1938
1931 context, pagesize, orderby = _build_list_helper(request, 1939 context, pagesize, orderby = _build_list_helper(request,
@@ -2000,7 +2008,7 @@ if True:
2000 build_info = _build_page_range(Paginator(queryset, pagesize), request.GET.get('page', 1)) 2008 build_info = _build_page_range(Paginator(queryset, pagesize), request.GET.get('page', 1))
2001 2009
2002 # build view-specific information; this is rendered specifically in the builds page, at the top of the page (i.e. Recent builds) 2010 # build view-specific information; this is rendered specifically in the builds page, at the top of the page (i.e. Recent builds)
2003 build_mru = Build.objects.order_by("-started_on")[:3] 2011 build_mru = _get_latest_builds()[:3]
2004 2012
2005 # calculate the exact begining of local today and yesterday, append context 2013 # calculate the exact begining of local today and yesterday, append context
2006 context_date,today_begin,yesterday_begin = _add_daterange_context(queryset_all, request, {'started_on','completed_on'}) 2014 context_date,today_begin,yesterday_begin = _add_daterange_context(queryset_all, request, {'started_on','completed_on'})
@@ -3030,6 +3038,10 @@ if True:
3030 queryset_all = queryset_all.filter(Q(is_default=False) | 3038 queryset_all = queryset_all.filter(Q(is_default=False) |
3031 q_default_with_builds) 3039 q_default_with_builds)
3032 3040
3041 # if in BUILD_MODE, exclude everything but the command line builds project
3042 if not toastermain.settings.BUILD_MODE:
3043 queryset_all = queryset_all.exclude(is_default=False)
3044
3033 # boilerplate code that takes a request for an object type and returns a queryset 3045 # boilerplate code that takes a request for an object type and returns a queryset
3034 # for that object type. copypasta for all needed table searches 3046 # for that object type. copypasta for all needed table searches
3035 (filter_string, search_term, ordering_string) = _search_tuple(request, Project) 3047 (filter_string, search_term, ordering_string) = _search_tuple(request, Project)