aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/cache.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-01 19:14:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-02 12:27:23 +0100
commit9e72a3915e36cb843037040cb68a82077436dbef (patch)
treef4e955fcafdade26e37372265021e8552a5608aa /lib/bb/cache.py
parent7912dabbcf444a3c3d971cca4a944a8b931e301b (diff)
downloadbitbake-9e72a3915e36cb843037040cb68a82077436dbef.tar.gz
cache/siggen: Add unihash cache copy function
We see rare failures in eSDK generation with zero sized unihash cache files. This is almost certainly due to races in the cache file being updated. Add a copy function where the cache file can be copied with the lock held to avoid this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/cache.py')
-rw-r--r--lib/bb/cache.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/bb/cache.py b/lib/bb/cache.py
index 92e9a3ced..988c596c3 100644
--- a/lib/bb/cache.py
+++ b/lib/bb/cache.py
@@ -24,6 +24,7 @@ from collections.abc import Mapping
import bb.utils
from bb import PrefixLoggerAdapter
import re
+import shutil
logger = logging.getLogger("BitBake.Cache")
@@ -998,3 +999,11 @@ class SimpleCache(object):
p.dump([data, self.cacheversion])
bb.utils.unlockfile(glf)
+
+ def copyfile(self, target):
+ if not self.cachefile:
+ return
+
+ glf = bb.utils.lockfile(self.cachefile + ".lock")
+ shutil.copy(self.cachefile, target)
+ bb.utils.unlockfile(glf)