From: Daan De Meyer Date: Sun, 14 Apr 2024 21:27:19 +0000 (+0200) Subject: Remove output symlink target as well when cleaning X-Git-Tag: v23.1~113 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=379a59ef97cc88fb02c38d051ed75c76266f282d;p=thirdparty%2Fmkosi.git Remove output symlink target as well when cleaning --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index f8c9cf8c2..5a31b1243 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -4216,11 +4216,15 @@ def run_clean(args: Args, config: Config, *, resources: Path) -> None: remove_build_cache = args.force > 1 remove_package_cache = args.force > 2 - outputs = [ + outputs = { config.output_dir_or_cwd() / output for output in config.outputs if (config.output_dir_or_cwd() / output).exists() - ] + } + + # Make sure we resolve the symlink we create in the output directory and remove its target as well as it might not + # be in the list of outputs anymore if the compression or output format was changed. + outputs |= {o.resolve() for o in outputs} if outputs: with (