get_error_report_controller_dir: Returns controller error report dir
where bitbake exception/errors are stored.

get_error_report_worker_dir: Returns controller error report dir
where recipe task failures are stored.

Also update the current sources to use that functions.

Signed-off-by: Aníbal Limón <anibal.li...@linux.intel.com>
---
 .../autobuilder/buildsteps/SendErrorReport.py           | 16 +++++++---------
 lib/python2.7/site-packages/autobuilder/lib/ABTools.py  | 17 +++++++++++++++++
 .../site-packages/autobuilder/lib/buildsteps.py         | 10 ++--------
 3 files changed, 26 insertions(+), 17 deletions(-)

diff --git 
a/lib/python2.7/site-packages/autobuilder/buildsteps/SendErrorReport.py 
b/lib/python2.7/site-packages/autobuilder/buildsteps/SendErrorReport.py
index 33f9fe3..23e94b1 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/SendErrorReport.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/SendErrorReport.py
@@ -9,8 +9,12 @@ __version__ = "2.0"
 __maintainer__ = "Elizabeth Flanagan"
 __email__ = "pi...@toganlabs.com"
 '''
+
+import os
+
 from buildbot.steps.shell import ShellCommand
-from autobuilder.config import *
+
+from lib.ABTools import get_error_report_worker_dir
 
 class SendErrorReport(ShellCommand):
     haltOnFailure = False
@@ -18,7 +22,6 @@ class SendErrorReport(ShellCommand):
     name = "SendErrorReport"
     def __init__(self, factory, argdict=None, **kwargs):
         self.factory = factory
-        self.workerdir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-worker"))
         for k, v in argdict.iteritems():
             setattr(self, k, v)
         # Timeout needs to be passed to LoggingBuildStep as a kwarg
@@ -27,17 +30,12 @@ class SendErrorReport(ShellCommand):
         ShellCommand.__init__(self, **kwargs)
 
     def start(self):
-        self.workerdir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-worker"))
         self.buildername=self.getProperty("buildername")
         self.buildnumber=self.getProperty("buildnumber")
+        self.errordir = get_error_report_worker_dir(self.buildername)
         self.layerversion_core = self.getProperty("layerversion_core")
         self.command=""
-        if os.environ.get('ERROR_REPORT_DIR') is None:
-            self.errordir=os.path.join(os.path.join(
-                            self.workerdir, self.buildername),
-                            "build/build/tmp/log/error-report/")
-        else:
-            self.errordir=os.environ.get('ERROR_REPORT_DIR')
+
         if int(self.layerversion_core) < 4:
             self.command = "echo 'Skipping Step.'"
         else:
diff --git a/lib/python2.7/site-packages/autobuilder/lib/ABTools.py 
b/lib/python2.7/site-packages/autobuilder/lib/ABTools.py
index a665373..579ae85 100644
--- a/lib/python2.7/site-packages/autobuilder/lib/ABTools.py
+++ b/lib/python2.7/site-packages/autobuilder/lib/ABTools.py
@@ -10,7 +10,9 @@ __maintainer__ = "Elizabeth Flanagan"
 __email__ = "elizabeth.flana...@intel.com"
 '''
 
+import os
 
+from autobuilder.config import YOCTO_ABBASE
 
 def capitalize(word):
     return ' '.join([s[0].upper() + s[1:] for s in word.split(' ')])
@@ -18,3 +20,18 @@ def capitalize(word):
 def stringToBool(v):
     return v.lower() in ("true", "t", "1")
 
+def get_error_report_controller_dir(buildername, buildnumber):
+    errordir_base = os.path.join(YOCTO_ABBASE, 'yocto-controller', buildername,
+            'error-report')
+    errordir = os.path.join(errordir_base, str(buildnumber))
+    return errordir
+
+def get_error_report_worker_dir(buildername):
+    if os.environ.get('ERROR_REPORT_DIR') is None:
+        workerdir = os.path.join(YOCTO_ABBASE, 'yocto-worker')
+        errordir = os.path.join(workerdir, buildername,
+                'build/build/tmp/log/error-report/')
+    else:
+        errordir = os.environ.get('ERROR_REPORT_DIR')
+
+    return errordir
diff --git a/lib/python2.7/site-packages/autobuilder/lib/buildsteps.py 
b/lib/python2.7/site-packages/autobuilder/lib/buildsteps.py
index 7354c83..9f63a2b 100644
--- a/lib/python2.7/site-packages/autobuilder/lib/buildsteps.py
+++ b/lib/python2.7/site-packages/autobuilder/lib/buildsteps.py
@@ -20,7 +20,7 @@ import codecs
 from buildbot.steps.shell import ShellCommand
 from buildbot.process.buildstep import LogLineObserver
 
-from autobuilder.config import YOCTO_ABBASE
+from lib.ABTools import get_error_report_controller_dir
 
 DEFAULT_SHELL = 'bash'
 
@@ -92,12 +92,6 @@ class BitbakeLogLineObserver(LogLineObserver):
     def errLineReceived(self, line):
         self._handleError(line)
 
-def get_error_report_bitbake_dir(buildername, buildnumber):
-    errordir_base = os.path.join(YOCTO_ABBASE, 'yocto-controller', buildername,
-            'error-report')
-    errordir = os.path.join(errordir_base, str(buildnumber))
-    return errordir
-
 class BitbakeShellCommand(ShellCommand):
     def __init__(self, factory, argdict=None, **kwargs):
         super(BitbakeShellCommand, self).__init__(**kwargs)
@@ -143,7 +137,7 @@ class BitbakeShellCommand(ShellCommand):
         buildername = self.getProperty('buildername')
         buildnumber = self.getProperty('buildnumber')
 
-        errordir = get_error_report_bitbake_dir(buildername, buildnumber)
+        errordir = get_error_report_controller_dir(buildername, buildnumber)
         if not os.path.exists(errordir):
             os.makedirs(errordir)
 
-- 
2.1.4

-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to