From aa5007f1dbd5263aea087f4295f389c1d93fddb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Wed, 17 Oct 2018 17:11:14 +0100 Subject: _artifactcache: Fix ref in update_mtime() get_artifact_fullname() is required to construct the ref. The cache key alone does not suffice. --- buildstream/_artifactcache/artifactcache.py | 5 +++-- buildstream/_artifactcache/cascache.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py index 728819e81..ed5ef8262 100644 --- a/buildstream/_artifactcache/artifactcache.py +++ b/buildstream/_artifactcache/artifactcache.py @@ -268,7 +268,7 @@ class ArtifactCache(): for key in (strong_key, weak_key): if key: try: - self.update_mtime(key) + self.update_mtime(element, key) except ArtifactError: pass @@ -483,9 +483,10 @@ class ArtifactCache(): # Update the mtime of an artifact. # # Args: + # element (Element): The Element to update # key (str): The key of the artifact. # - def update_mtime(self, key): + def update_mtime(self, element, key): raise ImplError("Cache '{kind}' does not implement update_mtime()" .format(kind=type(self).__name__)) diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py index c1fc90bb6..a3d27c8d1 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -513,8 +513,9 @@ class CASCache(ArtifactCache): except FileNotFoundError as e: raise ArtifactError("Attempt to access unavailable artifact: {}".format(e)) from e - def update_mtime(self, ref): + def update_mtime(self, element, key): try: + ref = self.get_artifact_fullname(element, key) os.utime(self._refpath(ref)) except FileNotFoundError as e: raise ArtifactError("Attempt to access unavailable artifact: {}".format(e)) from e -- cgit v1.2.1