diff options
author | Jürg Billeter <j@bitron.ch> | 2019-03-12 13:23:08 +0000 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-03-25 10:24:41 +0100 |
commit | 559cd74867142dbf74e73bd9f30ccbb41021cde7 (patch) | |
tree | 3d93230f0417544faae7c5613797d9d02d35dc3b | |
parent | ab435f8f2811686d5bb1977e4c296a6c04fbfe48 (diff) | |
download | buildstream-559cd74867142dbf74e73bd9f30ccbb41021cde7.tar.gz |
cascache.py: Add with_files parameter to contains_subdir_artifact()
-rw-r--r-- | buildstream/_cas/cascache.py | 9 |
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(): |