summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-06-25 17:52:20 +0100
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-06-26 09:29:04 +0100
commit4f4a4159d6c295714439131c7ee7fb5738c814c7 (patch)
tree36e2f0977ef20d66364a7ae954535b4d63343c3d
parenta14f7fa76b88fb1d8c5c8f74b2173a96a5bd96d2 (diff)
downloadbuildstream-4f4a4159d6c295714439131c7ee7fb5738c814c7.tar.gz
_casbaseddirectory.py: Fix _recalculate_recursing_down so it updates the PB2 structure
-rw-r--r--buildstream/storage/_casbaseddirectory.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/buildstream/storage/_casbaseddirectory.py b/buildstream/storage/_casbaseddirectory.py
index 74ac7d673..2cbfddb56 100644
--- a/buildstream/storage/_casbaseddirectory.py
+++ b/buildstream/storage/_casbaseddirectory.py
@@ -115,7 +115,7 @@ class CasBasedDirectory(Directory):
if self.parent:
self.parent._recalculate_recursing_up(self)
- def _recalculate_recursing_down(self) -> None:
+ def _recalculate_recursing_down(self, parent=None) -> None:
"""Recalcuate the hash for this directory and any
subdirectories. Hashes for subdirectories should be calculated
and stored after a significant operation (e.g. an
@@ -123,9 +123,13 @@ class CasBasedDirectory(Directory):
is extremely wasteful.
"""
- self.ref = self.cas_cache.add_object(buffer=self.pb2_directory.SerializeToString())
for entry in self.pb2_directory.directories:
- self.index[entry.name].buildstream_object._recalculate_recursing_down()
+ self.index[entry.name].buildstream_object._recalculate_recursing_down(entry)
+
+ if parent:
+ self.ref = self.cas_cache.add_object(digest=parent.digest, buffer=self.pb2_directory.SerializeToString())
+ else:
+ self.ref = self.cas_cache.add_object(buffer=self.pb2_directory.SerializeToString())
# We don't need to do anything more than that; files were already added ealier, and symlinks are
# part of the directory structure.