The setup() method of some distributions creates files in the root
directory which means that checking if the root directory is empty
doesn't work. Instead, let's check if any base trees were specified
explicitly.
@contextlib.contextmanager
def mount_cache_overlay(context: Context) -> Iterator[None]:
- if not context.config.incremental or not any(context.root.iterdir()):
+ if not context.config.incremental or not context.config.base_trees or context.config.overlay:
yield
return