summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-03-12 13:23:08 +0000
committerJürg Billeter <j@bitron.ch>2019-03-25 10:24:41 +0100
commit559cd74867142dbf74e73bd9f30ccbb41021cde7 (patch)
tree3d93230f0417544faae7c5613797d9d02d35dc3b
parentab435f8f2811686d5bb1977e4c296a6c04fbfe48 (diff)
downloadbuildstream-559cd74867142dbf74e73bd9f30ccbb41021cde7.tar.gz
cascache.py: Add with_files parameter to contains_subdir_artifact()
-rw-r--r--buildstream/_cas/cascache.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/buildstream/_cas/cascache.py b/buildstream/_cas/cascache.py
index 0e9f12996..46bd7d945 100644
--- a/buildstream/_cas/cascache.py
+++ b/buildstream/_cas/cascache.py
@@ -122,19 +122,18 @@ class CASCache():
# Args:
# ref (str): The ref to check
# subdir (str): The subdir to check
+ # with_files (bool): Whether to check files as well
#
# Returns: True if the subdir exists & is populated in the cache, False otherwise
#
- def contains_subdir_artifact(self, ref, subdir):
+ def contains_subdir_artifact(self, ref, subdir, *, with_files=True):
tree = self.resolve_ref(ref)
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)
- except CASCacheError:
+ return self.contains_directory(subdirdigest, with_files=with_files)
+ except (CASCacheError, FileNotFoundError):
return False
# contains_directory():