diff options
author | Raoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk> | 2019-04-08 17:39:24 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-05-15 10:18:26 +0000 |
commit | 96dce3ebad4ff454f0ba2cba273e849f9370f9aa (patch) | |
tree | b4f071bc311ab3ef1af683a1ea08480e2fac2efd | |
parent | f2583c2aea2a29d88a00c1f791b2a64c8d925ed7 (diff) | |
download | buildstream-96dce3ebad4ff454f0ba2cba273e849f9370f9aa.tar.gz |
ArtifactServicer: Make GetArtifact update mtime blobs
Part of #974
-rw-r--r-- | buildstream/_cas/casserver.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/buildstream/_cas/casserver.py b/buildstream/_cas/casserver.py index f88db717a..c08a4d577 100644 --- a/buildstream/_cas/casserver.py +++ b/buildstream/_cas/casserver.py @@ -428,11 +428,25 @@ class _ArtifactServicer(artifact_pb2_grpc.ArtifactServiceServicer): with open(artifact_path, 'rb') as f: artifact.ParseFromString(f.read()) - files_digest = artifact.files - # Now update mtimes of files present. try: - self.cas.update_tree_mtime(files_digest) + + if str(artifact.files): + self.cas.update_tree_mtime(artifact.files) + + if str(artifact.buildtree): + # buildtrees might not be there + try: + self.cas.update_tree_mtime(artifact.buildtree) + except FileNotFoundError: + pass + + if str(artifact.public_data): + os.utime(self.cas.objpath(artifact.public_data)) + + for log_file in artifact.logs: + os.utime(self.cas.objpath(log_file.digest)) + except FileNotFoundError: os.unlink(artifact_path) context.abort(grpc.StatusCode.NOT_FOUND, @@ -451,9 +465,6 @@ class _ArtifactServicer(artifact_pb2_grpc.ArtifactServiceServicer): # Unset protocol buffers don't evaluated to False but do return empty # strings, hence str() - if str(artifact.buildtree): - self._check_directory("buildtree", artifact.buildtree, context) - if str(artifact.public_data): self._check_file("public data", artifact.public_data, context) |