summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2024-06-23 17:03:49 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-06-25 11:51:45 +0100
commitac40cb5ee24a8ef44b941c4b9bbf6eec6f61d13c (patch)
tree08e0a3a56918ad79a19f0d904c5b1061501661e6
parent2346c7ca09d3b2247f15f760dc9db215f619a36d (diff)
downloadpoky-ac40cb5ee24a8ef44b941c4b9bbf6eec6f61d13c.tar.gz
bitbake: cache: Remove invalid symlink for bb_cache.dat
The bb_cache.dat might be an invalid symlink when error happens, then os.path.exists(symlink) would return False for it, the invalid symlink wouldn't be removed and os.symlink can't update it any more. Use os.path.islink(symlink) can fix the problem. (Bitbake rev: 1387d7b9ee3f270488f89b29f36f9f240e44accc) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/cache.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 18d5574a31..4a96f5b313 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -441,7 +441,7 @@ class Cache(object):
441 else: 441 else:
442 symlink = os.path.join(self.cachedir, "bb_cache.dat") 442 symlink = os.path.join(self.cachedir, "bb_cache.dat")
443 443
444 if os.path.exists(symlink): 444 if os.path.exists(symlink) or os.path.islink(symlink):
445 bb.utils.remove(symlink) 445 bb.utils.remove(symlink)
446 try: 446 try:
447 os.symlink(os.path.basename(self.cachefile), symlink) 447 os.symlink(os.path.basename(self.cachefile), symlink)