diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-06-09 17:25:42 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-26 09:27:31 +0100 |
commit | 2c7ed96b567386d0f57ad8c088790a515d17b7af (patch) | |
tree | f322624d303f7c46034e9813717317c84017234f /bitbake | |
parent | c362e61ee2cc97b393f7002c4592787d6573080c (diff) | |
download | poky-2c7ed96b567386d0f57ad8c088790a515d17b7af.tar.gz |
bitbake: toaster: remove BuildRequest references
In the toastergui application we should not display
implementation details about how the builds are run.
This patch removes the references to BuildRequest on the
majority of the views (except Builds page itself, as
that is more complicated).
(Bitbake rev: ead45a600813a1d8594e604875803ded781f83d8)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/basebuildpage.html | 1 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/configvars.html | 4 | ||||
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 66 |
3 files changed, 30 insertions, 41 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html index b7a4dd21ed..105ad85ed4 100644 --- a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html +++ b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html | |||
@@ -24,6 +24,7 @@ | |||
24 | $('#breadcrumb > li').append("<span class=\"divider\">→</span>"); | 24 | $('#breadcrumb > li').append("<span class=\"divider\">→</span>"); |
25 | $('#breadcrumb > li:last').addClass("active"); | 25 | $('#breadcrumb > li:last').addClass("active"); |
26 | $('#breadcrumb > li:last > span').remove(); | 26 | $('#breadcrumb > li:last > span').remove(); |
27 | console.log("done"); | ||
27 | }); | 28 | }); |
28 | </script> | 29 | </script> |
29 | </div> | 30 | </div> |
diff --git a/bitbake/lib/toaster/toastergui/templates/configvars.html b/bitbake/lib/toaster/toastergui/templates/configvars.html index cbe3c6876f..89576733c2 100644 --- a/bitbake/lib/toaster/toastergui/templates/configvars.html +++ b/bitbake/lib/toaster/toastergui/templates/configvars.html | |||
@@ -56,7 +56,7 @@ | |||
56 | <td class="file"><a data-toggle="modal" href="#variable-{{variable.pk}}"> | 56 | <td class="file"><a data-toggle="modal" href="#variable-{{variable.pk}}"> |
57 | {% if variable.vhistory.all %} | 57 | {% if variable.vhistory.all %} |
58 | {% for path in variable.vhistory.all|filter_setin_files:file_filter %} | 58 | {% for path in variable.vhistory.all|filter_setin_files:file_filter %} |
59 | {{path|cut_path_prefix:dirstostrip}}<br/> | 59 | {{path}}<br/> |
60 | {% endfor %} | 60 | {% endfor %} |
61 | {% endif %} | 61 | {% endif %} |
62 | </a></td> | 62 | </a></td> |
@@ -117,7 +117,7 @@ | |||
117 | <tbody> | 117 | <tbody> |
118 | {% for vh in variable.vhistory.all %} | 118 | {% for vh in variable.vhistory.all %} |
119 | <tr> | 119 | <tr> |
120 | <td>{{forloop.counter}}</td><td>{{vh.file_name|cut_path_prefix:dirstostrip}}</td><td>{{vh.operation}}</td><td>{{vh.line_number}}</td> | 120 | <td>{{forloop.counter}}</td><td>{{vh.file_name}}</td><td>{{vh.operation}}</td><td>{{vh.line_number}}</td> |
121 | </tr> | 121 | </tr> |
122 | {%endfor%} | 122 | {%endfor%} |
123 | </tbody> | 123 | </tbody> |
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index bfae304587..060d680b85 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -27,7 +27,6 @@ from django.shortcuts import render, redirect | |||
27 | from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable | 27 | from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable |
28 | from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency | 28 | from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency |
29 | from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact | 29 | from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact |
30 | from bldcontrol.models import BuildEnvironment, BuildRequest | ||
31 | from bldcontrol import bbcontroller | 30 | from bldcontrol import bbcontroller |
32 | from django.views.decorators.cache import cache_control | 31 | from django.views.decorators.cache import cache_control |
33 | from django.core.urlresolvers import reverse | 32 | from django.core.urlresolvers import reverse |
@@ -41,36 +40,33 @@ from django.utils import formats | |||
41 | from toastergui.templatetags.projecttags import json as jsonfilter | 40 | from toastergui.templatetags.projecttags import json as jsonfilter |
42 | import json | 41 | import json |
43 | from os.path import dirname | 42 | from os.path import dirname |
43 | import itertools | ||
44 | 44 | ||
45 | # all new sessions should come through the landing page; | 45 | # all new sessions should come through the landing page; |
46 | # determine in which mode we are running in, and redirect appropriately | 46 | # determine in which mode we are running in, and redirect appropriately |
47 | def landing(request): | 47 | def landing(request): |
48 | if toastermain.settings.MANAGED: | 48 | if Build.objects.count() == 0 and Project.objects.count() > 0: |
49 | from bldcontrol.models import BuildRequest | 49 | return redirect(reverse('all-projects'), permanent = False) |
50 | if BuildRequest.objects.count() == 0 and Project.objects.count() > 0: | ||
51 | return redirect(reverse('all-projects'), permanent = False) | ||
52 | 50 | ||
53 | if BuildRequest.objects.all().count() > 0: | 51 | if Build.objects.all().count() > 0: |
54 | return redirect(reverse('all-builds'), permanent = False) | 52 | return redirect(reverse('all-builds'), permanent = False) |
55 | else: | ||
56 | if Build.objects.all().count() > 0: | ||
57 | return redirect(reverse('all-builds'), permanent = False) | ||
58 | 53 | ||
59 | context = {} | 54 | context = {'lvs_nos' : Layer_Version.objects.all().count()} |
60 | if toastermain.settings.MANAGED: | ||
61 | context['lvs_nos'] = Layer_Version.objects.all().count() | ||
62 | 55 | ||
63 | return render(request, 'landing.html', context) | 56 | return render(request, 'landing.html', context) |
64 | 57 | ||
65 | # returns a list for most recent builds; for use in the Project page, xhr_ updates, and other places, as needed | 58 | # returns a list for most recent builds; for use in the Project page, xhr_ updates, and other places, as needed |
66 | def _project_recent_build_list(prj): | 59 | def _project_recent_build_list(prj): |
67 | return map(lambda x: { | 60 | data = [] |
61 | # take the most recent 3 completed builds, plus any builds in progress | ||
62 | for x in itertools.chain(prj.build_set.filter(outcome__lt=Build.IN_PROGRESS).order_by("-pk")[:3], prj.build_set.filter(outcome=Build.IN_PROGRESS).order_by("-pk")): | ||
63 | d = { | ||
68 | "id": x.pk, | 64 | "id": x.pk, |
69 | "targets" : map(lambda y: {"target": y.target, "task": y.task }, x.brtarget_set.all()), | 65 | "targets" : map(lambda y: {"target": y.target, "task": None }, x.target_set.all()), # TODO: create the task entry in the Target table |
70 | "status": x.get_state_display(), | 66 | "status": x.get_outcome_display(), |
71 | "errors": map(lambda y: {"type": y.errtype, "msg": y.errmsg, "tb": y.traceback}, x.brerror_set.all()), | 67 | "errors": map(lambda y: {"type": y.lineno, "msg": y.message, "tb": y.pathname}, x.logmessage_set.filter(level__gte=LogMessage.WARNING)), |
72 | "updated": x.updated.strftime('%s')+"000", | 68 | "updated": x.completed_on.strftime('%s')+"000", |
73 | "command_time": (x.updated - x.created).total_seconds(), | 69 | "command_time": (x.completed_on - x.started_on).total_seconds(), |
74 | "br_page_url": reverse('buildrequestdetails', args=(x.project.id, x.pk) ), | 70 | "br_page_url": reverse('buildrequestdetails', args=(x.project.id, x.pk) ), |
75 | "build" : map( lambda y: {"id": y.pk, | 71 | "build" : map( lambda y: {"id": y.pk, |
76 | "status": y.get_outcome_display(), | 72 | "status": y.get_outcome_display(), |
@@ -82,9 +78,11 @@ def _project_recent_build_list(prj): | |||
82 | "warnings": y.warnings_no, | 78 | "warnings": y.warnings_no, |
83 | "completeper": y.completeper() if y.outcome == Build.IN_PROGRESS else "0", | 79 | "completeper": y.completeper() if y.outcome == Build.IN_PROGRESS else "0", |
84 | "eta": y.eta().strftime('%s')+"000" if y.outcome == Build.IN_PROGRESS else "0", | 80 | "eta": y.eta().strftime('%s')+"000" if y.outcome == Build.IN_PROGRESS else "0", |
85 | }, Build.objects.filter(buildrequest = x)), | 81 | }, [x]), |
86 | }, list(prj.buildrequest_set.filter(Q(state__lt=BuildRequest.REQ_COMPLETED) or Q(state=BuildRequest.REQ_DELETED)).order_by("-pk")) + | 82 | } |
87 | list(prj.buildrequest_set.filter(state__in=[BuildRequest.REQ_COMPLETED, BuildRequest.REQ_FAILED]).order_by("-pk")[:3])) | 83 | data.append(d) |
84 | |||
85 | return data | ||
88 | 86 | ||
89 | 87 | ||
90 | 88 | ||
@@ -1372,15 +1370,6 @@ def configvars(request, build_id): | |||
1372 | file_filter += '/bitbake.conf' | 1370 | file_filter += '/bitbake.conf' |
1373 | build_dir=re.sub("/tmp/log/.*","",Build.objects.get(pk=build_id).cooker_log_path) | 1371 | build_dir=re.sub("/tmp/log/.*","",Build.objects.get(pk=build_id).cooker_log_path) |
1374 | 1372 | ||
1375 | clones = [] | ||
1376 | for breq in BuildRequest.objects.filter(build_id=build_id): | ||
1377 | bc = bbcontroller.getBuildEnvironmentController(pk = breq.environment.id) | ||
1378 | for brl in breq.brlayer_set.all(): | ||
1379 | localdirname = bc.getGitCloneDirectory(brl.giturl, brl.commit) | ||
1380 | if not localdirname.startswith("/"): | ||
1381 | localdirname = os.path.join(bc.be.sourcedir, localdirname) | ||
1382 | clones.append(localdirname) | ||
1383 | |||
1384 | context = { | 1373 | context = { |
1385 | 'objectname': 'configvars', | 1374 | 'objectname': 'configvars', |
1386 | 'object_search_display':'BitBake variables', | 1375 | 'object_search_display':'BitBake variables', |
@@ -1391,7 +1380,6 @@ def configvars(request, build_id): | |||
1391 | 'total_count':queryset_with_search.count(), | 1380 | 'total_count':queryset_with_search.count(), |
1392 | 'default_orderby' : 'variable_name:+', | 1381 | 'default_orderby' : 'variable_name:+', |
1393 | 'search_term':search_term, | 1382 | 'search_term':search_term, |
1394 | 'dirstostrip': clones + [dirname(build_dir), dirname(dirname(build_dir))], | ||
1395 | # Specifies the display of columns for the table, appearance in "Edit columns" box, toggling default show/hide, and specifying filters for columns | 1383 | # Specifies the display of columns for the table, appearance in "Edit columns" box, toggling default show/hide, and specifying filters for columns |
1396 | 'tablecols' : [ | 1384 | 'tablecols' : [ |
1397 | {'name': 'Variable', | 1385 | {'name': 'Variable', |
@@ -1872,7 +1860,7 @@ if True: | |||
1872 | 1860 | ||
1873 | 1861 | ||
1874 | # shows the "all builds" page for managed mode; it displays build requests (at least started!) instead of actual builds | 1862 | # shows the "all builds" page for managed mode; it displays build requests (at least started!) instead of actual builds |
1875 | @_template_renderer("managed_builds.html") | 1863 | @_template_renderer("builds.html") |
1876 | def builds(request): | 1864 | def builds(request): |
1877 | # define here what parameters the view needs in the GET portion in order to | 1865 | # define here what parameters the view needs in the GET portion in order to |
1878 | # be able to display something. 'count' and 'page' are mandatory for all views | 1866 | # be able to display something. 'count' and 'page' are mandatory for all views |
@@ -2184,10 +2172,7 @@ if True: | |||
2184 | # Shows the edit project page | 2172 | # Shows the edit project page |
2185 | @_template_renderer('project.html') | 2173 | @_template_renderer('project.html') |
2186 | def project(request, pid): | 2174 | def project(request, pid): |
2187 | try: | 2175 | prj = Project.objects.get(id = pid) |
2188 | prj = Project.objects.get(id = pid) | ||
2189 | except Project.DoesNotExist: | ||
2190 | return HttpResponseNotFound("<h1>Project id " + pid + " is unavailable</h1>") | ||
2191 | 2176 | ||
2192 | try: | 2177 | try: |
2193 | puser = User.objects.get(id = prj.user_id) | 2178 | puser = User.objects.get(id = prj.user_id) |
@@ -2249,8 +2234,8 @@ if True: | |||
2249 | context = { | 2234 | context = { |
2250 | "project" : prj, | 2235 | "project" : prj, |
2251 | "lvs_nos" : Layer_Version.objects.all().count(), | 2236 | "lvs_nos" : Layer_Version.objects.all().count(), |
2252 | "completedbuilds": BuildRequest.objects.filter(project_id = pid).exclude(state__lte = BuildRequest.REQ_INPROGRESS).exclude(state=BuildRequest.REQ_DELETED), | 2237 | "completedbuilds": Build.objects.filter(project_id = pid).filter(outcome__lte = Build.IN_PROGRESS), |
2253 | "prj" : {"name": prj.name, "release": { "id": prj.release.pk, "name": prj.release.name, "desc": prj.release.description}}, | 2238 | "prj" : {"name": prj.name, }, |
2254 | #"buildrequests" : prj.buildrequest_set.filter(state=BuildRequest.REQ_QUEUED), | 2239 | #"buildrequests" : prj.buildrequest_set.filter(state=BuildRequest.REQ_QUEUED), |
2255 | "builds" : _project_recent_build_list(prj), | 2240 | "builds" : _project_recent_build_list(prj), |
2256 | "layers" : map(lambda x: { | 2241 | "layers" : map(lambda x: { |
@@ -2270,6 +2255,9 @@ if True: | |||
2270 | "project_html": 1, | 2255 | "project_html": 1, |
2271 | } | 2256 | } |
2272 | 2257 | ||
2258 | if prj.release is not None: | ||
2259 | context["prj"]["release"] = { "id": prj.release.pk, "name": prj.release.name, "desc": prj.release.description} | ||
2260 | |||
2273 | try: | 2261 | try: |
2274 | context["machine"] = {"name": prj.projectvariable_set.get(name="MACHINE").value} | 2262 | context["machine"] = {"name": prj.projectvariable_set.get(name="MACHINE").value} |
2275 | except ProjectVariable.DoesNotExist: | 2263 | except ProjectVariable.DoesNotExist: |