From 4b4c52689361a24534ad80fe2ee35123a6d98180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= <j@bitron.ch> Date: Tue, 10 Jul 2018 17:55:45 +0200 Subject: [PATCH] _artifactcache/casserver.py: Add update_mtime parameter to resolve_ref() --- buildstream/_artifactcache/cascache.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py index b7055a07f0..a3fd16af45 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -431,15 +431,19 @@ class CASCache(ArtifactCache): # # Args: # ref (str): The name of the ref + # update_mtime (bool): Whether to update the mtime of the ref # # Returns: # (Digest): The digest stored in the ref # - def resolve_ref(self, ref): + def resolve_ref(self, ref, *, update_mtime=False): refpath = self._refpath(ref) try: with open(refpath, 'rb') as f: + if update_mtime: + os.utime(refpath) + digest = remote_execution_pb2.Digest() digest.ParseFromString(f.read()) return digest -- GitLab