From: Daan De Meyer Date: Tue, 23 Jul 2024 13:11:08 +0000 (+0200) Subject: Move needs_clean() check out of run_clean() X-Git-Tag: v24~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26f8f5ddf66b54fe9ef794a224dcc46edd964dd4;p=thirdparty%2Fmkosi.git Move needs_clean() check out of run_clean() --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 36a9b470c..defa55ada 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -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