diff options
author | Jürg Billeter <j@bitron.ch> | 2018-10-17 17:11:14 +0100 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2020-07-30 10:22:53 +0000 |
commit | aa5007f1dbd5263aea087f4295f389c1d93fddb4 (patch) | |
tree | 8722d4f5d09a96464481749ef64b57e79e28f5ba | |
parent | 228c41bf68122e791a19f7f37d87a31e0cf440d6 (diff) | |
download | buildstream-aa5007f1dbd5263aea087f4295f389c1d93fddb4.tar.gz |
_artifactcache: Fix ref in update_mtime()
get_artifact_fullname() is required to construct the ref. The cache key
alone does not suffice.
-rw-r--r-- | buildstream/_artifactcache/artifactcache.py | 5 | ||||
-rw-r--r-- | 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 |