Patchwork [bitbake-devel,1/4] build.py: Add a log to capture task execution order

login
register
mail settings
Submitter Mark Hatle
Date May 23, 2012, 3:45 p.m.
Message ID <1337787916-591-1-git-send-email-mark.hatle@windriver.com>
Download mbox | patch
Permalink /patch/28483/
State New
Headers show

Comments

Mark Hatle - May 23, 2012, 3:45 p.m.
The new log.task_order contains an ordered list of the tasks as they
were executed in any given recipe.  The format of the lines is
<task> <pid>: <log file>

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 lib/bb/build.py |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
Richard Purdie - May 23, 2012, 5:15 p.m.
On Wed, 2012-05-23 at 10:45 -0500, Mark Hatle wrote:
> The new log.task_order contains an ordered list of the tasks as they
> were executed in any given recipe.  The format of the lines is
> <task> <pid>: <log file>
> 
> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> ---
>  lib/bb/build.py |   16 +++++++++++++++-
>  1 files changed, 15 insertions(+), 1 deletions(-)

Merged to master, thanks.

Richard

Patch

diff --git a/lib/bb/build.py b/lib/bb/build.py
index 95f1dcf..4f06b15 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -290,8 +290,22 @@  def _exec_task(fn, task, d, quieterr):
         bb.fatal("T variable not set, unable to build")
 
     bb.utils.mkdirhier(tempdir)
-    loglink = os.path.join(tempdir, 'log.{0}'.format(task))
+
+    # Determine the logfile to generate
     logbase = 'log.{0}.{1}'.format(task, os.getpid())
+
+    # Document the order of the tasks...
+    logorder = os.path.join(tempdir, 'log.task_order')
+    try:
+        logorderfile = file(logorder, 'a')
+    except OSError:
+        logger.exception("Opening log file '%s'", logorder)
+        pass
+    logorderfile.write('{0} ({1}): {2}\n'.format(task, os.getpid(), logbase))
+    logorderfile.close()
+
+    # Setup the courtesy link to the logfn
+    loglink = os.path.join(tempdir, 'log.{0}'.format(task))
     logfn = os.path.join(tempdir, logbase)
     if loglink:
         bb.utils.remove(loglink)