From: Daan De Meyer Date: Thu, 6 Mar 2025 21:55:32 +0000 (+0100) Subject: Don't run configure scripts if we're reusing the history X-Git-Tag: v26~325^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6a0ea5e739804b7f8c355ed972d735a3389c0fd;p=thirdparty%2Fmkosi.git Don't run configure scripts if we're reusing the history --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 66b703743..df59b1a71 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -5166,17 +5166,16 @@ def run_verb(args: Args, images: Sequence[Config], *, resources: Path) -> None: if args.force > 1 or not have_cache(initrd): remove_cache_entries(initrd) - for i, config in enumerate(images): - if args.verb != Verb.build: - check_tools(config, args.verb) - - images[i] = config = run_configure_scripts(config) + if not have_history(args): + for i, config in enumerate(images): + if args.verb != Verb.build: + check_tools(config, args.verb) - # 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[i] = config = run_configure_scripts(config) - if not have_history(args): + # 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 ( diff --git a/mkosi/resources/man/mkosi.1.md b/mkosi/resources/man/mkosi.1.md index 816c5e93e..0dee6cd9e 100644 --- a/mkosi/resources/man/mkosi.1.md +++ b/mkosi/resources/man/mkosi.1.md @@ -1552,11 +1552,14 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`, up in the generated XFS filesystem. `History=`, `--history=` -: Takes a boolean. If enabled, **mkosi** will write information about the - latest build to the `.mkosi-private` subdirectory in the directory - from which it was invoked. This information is then used to restore - the config of the latest build when running any verb that needs a - build without specifying `--force`. +: Takes a boolean. If enabled, **mkosi** will write information about + the latest build to the `.mkosi-private` subdirectory in the + directory from which it was invoked. This information is then used + to restore the config of the latest build when running any verb that + needs a build without specifying `--force`. + + Note that configure scripts will not be executed if we reuse the + history from a previous build. To give an example of why this is useful, if you run `mkosi -O my-custom-output-dir -f` followed by `mkosi vm`, **mkosi**