From: Daan De Meyer Date: Mon, 15 May 2023 13:47:35 +0000 (+0200) Subject: Only clean cache images if cache dir exists X-Git-Tag: v15~157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=281e85990d50f5680a63b97cbdc988a16a026dd1;p=thirdparty%2Fmkosi.git Only clean cache images if cache dir exists --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 867dea78e..bf6da8328 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1036,10 +1036,11 @@ def unlink_output(args: MkosiArgs, config: MkosiConfig) -> None: unlink_try_hard(p) if remove_build_cache: - for p in cache_tree_paths(config): - if p.exists(): - with complete_step(f"Removing cache entry {p}…"): - unlink_try_hard(p) + if config.cache_dir: + for p in cache_tree_paths(config): + if p.exists(): + with complete_step(f"Removing cache entry {p}…"): + unlink_try_hard(p) if config.build_dir and config.build_dir.exists() and any(config.build_dir.iterdir()): with complete_step("Clearing out build directory…"):