summaryrefslogtreecommitdiff
path: root/buildstream/_artifactcache/cascache.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-10-03 21:57:43 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-10-03 13:44:02 +0000
commit3e797bb9b4d41346fae35eeed7c903062780f8ad (patch)
treeb59494e525fba121bbb85b8b3230b04f6ccb9bcd /buildstream/_artifactcache/cascache.py
parent11161f994b58db759a8f581b0fe39aa8e184407d (diff)
downloadbuildstream-3e797bb9b4d41346fae35eeed7c903062780f8ad.tar.gz
_artifactcache/cascache.py: Don't create temporary files in the CAS storage
Use the designated tempdir when creating refs, we expect that temporary files are not created in the storage directory ever, they should be only ever created in the designated temporary directory. This fixes race conditions where utils._get_dir_size() throws an unhandled exception when attempting to stat the file which inadvertantly disappears.
Diffstat (limited to 'buildstream/_artifactcache/cascache.py')
-rw-r--r--buildstream/_artifactcache/cascache.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index 3a3181bfb..3e63608be 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -506,7 +506,7 @@ class CASCache(ArtifactCache):
def set_ref(self, ref, tree):
refpath = self._refpath(ref)
os.makedirs(os.path.dirname(refpath), exist_ok=True)
- with utils.save_file_atomic(refpath, 'wb') as f:
+ with utils.save_file_atomic(refpath, 'wb', tempdir=self.tmpdir) as f:
f.write(tree.SerializeToString())
# resolve_ref():