From 96dce3ebad4ff454f0ba2cba273e849f9370f9aa Mon Sep 17 00:00:00 2001 From: Raoul Hidalgo Charman Date: Mon, 8 Apr 2019 17:39:24 +0100 Subject: ArtifactServicer: Make GetArtifact update mtime blobs Part of #974 --- buildstream/_cas/casserver.py | 23 +++++++++++++++++------ 1 file 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) -- cgit v1.2.1