summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-06-18 15:20:27 +0100
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-06-26 09:34:16 +0100
commita55b3f11e40a6ebeb45acab4893df2911c1b25aa (patch)
tree1a088ae17064ba195c4a3fc516fff3e628bb28d7
parent20374acb75621fd0c600b8bac0cc1330b86bf9b9 (diff)
downloadbuildstream-a55b3f11e40a6ebeb45acab4893df2911c1b25aa.tar.gz
_casbaseddirectory: Alter _save to save the serialised digest object, not the text digest
-rw-r--r--buildstream/storage/_casbaseddirectory.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/buildstream/storage/_casbaseddirectory.py b/buildstream/storage/_casbaseddirectory.py
index 276ca9a40..4f7aa78cf 100644
--- a/buildstream/storage/_casbaseddirectory.py
+++ b/buildstream/storage/_casbaseddirectory.py
@@ -360,13 +360,14 @@ class CasBasedDirectory(Directory):
currently in use, but may be useful later. """
self._recalculate_recursing_up()
self._recalculate_recursing_down()
- refdir = os.path.join(self.cas_directory, 'refs', 'heads')
- refname = os.path.join(refdir, name)
+ (rel_refpath, refname) = os.path.split(name)
+ refdir = os.path.join(self.cas_directory, 'refs', 'heads', rel_refpath)
+ refname = os.path.join(refdir, refname)
if not os.path.exists(refdir):
os.makedirs(refdir)
- with open(refname, "wt") as f:
- f.write(self.ref.hash)
+ with open(refname, "wb") as f:
+ f.write(self.ref.SerializeToString())
def import_files(self, external_pathspec: any, files: List[str] = None,
report_written: bool = True, update_utimes: bool = False,