From: Daan De Meyer Date: Thu, 28 Nov 2024 15:12:03 +0000 (+0100) Subject: Don't resolve deps if we're reusing previous config X-Git-Tag: v25~139 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c3af463f0cdf31bc85fa04413041c8f21082f0c;p=thirdparty%2Fmkosi.git Don't resolve deps if we're reusing previous config We ignore subimages if we're reusing the previous config so let's make sure we ignore subimages as well after running configure scripts if we're reusing previous config. Fixes #3238 --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index ebb815b15..2e3454f9d 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -71,6 +71,7 @@ from mkosi.config import ( Vmm, cat_config, format_bytes, + have_history, parse_boolean, parse_config, resolve_deps, @@ -4725,7 +4726,9 @@ def run_verb(args: Args, images: Sequence[Config], *, resources: Path) -> None: # The images array has been modified so we need to reevaluate last again. # Also ensure that all other images are reordered in case their dependencies were modified. last = images[-1] - images = resolve_deps(images[:-1], last.dependencies) + [last] + + if not have_history(args): + images = resolve_deps(images[:-1], last.dependencies) + [last] if not (last.output_dir_or_cwd() / last.output).exists() or last.output_format == OutputFormat.none: for config in images: diff --git a/mkosi/config.py b/mkosi/config.py index 6ed20c4ea..31cc1707f 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -4355,6 +4355,15 @@ class ParseContext: return True +def have_history(args: Args) -> bool: + return ( + args.verb.needs_build() + and args.verb != Verb.build + and not args.force + and Path(".mkosi-private/history/latest.json").exists() + ) + + def parse_config( argv: Sequence[str] = (), *, @@ -4404,12 +4413,7 @@ def parse_config( if not args.verb.needs_config(): return args, () - if ( - args.verb.needs_build() - and args.verb != Verb.build - and not args.force - and Path(".mkosi-private/history/latest.json").exists() - ): + if have_history(args): try: prev = Config.from_json(Path(".mkosi-private/history/latest.json").read_text()) except ValueError: