diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-01 19:14:41 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-02 12:28:21 +0100 |
commit | bcf935cd1bd7b0ed0b636fd8b984cd7dab3ebd3e (patch) | |
tree | dbd25c21fd022398ba5155b33fa8edd1911fa729 /bitbake/lib/bb/cache.py | |
parent | 3664efc86a020d782f43eda540872fca07293823 (diff) | |
download | poky-bcf935cd1bd7b0ed0b636fd8b984cd7dab3ebd3e.tar.gz |
bitbake: 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.
(Bitbake rev: 9e72a3915e36cb843037040cb68a82077436dbef)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cache.py')
-rw-r--r-- | bitbake/lib/bb/cache.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index 92e9a3ced7..988c596c39 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py | |||
@@ -24,6 +24,7 @@ from collections.abc import Mapping | |||
24 | import bb.utils | 24 | import bb.utils |
25 | from bb import PrefixLoggerAdapter | 25 | from bb import PrefixLoggerAdapter |
26 | import re | 26 | import re |
27 | import shutil | ||
27 | 28 | ||
28 | logger = logging.getLogger("BitBake.Cache") | 29 | logger = logging.getLogger("BitBake.Cache") |
29 | 30 | ||
@@ -998,3 +999,11 @@ class SimpleCache(object): | |||
998 | p.dump([data, self.cacheversion]) | 999 | p.dump([data, self.cacheversion]) |
999 | 1000 | ||
1000 | bb.utils.unlockfile(glf) | 1001 | bb.utils.unlockfile(glf) |
1002 | |||
1003 | def copyfile(self, target): | ||
1004 | if not self.cachefile: | ||
1005 | return | ||
1006 | |||
1007 | glf = bb.utils.lockfile(self.cachefile + ".lock") | ||
1008 | shutil.copy(self.cachefile, target) | ||
1009 | bb.utils.unlockfile(glf) | ||