diff options
author | Jürg Billeter <j@bitron.ch> | 2018-10-17 17:11:14 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-10-22 17:05:41 +0000 |
commit | a7a28d14a71b4c343c4c7605779912e0d5a7c1fa (patch) | |
tree | 19b20995f081a6e229099411ea917d7eb7699841 | |
parent | 12719f0db161358013f3995e2fe83385630c7c4e (diff) | |
download | buildstream-a7a28d14a71b4c343c4c7605779912e0d5a7c1fa.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 c6c8afa80..5e698babb 100644 --- a/buildstream/_artifactcache/artifactcache.py +++ b/buildstream/_artifactcache/artifactcache.py @@ -240,7 +240,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 @@ -396,9 +396,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 8fb2e8b01..2454366ac 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -538,8 +538,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 |