diff options
author | Jürg Billeter <j@bitron.ch> | 2019-02-27 11:13:55 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-01 05:11:55 +0000 |
commit | e825138e34433526f9b840807a2040bb16614b02 (patch) | |
tree | 8677098ff1f0ca1ccdcb1b5d489c00efddc8ee6e | |
parent | ba3dbeda34f14c2ff59be9e5f1fc5b92052eb383 (diff) | |
download | buildstream-e825138e34433526f9b840807a2040bb16614b02.tar.gz |
_casbaseddirectory.py: Rename `ref` constructor parameter to `digest`
`ref` was misleading.
-rw-r--r-- | buildstream/_artifactcache.py | 4 | ||||
-rw-r--r-- | buildstream/sandbox/_sandboxremote.py | 2 | ||||
-rw-r--r-- | buildstream/storage/_casbaseddirectory.py | 10 | ||||
-rw-r--r-- | tests/artifactcache/push.py | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/buildstream/_artifactcache.py b/buildstream/_artifactcache.py index dbe797dc5..9986d689f 100644 --- a/buildstream/_artifactcache.py +++ b/buildstream/_artifactcache.py @@ -441,7 +441,7 @@ class ArtifactCache(): def get_artifact_directory(self, element, key): ref = element.get_artifact_name(key) digest = self.cas.resolve_ref(ref, update_mtime=True) - return CasBasedDirectory(self.cas, digest) + return CasBasedDirectory(self.cas, digest=digest) # commit(): # @@ -694,7 +694,7 @@ class ArtifactCache(): def get_artifact_logs(self, ref): descend = ["logs"] cache_id = self.cas.resolve_ref(ref, update_mtime=True) - vdir = CasBasedDirectory(self.cas, cache_id).descend(descend) + vdir = CasBasedDirectory(self.cas, digest=cache_id).descend(descend) return vdir ################################################ diff --git a/buildstream/sandbox/_sandboxremote.py b/buildstream/sandbox/_sandboxremote.py index 3a0b651a0..2a6eea316 100644 --- a/buildstream/sandbox/_sandboxremote.py +++ b/buildstream/sandbox/_sandboxremote.py @@ -299,7 +299,7 @@ class SandboxRemote(Sandbox): # to replace the sandbox's virtual directory with that. Creating a new virtual directory object # from another hash will be interesting, though... - new_dir = CasBasedDirectory(context.artifactcache.cas, ref=dir_digest) + new_dir = CasBasedDirectory(context.artifactcache.cas, digest=dir_digest) self._set_virtual_directory(new_dir) def _run(self, command, flags, *, cwd, env): diff --git a/buildstream/storage/_casbaseddirectory.py b/buildstream/storage/_casbaseddirectory.py index bd72e7c1c..45b0b8dfe 100644 --- a/buildstream/storage/_casbaseddirectory.py +++ b/buildstream/storage/_casbaseddirectory.py @@ -48,7 +48,7 @@ class IndexEntry(): def get_directory(self, parent): if not self.buildstream_object: - self.buildstream_object = CasBasedDirectory(parent.cas_cache, ref=self.pb_object.digest, + self.buildstream_object = CasBasedDirectory(parent.cas_cache, digest=self.pb_object.digest, parent=parent, filename=self.pb_object.name) return self.buildstream_object @@ -105,16 +105,16 @@ class CasBasedDirectory(Directory): _pb2_path_sep = "/" _pb2_absolute_path_prefix = "/" - def __init__(self, cas_cache, ref=None, parent=None, common_name="untitled", filename=None): + def __init__(self, cas_cache, *, digest=None, parent=None, common_name="untitled", filename=None): self.filename = filename self.common_name = common_name self.pb2_directory = remote_execution_pb2.Directory() self.cas_cache = cas_cache - if ref: - with open(self.cas_cache.objpath(ref), 'rb') as f: + if digest: + with open(self.cas_cache.objpath(digest), 'rb') as f: self.pb2_directory.ParseFromString(f.read()) - self.ref = ref + self.ref = digest self.index = {} self.parent = parent self._directory_read = False diff --git a/tests/artifactcache/push.py b/tests/artifactcache/push.py index 703e42a28..a7b8bdbd9 100644 --- a/tests/artifactcache/push.py +++ b/tests/artifactcache/push.py @@ -233,7 +233,7 @@ def _test_push_directory(user_config_file, project_dir, artifact_digest, queue): if cas.has_push_remotes(): # Create a CasBasedDirectory from local CAS cache content - directory = CasBasedDirectory(context.artifactcache.cas, ref=artifact_digest) + directory = CasBasedDirectory(context.artifactcache.cas, digest=artifact_digest) # Push the CasBasedDirectory object cas.push_directory(project, directory) |