From: Zbigniew Jędrzejewski-Szmek Date: Wed, 26 Oct 2022 21:16:56 +0000 (+0200) Subject: Revert "mkosi: Always use the embedded default version when no release is specified" X-Git-Tag: v14~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c129392cd926bbcd79ff7f45c9d91b61bb4c9f7;p=thirdparty%2Fmkosi.git Revert "mkosi: Always use the embedded default version when no release is specified" This reverts commit 093d48a97b8211ff549f78f2b3b2ef77fcd45573. I used mkosi without any explicit distro/version parameters and was surprised that it built for Fedora 36 after successfully detecting that it's running on Fedora 37. Using the host version is more likely to be what users expect, and also avoids the awkward issue that when we hardcode some default version, this version is likely to be "wrong" (not the latest) until both the distro and we make a release. Looking at this more generally, if we have some constant config that doesn't specify the distro version, we have three possible source of the version default: host distro version, latest version that was known was mkosi was released, and actual latest released distro version. It is nice to use the first option, because that is what users generally expect, and also this makes mkosi "stable", i.e. we may upgrade it at any time and users will not observe unexpected changes in defaults. This makes mkosi closer to guidelines for upgrades in stable distros, see https://docs.fedoraproject.org/en-US/fesco/Updates_Policy/#stable-releases. 093d48a97b8211ff549f78f2b3b2ef77fcd45573 was aiming for "consistent results", but this gives consistency with the wrong thing. For a normal user, the host distro version would never change "unexpectedly", and in fact it is expected that the defaults of programs change when the host distro is upgraded and not at any other time. Mkosi itself should provide stable and backwards-compatible behaviour over releases. --- diff --git a/NEWS.md b/NEWS.md index bee99a512..92ac3fa3f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -44,6 +44,8 @@ - Split dm-verity artifacts default names have been changed to match what `systemd` and other tools expect: `image.root.raw`, `image.root.verity`, `image.root.roothash`, `image.root.roothash.p7s` (same for `usr` variants). +- `mkosi` will again default to the same OS release as the host system when the + host system uses the same distribution as the image that's being built. ## v13 diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 8475af901..7e63e4056 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -5878,6 +5878,9 @@ def load_distribution(args: argparse.Namespace) -> argparse.Namespace: if args.distribution is None: args.distribution = d + if args.distribution == d and args.release is None: + args.release = r + if args.distribution is None: die("Couldn't detect distribution.")