Patchwork [bitbake-devel,60/94] bitbake: dsi: small bugfixes in data collection

login
register
mail settings
Submitter Alexandru DAMIAN
Date Sept. 24, 2013, 4:52 p.m.
Message ID <3872a5f90777ad18fcc22ffdebd821d5d4eea456.1380041477.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/58783/
State New
Headers show

Comments

Alexandru DAMIAN - Sept. 24, 2013, 4:52 p.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

A couple of bugfixes in the data collection:
- cache the TMPDIR since it's not gonna change during the build
- CommandCompleted can be issues outside of a build,  so
update the build only if we're running one

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 bitbake/lib/bb/ui/buildinfohelper.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch

diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 232eea8..6f4789c 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -161,6 +161,7 @@  class BuildInfoHelper(object):
         self.server = server
         self.orm_wrapper = ORMWrapper()
         self.has_build_history = has_build_history
+        self.tmp_dir = self.server.runCommand(["getVariable", "TMPDIR"])[0]
 
     def _configure_django(self):
         # Add webhob to sys path for importing modules
@@ -298,13 +299,12 @@  class BuildInfoHelper(object):
     def _get_path_information(self, task_object):
         build_stats_format = "{tmpdir}/buildstats/{target}-{machine}/{buildname}/{package}/"
 
-        tmp_dir = self.server.runCommand(["getVariable", "TMPDIR"])[0]
         target = self.internal_state['target']
         machine = self.internal_state['build'].machine.name
         buildname = self.internal_state['build'].build_name
         package = task_object.recipe.name + "-" + task_object.recipe.version.strip(":")
 
-        build_stats_path = build_stats_format.format(tmpdir=tmp_dir, target=target,
+        build_stats_path = build_stats_format.format(tmpdir=self.tmp_dir, target=target,
                                                      machine=machine, buildname=buildname,
                                                      package=package)
 
@@ -373,7 +373,8 @@  class BuildInfoHelper(object):
 
 
     def update_build_information(self, event, errors, warnings, taskfailures):
-        self.orm_wrapper.update_build_object(self.internal_state['build'], errors, warnings, taskfailures)
+        if 'build' in self.internal_state:
+            self.orm_wrapper.update_build_object(self.internal_state['build'], errors, warnings, taskfailures)
 
     def store_started_task(self, event):
         identifier = re.split(':', event.taskfile)[-1] + event.taskname