summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildstream/_artifactcache/artifactcache.py7
-rw-r--r--buildstream/_artifactcache/cascache.py6
2 files changed, 13 insertions, 0 deletions
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py
index f4157c7ef..6a9b57f2c 100644
--- a/buildstream/_artifactcache/artifactcache.py
+++ b/buildstream/_artifactcache/artifactcache.py
@@ -383,6 +383,13 @@ class ArtifactCache():
# Abstract methods for subclasses to implement #
################################################
+ # preflight():
+ #
+ # Preflight check.
+ #
+ def preflight(self):
+ pass
+
# update_atime()
#
# Update the atime of an artifact.
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index 137bcbc5a..936cb780b 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -80,6 +80,12 @@ class CASCache(ArtifactCache):
# Implementation of abstract methods #
################################################
+ def preflight(self):
+ if (not os.path.isdir(os.path.join(self.casdir, 'refs', 'heads')) or
+ not os.path.isdir(os.path.join(self.casdir, 'objects'))):
+ raise ArtifactError("CAS repository check failed for '{}'"
+ .format(self.casdir))
+
def contains(self, element, key):
refpath = self._refpath(self.get_artifact_fullname(element, key))