summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-10-29 09:03:58 +0100
committerJürg Billeter <j@bitron.ch>2020-12-09 14:51:06 +0000
commit1029ea03ae4b4dcc3f0365325ad828865763b10f (patch)
tree321b4597906241e91d7e9765aafaa2046ca0def7 /src
parent0b5155e908388f018060b3b721f22ecf8a9666b9 (diff)
downloadbuildstream-1029ea03ae4b4dcc3f0365325ad828865763b10f.tar.gz
cascache.py: Remove _ensure_blob() method
It's only used by `_fetch_tree()` and can be replaced by a single additional line.
Diffstat (limited to 'src')
-rw-r--r--src/buildstream/_cas/cascache.py26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py
index d41d6ad71..ccb8010ad 100644
--- a/src/buildstream/_cas/cascache.py
+++ b/src/buildstream/_cas/cascache.py
@@ -482,29 +482,6 @@ class CASCache:
os.chmod(f.name, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)
yield f
- # _ensure_blob():
- #
- # Fetch and add blob if it's not already local.
- #
- # Args:
- # remote (Remote): The remote to use.
- # digest (Digest): Digest object for the blob to fetch.
- #
- # Returns:
- # (str): The path of the object
- #
- def _ensure_blob(self, remote, digest):
- objpath = self.objpath(digest)
- if os.path.exists(objpath):
- # already in local repository
- return objpath
-
- batch = _CASBatchRead(remote)
- batch.add(digest)
- batch.send()
-
- return objpath
-
# _fetch_directory():
#
# Fetches remote directory and adds it to content addressable store.
@@ -539,10 +516,11 @@ class CASCache:
self.fetch_blobs(remote, required_blobs)
def _fetch_tree(self, remote, digest):
- objpath = self._ensure_blob(remote, digest)
+ self.fetch_blobs(remote, [digest])
tree = remote_execution_pb2.Tree()
+ objpath = self.objpath(digest)
with open(objpath, "rb") as f:
tree.ParseFromString(f.read())