Skip to contentSkip to conversation

Patches fixing bugs in 1.6 mode

PATCH New Alex DAMIAN 1 participant 3 messages Nov 3, 2014

lore
Share & tools
lore
#0 lore raw

cover Patches fixing bugs in 1.6 mode

From: Alexandru DAMIAN <[email protected]>

These patches fix issues related to 1.6 toaster running mode, in regards to data collection, and displaying pages that have 1.7-mode content in them (currently causing the UI to be innacessible).

Can you please pull in sync with the toaster.bbclass patch

toaster.bbclass: read elapsed time from the stats file

Thank you,
Alex

The following changes since commit 26d601ab2a677a422bab425696a2cf6357ff3576:

bitbake: clarify startup message (2014-10-30 13:39:37 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib adamian/20141031-bb-submission
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=adamian/20141031-bb-submission

Alexandru DAMIAN (2):
toasterui: improvements in data reading
toastergui: fix invalid build url usage

 lib/bb/ui/buildinfohelper.py                      | 22 +++++++++++++---------
 lib/bb/ui/toasterui.py                            |  6 ++++--
 lib/toaster/toastergui/templates/mrb_section.html | 10 +++++-----
 3 files changed, 22 insertions(+), 16 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 toasterui: improvements in data reading

From: Alexandru DAMIAN <[email protected]>

We add improvements in data reading, following
issues discovered in testing.

- elapsed_time is now read from buildstats
- we add safeguards to not fail logging if the build was triggered with a toaster_brbe configuration, but it's running in 1.6 mode
- added log markups for build finish to let other programs known when the work is done.

[YOCTO #6833]
[YOCTO #6685]
[YOCTO #6887]

---
 lib/bb/ui/buildinfohelper.py | 22 +++++++++++++---------
 lib/bb/ui/toasterui.py       |  6 ++++--
 2 files changed, 17 insertions(+), 11 deletions(-)
lib/bb/ui/buildinfohelper.py +13 -9
index fcef53b..b5ae9e97 100644
@@ -67,13 +67,15 @@ class ORMWrapper(object):
 
         if brbe is not None:
             from bldcontrol.models import BuildEnvironment, BuildRequest
-            br, be = brbe.split(":")
-            buildrequest = BuildRequest.objects.get(pk = br)
-            buildrequest.build = build
-            buildrequest.save()
-            build.project_id = buildrequest.project_id
-            build.save()
-
+            try:
+                br, be = brbe.split(":")
+                buildrequest = BuildRequest.objects.get(pk = br)
+                buildrequest.build = build
+                buildrequest.save()
+                build.project_id = buildrequest.project_id
+                build.save()
+            except BuildRequest.DoesNotExist:
+                pass
         return build
 
     def create_target_objects(self, target_info):
@@ -146,6 +148,8 @@ class ORMWrapper(object):
         if 'start_time' in task_information.keys() and 'end_time' in task_information.keys():
             duration = task_information['end_time'] - task_information['start_time']
             task_object.elapsed_time = duration
+            del task_information['start_time']
+            del task_information['end_time']
 
         task_object.save()
         return task_object
@@ -320,8 +324,7 @@ class ORMWrapper(object):
                 searchname = pkgpnmap[p]['OPKGN']
 
             packagedict[p]['object'], created = Package.objects.get_or_create( build = build_obj, name = searchname )
-            if created:
-                # package was not build in the current build, but
+            if True:    # save the data anyway we can, not just if it was not created here; bug [YOCTO #6887]
                 # fill in everything we can from the runtime-reverse package data
                 try:
                     packagedict[p]['object'].recipe = recipes[pkgpnmap[p]['PN']]
@@ -717,6 +720,7 @@ class BuildInfoHelper(object):
             task_information['task_name'] = taskname
             task_information['cpu_usage'] = taskstats['cpu_usage']
             task_information['disk_io'] = taskstats['disk_io']
+            task_information['elapsed_time'] = taskstats['elapsed_time']
             task_obj = self.orm_wrapper.get_update_task_object(task_information, True)  # must exist
 
     def update_and_store_task(self, event):
lib/bb/ui/toasterui.py +4 -2
index 0c53843..007c6b6 100644
@@ -231,14 +231,16 @@ def main(server, eventHandler, params ):
 
                 buildinfohelper.update_build_information(event, errors, warnings, taskfailures)
                 buildinfohelper.close(errorcode)
+                # mark the log output; controllers may kill the toasterUI after seeing this log
+                logger.info("ToasterUI build done")
 
                 # we start a new build info
                 if buildinfohelper.brbe is not None:
 
-                    print "we are under BuildEnvironment management - after the build, we exit"
+                    logger.debug(1, "ToasterUI under BuildEnvironment management - exiting after the build")
                     server.terminateServer()
                 else:
-                    print "prepared for new build"
+                    logger.debug(1, "ToasterUI prepared for new build")
                     errors = 0
                     warnings = 0
                     taskfailures = []
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/2 toastergui: fix invalid build url usage

From: Alexandru DAMIAN <[email protected]>

We need to pass the URL for the build action as javascript parameter, since the project ID is different for each build, instead of using the project id of the most-recently-used project.

---
 lib/toaster/toastergui/templates/mrb_section.html | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
lib/toaster/toastergui/templates/mrb_section.html +5 -5
index 5ba0b08..3d17ac6 100644
@@ -44,7 +44,7 @@
                 Build time: <a href="{% url 'buildtime' build.pk %}">{{ build.timespent|sectohms }}</a>
               </span>
           {% if build.project %}
-              <a class="btn {%if build.outcome == build.SUCCEEDED%}btn-success{%elif build.outcome == build.FAILED%}btn-danger{%else%}btn-info{%endif%} pull-right" onclick="scheduleBuild({{build.project.name|json}}, {{build.get_sorted_target_list|mapselect:'target'|json}})">Run again</a>
+              <a class="btn {%if build.outcome == build.SUCCEEDED%}btn-success{%elif build.outcome == build.FAILED%}btn-danger{%else%}btn-info{%endif%} pull-right" onclick="scheduleBuild({%url 'xhr_projectbuild' build.project.id as myurl %}{{myurl|json}}, {{build.project.name|json}}, {{build.get_sorted_target_list|mapselect:'target'|json}})">Run again</a>
           {% endif %}
             </div>
     {%endif%}
@@ -64,10 +64,10 @@
 
 <script>
 
-function _makeXHRBuildCall(data, onsuccess, onfail) {
+function _makeXHRBuildCall(url, data, onsuccess, onfail) {
     $.ajax( {
         type: "POST",
-        url: "{% url 'xhr_projectbuild' project.id %}",
+        url: url,
         data: data,
         headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
         success: function (_data) {
@@ -86,9 +86,9 @@ function _makeXHRBuildCall(data, onsuccess, onfail) {
 }
 
 
-function scheduleBuild(projectName, buildlist) {
+function scheduleBuild(url, projectName, buildlist) {
   console.log("scheduleBuild");
-//  _makeXHRBuildCall({targets: buildlist.join(" ")}, function (_data) {
+//  _makeXHRBuildCall(url , {targets: buildlist.join(" ")}, function (_data) {
 
   $('#latest-builds').prepend('<div class="alert alert-info" style="padding-top:0px">' + '<span class="label label-info" style="font-weight: normal; margin-bottom: 5px; margin-left:-15px; padding-top:5px;">'+projectName+'</span><div class="row-fluid">' +
   '<div class="span4 lead">' + buildlist.join(" ") +
Signature · 1 line
1.9.1