Fix for YOCTO #7442
cover Fix for YOCTO #7442
Hi,
This set of changes return back ability to specify a task for the build and properly restart builds with specified tasks.
This functionality was broken in toaster since June. It was not possible to run bulds correctly if non-default task is specified.
The patchset includes fixes for backend and frontend. It also adds 2 testcases for frontend to prevent this functionality to be broken again.
The following changes since commit 7b86c771c80d0759c2ca0e57c46c4c966f89c49e:
bitbake: bitbake: bb.fetch2.git: Import errno module (2015-09-19 22:38:44 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib ed/toaster/7442
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/7442
Ed Bartosh (4):
toaster: store task name in Target objects
toaster: don't re-create Target objects
toaster: change UI to show tasks
toaster: add 2 UI tests
bitbake/lib/bb/ui/buildinfohelper.py | 17 +-------------- .../bldcontrol/management/commands/runbuilds.py | 2 +- bitbake/lib/toaster/orm/models.py | 2 +- .../lib/toaster/toastergui/templates/builds.html | 12 ++++++++++- .../toaster/toastergui/templates/mrb_section.html | 23 ++++++++++++++++----- .../toastergui/templates/projectbuilds.html | 12 ++++++++++- bitbake/lib/toaster/toastergui/tests.py | 24 ++++++++++++++++++++-- 7 files changed, 65 insertions(+), 27 deletions(-)
--
Regards,
Ed
PATCH 1/4 toaster: store task name in Target objects
Information about a task is not stored in Target objects. This makes it impossible to correctly operate with the builds where task is specified.
Storing taks name is an enabler for other fixes in UI and backend related to restarting builds.
--- bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py | 2 +- bitbake/lib/toaster/orm/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py +1 -1
@@ -118,7 +118,7 @@ class Command(NoArgsCommand): br.save() # transpose target information for brtarget in br.brtarget_set.all(): - Target.objects.create(build = br.build, target= brtarget.target) + Target.objects.create(build=br.build, target=brtarget.target, task=brtarget.task) # transpose the launch errors in ToasterExceptions for brerror in br.brerror_set.all(): LogMessage.objects.create(build = br.build, level = LogMessage.EXCEPTION, message = brerror.errmsg)
bitbake/lib/toaster/orm/models.py +1 -1
@@ -270,7 +270,7 @@ class Project(models.Model): ) for t in self.projecttarget_set.all(): BRTarget.objects.create(req = br, target = t.target, task = t.task) - Target.objects.create(build = br.build, target = t.target) + Target.objects.create(build = br.build, target = t.target, task = t.task) for v in self.projectvariable_set.all(): BRVariable.objects.create(req = br, name = v.name, value = v.value)
Signature · 1 line
2.1.4
PATCH 2/4 toaster: don't re-create Target objects
In reply to Ed BartoshDue to re-creating Target objects from bitbake events task information stored in original objects is lost.
There is no valid reason to remove existing objects. It's safer to query them instead of re-creating as original object contain more information than events coming from bitbake.
--- bitbake/lib/bb/ui/buildinfohelper.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
bitbake/lib/bb/ui/buildinfohelper.py +1 -16
@@ -161,8 +161,6 @@ class ORMWrapper(object): build.bitbake_version=build_info['bitbake_version'] build.save() - Target.objects.filter(build = build).delete() - else: build = Build.objects.create( project = prj,
@@ -183,19 +181,6 @@ class ORMWrapper(object): return build - def create_target_objects(self, target_info): - assert 'build' in target_info - assert 'targets' in target_info - - targets = [] - for tgt_name in target_info['targets']: - tgt_object = Target.objects.create( build = target_info['build'], - target = tgt_name, - is_image = False, - ) - targets.append(tgt_object) - return targets - def update_build_object(self, build, errors, warnings, taskfailures): assert isinstance(build,Build) assert isinstance(errors, int)
@@ -869,7 +854,7 @@ class BuildInfoHelper(object): target_information['targets'] = event._pkgs target_information['build'] = build_obj - self.internal_state['targets'] = self.orm_wrapper.create_target_objects(target_information) + self.internal_state['targets'] = Target.objects.filter(build=target_information['build']) # Save build configuration data = self.server.runCommand(["getAllKeysWithFlags", ["doc", "func"]])[0]
Signature · 1 line
2.1.4
PATCH 3/4 toaster: change UI to show tasks
In reply to Ed BartoshChanged toaster UI to show tasks if they're specified for the builds and use them when restarting builds.
[YOCTO #7442]
--- .../lib/toaster/toastergui/templates/builds.html | 12 ++++++++++- .../toaster/toastergui/templates/mrb_section.html | 23 +++++++++++++++++----- .../toastergui/templates/projectbuilds.html | 12 ++++++++++- 3 files changed, 40 insertions(+), 7 deletions(-)
bitbake/lib/toaster/toastergui/templates/builds.html +11 -1
@@ -66,7 +66,17 @@ <td class="outcome"> <a href="{% url "builddashboard" build.id %}">{%if build.outcome == build.SUCCEEDED%}<i class="icon-ok-sign success"></i>{%elif build.outcome == build.FAILED%}<i class="icon-minus-sign error"></i>{%else%}{%endif%}</a> </td> - <td class="target">{% for t in build.target_set.all %} <a href="{% url "builddashboard" build.id %}"> {{t.target}} </a> <br />{% endfor %}</td> + <td class="target"> + {% for t in build.target_set.all %} + <a href="{% url "builddashboard" build.id %}"> + {% if t.task %} + {{t.target}}:{{t.task}} + {% else %} + {{t.target}} + {% endif %} + </a> <br /> + {% endfor %} + </td> <td class="machine"><a href="{% url "builddashboard" build.id %}">{{build.machine}}</a></td> <td class="started_on"><a href="{% url "builddashboard" build.id %}">{{build.started_on|date:"d/m/y H:i"}}</a></td> <td class="completed_on"><a href="{% url "builddashboard" build.id %}">{{build.completed_on|date:"d/m/y H:i"}}</a></td>
bitbake/lib/toaster/toastergui/templates/mrb_section.html +18 -5
@@ -26,12 +26,25 @@ {% endif %} {% if build.target_set.all.count > 0 %} <span data-toggle="tooltip" - {%if build.target_set.all.count > 1%} - title="Targets: {%for target in build.target_set.all%}{{target.target}} {%endfor%}" - {%endif%} + {% if build.target_set.all.count > 1 %} + title="Targets: + {% for target in build.target_set.all %} + {% if target.task %} + {{target.target}}:{{target.task}} + {% else %} + {{target.target}} + {% endif %} + {% endfor %}" + {% endif %} > - - {{build.target_set.all.0.target}} {%if build.target_set.all.count > 1%}(+ {{build.target_set.all.count|add:"-1"}}){%endif%} + {% if build.target_set.all.0.task %} + {{build.target_set.all.0.target}}:{{build.target_set.all.0.task}} + {% else %} + {{build.target_set.all.0.target}} + {% endif %} + {% if build.target_set.all.count > 1 %} + (+ {{build.target_set.all.count|add:"-1"}}) + {% endif %} </span> {% endif %} {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}
bitbake/lib/toaster/toastergui/templates/projectbuilds.html +11 -1
@@ -66,7 +66,17 @@ {% endif %} </td> - <td class="target">{% for t in build.target_set.all %} <a href="{% url "builddashboard" build.id %}"> {{t.target}} </a> <br />{% endfor %}</td> + <td class="target"> + {% for t in build.target_set.all %} + <a href="{% url "builddashboard" build.id %}"> + {% if t.task %} + {{t.target}}:{{t.task}} + {% else %} + {{t.target}} + {% endif %} + </a> <br /> + {% endfor %} + </td> <td class="machine"><a href="{% url "builddashboard" build.id %}">{{build.machine}}</a></td> <td class="started_on"><a href="{% url "builddashboard" build.id %}">{{build.started_on|date:"d/m/y H:i"}}</a></td> <td class="completed_on"><a href="{% url "builddashboard" build.id %}">{{build.completed_on|date:"d/m/y H:i"}}</a></td>
Signature · 1 line
2.1.4
PATCH 4/4 toaster: add 2 UI tests
In reply to Ed BartoshTested that UI shows task names for the builds in
both all-builds and projectbuilds views.
--- bitbake/lib/toaster/toastergui/tests.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
bitbake/lib/toaster/toastergui/tests.py +22 -2
@@ -21,12 +21,14 @@ """Test cases for Toaster GUI and ReST.""" +import re + from django.test import TestCase from django.core.urlresolvers import reverse from django.utils import timezone from orm.models import Project, Release, BitbakeVersion, ProjectTarget from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, Build -from orm.models import Layer_Version, Recipe, Machine, ProjectLayer +from orm.models import Layer_Version, Recipe, Machine, ProjectLayer, Target import json from bs4 import BeautifulSoup
@@ -376,4 +378,22 @@ class ProjectBuildsDisplayTest(TestCase): build2b = Build.objects.create(**self.project2_build_in_progress) build_rows = self._get_rows_for_project(self.project1.id) - self.assertEqual(len(build_rows), 2) + self.assertEqual(len(build_rows), 2) + + def test_show_tasks_in_projectbuilds(self): + build = Build.objects.create(**self.project1_build_success) + target = Target.objects.create(build=build, target='bash', + task='clean') + url = reverse("projectbuilds", args=(self.project1.id,)) + response = self.client.get(url, follow=True) + result = re.findall('^ +bash:clean$', response.content, re.MULTILINE) + self.assertEqual(len(result), 1) + + def test_show_tasks_in_allbuilds(self): + build = Build.objects.create(**self.project1_build_success) + target = Target.objects.create(build=build, target='bash', + task='clean') + url = reverse("all-builds") + response = self.client.get(url, follow=True) + result = re.findall('bash:clean', response.content, re.MULTILINE) + self.assertEqual(len(result), 3)
Signature · 1 line
2.1.4
Quoted 16 lines · On 21/09/2015 09:13, "[email protected] on behalf of Ed…
Hi,
This set of changes return back ability to specify a task for the build and
properly restart builds with specified tasks.This functionality was broken in toaster since June. It was not possible to run bulds correctly if non-default task is specified.
The patchset includes fixes for backend and frontend. It also adds 2 testcases
for frontend to prevent this functionality to be broken again.The following changes since commit
7b86c771c80d0759c2ca0e57c46c4c966f89c49e:
Quoted 7 lines
bitbake: bitbake: bb.fetch2.git: Import errno module (2015-09-19
22:38:44 +0100)are available in the git repository at:
git://git.yoctoproject.org/poky-contribed/toaster/7442
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/7442
This works for me and the UI looks good.
Thanks!
Belén
Quoted 27 lines
Ed Bartosh (4):
toaster: store task name in Target objects
toaster: don't re-create Target objects
toaster: change UI to show tasks
toaster: add 2 UI testsbitbake/lib/bb/ui/buildinfohelper.py | 17 +-------------- .../bldcontrol/management/commands/runbuilds.py | 2 +- bitbake/lib/toaster/orm/models.py | 2 +- .../lib/toaster/toastergui/templates/builds.html | 12 ++++++++++- .../toaster/toastergui/templates/mrb_section.html | 23++++++++++++++++-----
.../toastergui/templates/projectbuilds.html | 12 ++++++++++-bitbake/lib/toaster/toastergui/tests.py| 24
++++++++++++++++++++--7 files changed, 65 insertions(+), 27 deletions(-)--
Regards,
EdSignature · 4 lines
_______________________________________________ toaster mailing list [email protected] https://lists.yoctoproject.org/listinfo/toaster
Quoted 27 lines · Belen
Quoted 16 lines · On 21/09/2015 09:13, "[email protected] on behalf of Ed…
Hi,
This set of changes return back ability to specify a task for the build and
properly restart builds with specified tasks.This functionality was broken in toaster since June. It was not possible to run bulds correctly if non-default task is specified.
The patchset includes fixes for backend and frontend. It also adds 2 testcases
for frontend to prevent this functionality to be broken again.The following changes since commit
7b86c771c80d0759c2ca0e57c46c4c966f89c49e:Quoted 7 lines
bitbake: bitbake: bb.fetch2.git: Import errno module (2015-09-19
22:38:44 +0100)are available in the git repository at:
git://git.yoctoproject.org/poky-contribed/toaster/7442
Quoted 8 lines
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/7442
This works for me and the UI looks good.
Thanks!
Belén
Code looks fine to me, and Belen has tested, so I'll submit this upstream.
Elliot
Quoted 35 lines
Quoted 23 lines
Ed Bartosh (4):
toaster: store task name in Target objects
toaster: don't re-create Target objects
toaster: change UI to show tasks
toaster: add 2 UI testsbitbake/lib/bb/ui/buildinfohelper.py | 17 +-------------- .../bldcontrol/management/commands/runbuilds.py | 2 +- bitbake/lib/toaster/orm/models.py | 2 +- .../lib/toaster/toastergui/templates/builds.html | 12 ++++++++++- .../toaster/toastergui/templates/mrb_section.html | 23++++++++++++++++-----
.../toastergui/templates/projectbuilds.html | 12 ++++++++++-bitbake/lib/toaster/toastergui/tests.py| 24
++++++++++++++++++++--7 files changed, 65 insertions(+), 27 deletions(-)--
Regards,
EdQuoted 5 lines
--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster
Signature · 3 lines
Elliot Smith Software Engineer Intel Open Source Technology Centre