]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Move needs_clean() check out of run_clean()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 23 Jul 2024 13:11:08 +0000 (15:11 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 24 Jul 2024 06:25:04 +0000 (08:25 +0200)
mkosi/__init__.py

index 36a9b470cfe5da9b0c2919c4ff3a5ae157dcd877..defa55ada34c849ba757320d22c7ab3d972c3f11 100644 (file)
@@ -4565,9 +4565,6 @@ def needs_clean(args: Args, config: Config, force: int = 1) -> bool:
 
 
 def run_clean(args: Args, config: Config, *, resources: Path) -> None:
-    if not needs_clean(args, config):
-        return
-
     become_root()
 
     # We remove any cached images if either the user used --force twice, or he/she called "clean" with it
@@ -4863,7 +4860,8 @@ def run_verb(args: Args, images: Sequence[Config], *, resources: Path) -> None:
     # First, process all directory removals because otherwise if different images share directories a later
     # image build could end up deleting the output generated by an earlier image build.
     for config in images:
-        fork_and_wait(run_clean, args, config, resources=resources)
+        if needs_clean(args, config):
+            fork_and_wait(run_clean, args, config, resources=resources)
 
     if args.verb == Verb.clean:
         return