diff options
author | Jürg Billeter <j@bitron.ch> | 2019-03-14 09:48:54 +0000 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-03-16 07:24:58 +0100 |
commit | 3dc95d4ba2bf6c236bc69f35c098f563ab0f65aa (patch) | |
tree | cea326b275654db5dce2530627ba45602b6eb0eb /buildstream | |
parent | 832e0021927fe5d942bb34d6059e7a006dc5b112 (diff) | |
download | buildstream-3dc95d4ba2bf6c236bc69f35c098f563ab0f65aa.tar.gz |
cascache.py: Handle missing subdir case in contains_subdir_artifacts()
Return False instead of raising an error.
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_cas/cascache.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/buildstream/_cas/cascache.py b/buildstream/_cas/cascache.py index 2be16067b..e07b4d4b4 100644 --- a/buildstream/_cas/cascache.py +++ b/buildstream/_cas/cascache.py @@ -128,12 +128,14 @@ class CASCache(): def contains_subdir_artifact(self, ref, subdir): tree = self.resolve_ref(ref) - # This assumes that the subdir digest is present in the element tree - subdirdigest = self._get_subdir(tree, subdir) - objpath = self.objpath(subdirdigest) + try: + subdirdigest = self._get_subdir(tree, subdir) + objpath = self.objpath(subdirdigest) - # True if subdir content is cached or if empty as expected - return os.path.exists(objpath) + # True if subdir content is cached or if empty as expected + return os.path.exists(objpath) + except CASCacheError: + return False # checkout(): # |