diff options
author | Jürg Billeter <j@bitron.ch> | 2020-10-29 09:03:58 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-12-04 16:29:06 +0100 |
commit | 9a7d79626b4183e5a6d66ead76de55eec11ca801 (patch) | |
tree | ca03f7829070edb2b689e41157d99d8994707380 | |
parent | 0a0573f6985c2c3036ae35bbe5ecee7852dd05a5 (diff) | |
download | buildstream-9a7d79626b4183e5a6d66ead76de55eec11ca801.tar.gz |
cascache.py: Remove _ensure_blob() method
It's only used by `_fetch_tree()` and can be replaced by a single
additional line.
-rw-r--r-- | src/buildstream/_cas/cascache.py | 26 |
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()) |