]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Output files starting with `Output=` are removed
authorMichael Ferrari <nekkodroid404@gmail.com>
Wed, 20 Dec 2023 01:10:53 +0000 (02:10 +0100)
committerMichael Ferrari <nekkodroid404@gmail.com>
Wed, 20 Dec 2023 01:10:53 +0000 (02:10 +0100)
As preparation for the removal of `config.output_with_version` the
removal of output files now only factors in `config.output` as prefix
and no longer removes based on version suffix, due to that being added
to `config.output` in a following commit.

mkosi/__init__.py

index 4733d5ffdb15b5a777ab06895482b7e8c5994e8f..8d332b0702ccf2a64b7c9256353acff009b34886 100644 (file)
@@ -1847,21 +1847,19 @@ def empty_directory(path: Path) -> None:
 def unlink_output(args: MkosiArgs, config: MkosiConfig) -> None:
     # We remove any cached images if either the user used --force twice, or he/she called "clean" with it
     # passed once. Let's also remove the downloaded package cache if the user specified one additional
-    # "--force". Let's also remove all versions if the user specified one additional "--force".
+    # "--force".
 
     if args.verb == Verb.clean:
         remove_build_cache = args.force > 0
         remove_package_cache = args.force > 1
-        prefix = config.output if args.force > 1 else config.output_with_version
     else:
         remove_build_cache = args.force > 1
         remove_package_cache = args.force > 2
-        prefix = config.output if args.force > 2 else config.output_with_version
 
     with complete_step("Removing output files…"):
         if config.output_dir_or_cwd().exists():
             for p in config.output_dir_or_cwd().iterdir():
-                if p.name.startswith(prefix):
+                if p.name.startswith(config.output):
                     rmtree(p)
 
     if remove_build_cache: