diff options
-rw-r--r-- | buildstream/_artifactcache/artifactcache.py | 7 | ||||
-rw-r--r-- | buildstream/_artifactcache/cascache.py | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py index 965d6e132..2b1b8f1c7 100644 --- a/buildstream/_artifactcache/artifactcache.py +++ b/buildstream/_artifactcache/artifactcache.py @@ -378,6 +378,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 4b4d9883d..9bad0df5e 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -87,6 +87,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)) |