summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2018-10-17 17:11:14 +0100
committerJürg Billeter <j@bitron.ch>2018-10-17 17:17:06 +0100
commit0939ec15e138f47c0956a0a7873c5b604c5ec3e2 (patch)
tree13bdb94c47db9b1b5a1aec5358d158107380c9a0
parent63360244450960599580245980b552314301d504 (diff)
downloadbuildstream-juerg/cas-mtime.tar.gz
_artifactcache: Fix ref in update_mtime()juerg/cas-mtime
get_artifact_fullname() is required to construct the ref. The cache key alone does not suffice.
-rw-r--r--buildstream/_artifactcache/artifactcache.py5
-rw-r--r--buildstream/_artifactcache/cascache.py3
2 files changed, 5 insertions, 3 deletions
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py
index 443905c63..6c113d5ec 100644
--- a/buildstream/_artifactcache/artifactcache.py
+++ b/buildstream/_artifactcache/artifactcache.py
@@ -239,7 +239,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
@@ -395,9 +395,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