diff options
author | Jürg Billeter <j@bitron.ch> | 2018-08-14 16:40:26 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-08-15 15:02:32 +0200 |
commit | 1202ef8af64d328bd5db2ebf19d9246b9bfec195 (patch) | |
tree | 89ba20d08edafeb9ea0cc5ab1d9cb6cd75a62391 /buildstream | |
parent | 8b84a51a82181d4dacf9e8342f8927903f917454 (diff) | |
download | buildstream-1202ef8af64d328bd5db2ebf19d9246b9bfec195.tar.gz |
_artifactcache/cascache.py: Fix resource_name format for blobs
This requires an updated server.
Fixes #572.
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_artifactcache/cascache.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py index 4fea98626..00d09773c 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -24,6 +24,7 @@ import os import signal import stat import tempfile +import uuid from urllib.parse import urlparse import grpc @@ -309,8 +310,11 @@ class CASCache(ArtifactCache): # Upload any blobs missing on the server skipped_remote = False for digest in missing_blobs.values(): + uuid_ = uuid.uuid4() + resource_name = '/'.join(['uploads', str(uuid_), 'blobs', + digest.hash, str(digest.size_bytes)]) + def request_stream(): - resource_name = os.path.join(digest.hash, str(digest.size_bytes)) with open(self.objpath(digest), 'rb') as f: assert os.fstat(f.fileno()).st_size == digest.size_bytes offset = 0 @@ -747,7 +751,7 @@ class CASCache(ArtifactCache): yield from self._required_blobs(dirnode.digest) def _fetch_blob(self, remote, digest, out): - resource_name = os.path.join(digest.hash, str(digest.size_bytes)) + resource_name = '/'.join(['blobs', digest.hash, str(digest.size_bytes)]) request = bytestream_pb2.ReadRequest() request.resource_name = resource_name request.read_offset = 0 |