Patchwork [bitbake-devel,5/8] bitbake: build: add logfile path for all Task events

login
register
mail settings
Submitter Alexandru DAMIAN
Date Sept. 16, 2013, 11:56 a.m.
Message ID <a5db8806dc326f93d8e0bb36ff1c7b83d1d77e6a.1379332511.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/58129/
State New
Headers show

Comments

Alexandru DAMIAN - Sept. 16, 2013, 11:56 a.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

We add the path to the logfile for all Task events, so
that we can record the logfile locations during the run.

This is needed because the logfile symlinks will point
only to the last build logs, and there is no other link
between a certain build and the log file it produces.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 bitbake/lib/bb/build.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
Richard Purdie - Sept. 16, 2013, 12:14 p.m.
On Mon, 2013-09-16 at 12:56 +0100, Alex DAMIAN wrote:
> From: Alexandru DAMIAN <alexandru.damian@intel.com>
> 
> We add the path to the logfile for all Task events, so
> that we can record the logfile locations during the run.
> 
> This is needed because the logfile symlinks will point
> only to the last build logs, and there is no other link
> between a certain build and the log file it produces.
> 
> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
> ---
>  bitbake/lib/bb/build.py | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)

a) you might as well modify TaskBase intead of each Task 
b) You didn't fix up all the original Task* references e.g. TaskInvalid.

I gave up and merged my own version of this.

Cheers,

Richard

Patch

diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 1265bdc..8d001b1 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -91,13 +91,18 @@  class TaskBase(event.Event):
 
 class TaskStarted(TaskBase):
     """Task execution started"""
+    def __init__(self, task, logfile, metadata):
+        self.logfile = logfile
+        super(TaskStarted, self).__init__(task, metadata)
 
 class TaskSucceeded(TaskBase):
     """Task execution completed"""
+    def __init__(self, task, logfile, metadata):
+        self.logfile = logfile
+        super(TaskSucceeded, self).__init__(task, metadata)
 
 class TaskFailed(TaskBase):
     """Task execution failed"""
-
     def __init__(self, task, logfile, metadata, errprinted = False):
         self.logfile = logfile
         self.errprinted = errprinted
@@ -114,8 +119,8 @@  class TaskFailedSilent(TaskBase):
         return "Failed"
 
 class TaskInvalid(TaskBase):
-
-    def __init__(self, task, metadata):
+    def __init__(self, task, logfile, metadata):
+        self.logfile = logfile
         super(TaskInvalid, self).__init__(task, metadata)
         self._message = "No such task '%s'" % task
 
@@ -419,7 +424,7 @@  def _exec_task(fn, task, d, quieterr):
     localdata.setVar('BB_LOGFILE', logfn)
     localdata.setVar('BB_RUNTASK', task)
 
-    event.fire(TaskStarted(task, localdata), localdata)
+    event.fire(TaskStarted(task, logfn, localdata), localdata)
     try:
         for func in (prefuncs or '').split():
             exec_func(func, localdata)
@@ -456,7 +461,7 @@  def _exec_task(fn, task, d, quieterr):
             logger.debug(2, "Zero size logfn %s, removing", logfn)
             bb.utils.remove(logfn)
             bb.utils.remove(loglink)
-    event.fire(TaskSucceeded(task, localdata), localdata)
+    event.fire(TaskSucceeded(task, logfn, localdata), localdata)
 
     if not localdata.getVarFlag(task, 'nostamp') and not localdata.getVarFlag(task, 'selfstamp'):
         make_stamp(task, localdata)