All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/bb/build: create .old symlink for run.do_xx and log.do_xx
@ 2016-09-06 11:53 Nicolas Dechesne
  2016-09-06 13:19 ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Dechesne @ 2016-09-06 11:53 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Nicolas Dechesne

When they exist, keep a reference to the 'previous' (or old) build for run.do_xx
and log.do_xx files, which can be useful when debugging. The symlink are created
as run.do_xx.old and log.do_xx.old.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
---
 lib/bb/build.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lib/bb/build.py b/lib/bb/build.py
index 310b5c0..7cff578 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -246,6 +246,16 @@ def exec_func(func, d, dirs = None, pythonexception=False):
     # link won't be created as an exception would be fired.
     if task == func:
         runlink = os.path.join(tempdir, 'run.{0}'.format(task))
+        oldrunlink = os.path.join(tempdir, 'run.{0}.old'.format(task))
+
+        if oldrunlink and os.path.islink(runlink):
+            bb.utils.remove(oldrunlink)
+
+            try:
+                os.symlink(os.readlink(runlink), oldrunlink)
+            except OSError:
+                pass
+
         if runlink:
             bb.utils.remove(runlink)
 
@@ -503,7 +513,17 @@ def _exec_task(fn, task, d, quieterr):
 
     # Setup the courtesy link to the logfn
     loglink = os.path.join(tempdir, 'log.{0}'.format(task))
+    oldloglink = os.path.join(tempdir, 'log.{0}.old'.format(task))
     logfn = os.path.join(tempdir, logbase)
+
+    if oldloglink and os.path.islink(loglink):
+        bb.utils.remove(oldloglink)
+
+        try:
+            os.symlink(os.readlink(loglink), oldloglink)
+        except OSError:
+            pass
+
     if loglink:
         bb.utils.remove(loglink)
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-06 13:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-06 11:53 [PATCH] lib/bb/build: create .old symlink for run.do_xx and log.do_xx Nicolas Dechesne
2016-09-06 13:19 ` Richard Purdie
2016-09-06 13:26   ` Nicolas Dechesne

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.