[bitbake-devel,1/1] cache: Create a symlink for current cachefile

Submitted by Robert Yang on July 4, 2019, 4:12 a.m. | Patch ID: 162769

Details

Message ID 94e192f582faa200b0384945c1986b13bb9c3cfd.1562213458.git.liezhi.yang@windriver.com
State New
Headers show

Commit Message

Robert Yang July 4, 2019, 4:12 a.m.
So that people or other tools can easily know which one is being used, just
like what we did for run.do_task and log.do_task, otherwise, we have no way
to know it. I usually use "ls -t", but it isn't reliable since the one which
is being used may not the latest one.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 bitbake/lib/bb/cache.py | 8 ++++++++
 1 file changed, 8 insertions(+)

Patch hide | download patch | download mbox

diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 5fb2f17..c813d6a 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -399,6 +399,14 @@  class Cache(NoCache):
         else:
             logger.debug(1, "Cache file %s not found, building..." % self.cachefile)
 
+        symlink = os.path.join(self.cachedir, "bb_cache.dat")
+        if os.path.exists(symlink):
+            bb.utils.remove(symlink)
+        try:
+            os.symlink(os.path.basename(self.cachefile), symlink)
+        except OSError:
+            pass
+
     def load_cachefile(self):
         cachesize = 0
         previous_progress = 0