diff options
author | Jürg Billeter <j@bitron.ch> | 2020-10-29 09:49:37 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-12-09 14:51:06 +0000 |
commit | 1c8e13ca2fdab14568539bb50af0aa94f0c18c93 (patch) | |
tree | f750b26e342d50593a8985d53ef1ad87f84a8b63 /src | |
parent | 1029ea03ae4b4dcc3f0365325ad828865763b10f (diff) | |
download | buildstream-1c8e13ca2fdab14568539bb50af0aa94f0c18c93.tar.gz |
cascache.py: Remove unused parameters from add_object()
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/_artifact.py | 6 | ||||
-rw-r--r-- | src/buildstream/_cas/cascache.py | 10 | ||||
-rw-r--r-- | src/buildstream/storage/_casbaseddirectory.py | 2 |
3 files changed, 6 insertions, 12 deletions
diff --git a/src/buildstream/_artifact.py b/src/buildstream/_artifact.py index 6e2bc9342..b92600a5a 100644 --- a/src/buildstream/_artifact.py +++ b/src/buildstream/_artifact.py @@ -241,7 +241,7 @@ class Artifact: # Store public data with utils._tempnamedfile_name(dir=self._tmpdir) as tmpname: _yaml.roundtrip_dump(publicdata, tmpname) - public_data_digest = self._cas.add_object(path=tmpname, link_directly=True) + public_data_digest = self._cas.add_object(path=tmpname) artifact.public_data.CopyFrom(public_data_digest) size += public_data_digest.size_bytes @@ -255,7 +255,7 @@ class Artifact: low_diversity_node = Node.from_dict(low_diversity_dict) _yaml.roundtrip_dump(low_diversity_node, tmpname) - low_diversity_meta_digest = self._cas.add_object(path=tmpname, link_directly=True) + low_diversity_meta_digest = self._cas.add_object(path=tmpname) artifact.low_diversity_meta.CopyFrom(low_diversity_meta_digest) size += low_diversity_meta_digest.size_bytes @@ -269,7 +269,7 @@ class Artifact: high_diversity_node = Node.from_dict(high_diversity_dict) _yaml.roundtrip_dump(high_diversity_node, tmpname) - high_diversity_meta_digest = self._cas.add_object(path=tmpname, link_directly=True) + high_diversity_meta_digest = self._cas.add_object(path=tmpname) artifact.high_diversity_meta.CopyFrom(high_diversity_meta_digest) size += high_diversity_meta_digest.size_bytes diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py index ccb8010ad..46dc8b478 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -283,10 +283,8 @@ class CASCache: # Hash and write object to CAS. # # Args: - # digest (Digest): An optional Digest object to populate # path (str): Path to file to add # buffer (bytes): Byte buffer to add - # link_directly (bool): Whether file given by path can be linked # instance_name (str): casd instance_name for remote CAS # # Returns: @@ -294,15 +292,11 @@ class CASCache: # # Either `path` or `buffer` must be passed, but not both. # - def add_object(self, *, digest=None, path=None, buffer=None, link_directly=False, instance_name=None): + def add_object(self, *, path=None, buffer=None, instance_name=None): # Exactly one of the two parameters has to be specified assert (path is None) != (buffer is None) - # If we're linking directly, then path must be specified. - assert (not link_directly) or (link_directly and path) - - if digest is None: - digest = remote_execution_pb2.Digest() + digest = remote_execution_pb2.Digest() with contextlib.ExitStack() as stack: if path is None: diff --git a/src/buildstream/storage/_casbaseddirectory.py b/src/buildstream/storage/_casbaseddirectory.py index 75399953e..c061a28e4 100644 --- a/src/buildstream/storage/_casbaseddirectory.py +++ b/src/buildstream/storage/_casbaseddirectory.py @@ -220,7 +220,7 @@ class CasBasedDirectory(Directory): return newdir def _add_file(self, name, path, modified=False, can_link=False, properties=None): - digest = self.cas_cache.add_object(path=path, link_directly=can_link) + digest = self.cas_cache.add_object(path=path) is_executable = os.access(path, os.X_OK) mtime = None if properties and "mtime" in properties: |