You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:45:44 UTC

[buildstream] 06/13: ArtifactServicer: Make GetArtifact update mtime blobs

This is an automated email from the ASF dual-hosted git repository.

not-in-ldap pushed a commit to branch tpollard/artifacttemp
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit ecc14131f8adfa84143467a376df0441cd72effa
Author: Raoul Hidalgo Charman <ra...@codethink.co.uk>
AuthorDate: Mon Apr 8 17:39:24 2019 +0100

    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 f88db71..c08a4d5 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)