diff options
author | Jürg Billeter <j@bitron.ch> | 2018-09-27 09:58:26 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-04-14 16:25:19 +0900 |
commit | ec83ac8fc33c9147cdc6d1b59113ae40307478ac (patch) | |
tree | 395badca320e3724b860224253620e1234506691 | |
parent | 836ec053250917f50cecd17c9d5b3ca56643f76c (diff) | |
download | buildstream-ec83ac8fc33c9147cdc6d1b59113ae40307478ac.tar.gz |
_artifactcache: Add preflight() method
-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)) |