From c0561a05f5e3967a40e9ceb5e48b712c4574862e Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 14 Feb 2024 11:35:22 +0100 Subject: [PATCH 1/3] docs: Use v255~rc1 instead of v255-rc1 This gets the point across better that we want the rc to sort lower than the official release. --- docs/RELEASE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/RELEASE.md b/docs/RELEASE.md index 4ba29a87a94..1ed99b81121 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -15,7 +15,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later 6. [RC1] Update version and library numbers in `meson.build` 7. Check dbus docs with `ninja -C build update-dbus-docs` 8. Update translation strings (`cd build`, `meson compile systemd-pot`, `meson compile systemd-update-po`) - drop the header comments from `systemd.pot` + re-add SPDX before committing. If the only change in a file is the 'POT-Creation-Date' field, then ignore that file. -9. Tag the release: `version=vXXX~rcY && git tag -s "${version}" -m "systemd ${version}"`. Note that this uses a tilde (\~) instead of a hyphen (-) because tildes sort lower in version comparisons according to the [version format specification](https://uapi-group.org/specifications/specs/version_format_specification/), and we want `v255-rc1` to sort lower than `v255`. +9. Tag the release: `version=vXXX~rcY && git tag -s "${version}" -m "systemd ${version}"`. Note that this uses a tilde (\~) instead of a hyphen (-) because tildes sort lower in version comparisons according to the [version format specification](https://uapi-group.org/specifications/specs/version_format_specification/), and we want `v255~rc1` to sort lower than `v255`. 10. Do `ninja -C build` 11. Make sure that the version string and package string match: `build/systemctl --version` 12. [FINAL] Close the github milestone and open a new one (https://github.com/systemd/systemd/milestones) From ea2a57bee3506c8a724034c3ba0de2c87b47173b Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 14 Feb 2024 11:04:36 +0100 Subject: [PATCH 2/3] meson: Start adding devel and rc suffixes to the project version Let's make sure that versions generated by meson-vcs-tag.sh always sort higher than official and stable releases. We achieve this by immediately updating the meson version in meson.build after a new release. To make sure this version always sorts lower than future rcs, we suffix it with "~devel" which will sort lower than "~rcX". The new release workflow is to update the version in meson.build for each rc and the official release and to also update the version number after a new release to the next development version. The full version is exposed as PROJECT_VERSION_FULL and used where it makes sense over PROJECT_VERSION. We also switch to reading the version from a meson.version file in the repo instead of hardcoding it in meson.build. This makes it easier to access both inside and outside of the project. The meson-vcs-tag.sh script is rewritten to query the version from meson.version instead of passing it in via the command line. This makes it easier to use outside of systemd since users don't have to query the version themselves first. --- docs/RELEASE.md | 30 ++++++++++--------- meson.build | 16 ++++++---- meson.version | 1 + src/basic/build.c | 2 +- src/boot/efi/meson.build | 4 +-- src/busctl/busctl.c | 2 +- src/core/manager-dump.c | 2 +- .../cryptsetup-token-systemd-fido2.c | 2 +- .../cryptsetup-token-systemd-pkcs11.c | 2 +- .../cryptsetup-token-systemd-tpm2.c | 2 +- src/kernel-install/60-ukify.install.in | 2 +- src/nspawn/test-nspawn-util.c | 2 +- src/shared/varlink.c | 2 +- src/ukify/ukify.py | 2 +- tools/meson-vcs-tag.sh | 18 +++++++---- 15 files changed, 52 insertions(+), 37 deletions(-) create mode 100644 meson.version diff --git a/docs/RELEASE.md b/docs/RELEASE.md index 1ed99b81121..b712ba6b070 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -12,17 +12,19 @@ SPDX-License-Identifier: LGPL-2.1-or-later 3. Update the time and place in NEWS 4. Update hwdb (`ninja -C build update-hwdb`, `ninja -C build update-hwdb-autosuspend`, commit separately). 5. Update syscall numbers (`ninja -C build update-syscall-tables update-syscall-header`). -6. [RC1] Update version and library numbers in `meson.build` -7. Check dbus docs with `ninja -C build update-dbus-docs` -8. Update translation strings (`cd build`, `meson compile systemd-pot`, `meson compile systemd-update-po`) - drop the header comments from `systemd.pot` + re-add SPDX before committing. If the only change in a file is the 'POT-Creation-Date' field, then ignore that file. -9. Tag the release: `version=vXXX~rcY && git tag -s "${version}" -m "systemd ${version}"`. Note that this uses a tilde (\~) instead of a hyphen (-) because tildes sort lower in version comparisons according to the [version format specification](https://uapi-group.org/specifications/specs/version_format_specification/), and we want `v255~rc1` to sort lower than `v255`. -10. Do `ninja -C build` -11. Make sure that the version string and package string match: `build/systemctl --version` -12. [FINAL] Close the github milestone and open a new one (https://github.com/systemd/systemd/milestones) -13. "Draft" a new release on github (https://github.com/systemd/systemd/releases/new), mark "This is a pre-release" if appropriate. -14. Check that announcement to systemd-devel, with a copy&paste from NEWS, was sent. This should happen automatically. -15. Update IRC topic (`/msg chanserv TOPIC #systemd Version NNN released | Online resources https://systemd.io/`) -16. [FINAL] Push commits to stable, create an empty -stable branch: `git push systemd-stable --atomic origin/main:main origin/main:refs/heads/${version}-stable`. -17. [FINAL] Build and upload the documentation (on the -stable branch): `ninja -C build doc-sync` -18. [FINAL] Change the default branch to latest release (https://github.com/systemd/systemd-stable/settings/branches). -19. [FINAL] Change the Github Pages branch in the stable repository to the newly created branch (https://github.com/systemd/systemd-stable/settings/pages) and set the 'Custom domain' to 'systemd.io' +6. [RC1] Update library numbers in `meson.build` +7. Update version number in `meson.version` (e.g. from `v256~devel` to `v256~rc1` or from `v256~rc3` to `v256`) +8. Check dbus docs with `ninja -C build update-dbus-docs` +9. Update translation strings (`cd build`, `meson compile systemd-pot`, `meson compile systemd-update-po`) - drop the header comments from `systemd.pot` + re-add SPDX before committing. If the only change in a file is the 'POT-Creation-Date' field, then ignore that file. +10. Tag the release: `version=vXXX~rcY && git tag -s "${version}" -m "systemd ${version}"`. Note that this uses a tilde (\~) instead of a hyphen (-) because tildes sort lower in version comparisons according to the [version format specification](https://uapi-group.org/specifications/specs/version_format_specification/), and we want `v255~rc1` to sort lower than `v255`. +11. Do `ninja -C build` +12. Make sure that the version string and package string match: `build/systemctl --version` +13. [FINAL] Close the github milestone and open a new one (https://github.com/systemd/systemd/milestones) +14. "Draft" a new release on github (https://github.com/systemd/systemd/releases/new), mark "This is a pre-release" if appropriate. +15. Check that announcement to systemd-devel, with a copy&paste from NEWS, was sent. This should happen automatically. +16. Update IRC topic (`/msg chanserv TOPIC #systemd Version NNN released | Online resources https://systemd.io/`) +17. [FINAL] Push commits to stable, create an empty -stable branch: `git push systemd-stable --atomic origin/main:main origin/main:refs/heads/${version}-stable`. +18. [FINAL] Build and upload the documentation (on the -stable branch): `ninja -C build doc-sync` +19. [FINAL] Change the default branch to latest release (https://github.com/systemd/systemd-stable/settings/branches). +20. [FINAL] Change the Github Pages branch in the stable repository to the newly created branch (https://github.com/systemd/systemd-stable/settings/pages) and set the 'Custom domain' to 'systemd.io' +21. [FINAL] Update version number in `meson.version` to the devel version of the next release (e.g. from `v256` to `v257~devel`) diff --git a/meson.build b/meson.build index ff79efd989c..e4a9758ec58 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later project('systemd', 'c', - version : '255', + version : files('meson.version'), license : 'LGPLv2+', default_options: [ 'c_std=gnu11', @@ -18,8 +18,9 @@ libudev_version = '1.7.8' conf = configuration_data() conf.set_quoted('PROJECT_URL', 'https://systemd.io/') -conf.set('PROJECT_VERSION', meson.project_version(), +conf.set('PROJECT_VERSION', meson.project_version().split('~')[0], description : 'Numerical project version (used where a simple number is expected)') +conf.set_quoted('PROJECT_VERSION_FULL', meson.project_version(), description : 'Full project version') # This is to be used instead of meson.source_root(), as the latter will return # the wrong result when systemd is being built as a meson subproject @@ -1859,13 +1860,12 @@ version_h = vcs_tag( output : 'version.h', command: [project_source_root / 'tools/meson-vcs-tag.sh', project_source_root, - meson.project_version(), version_tag, ]) shared_lib_tag = get_option('shared-lib-tag') if shared_lib_tag == '' - shared_lib_tag = meson.project_version() + shared_lib_tag = meson.project_version().split('~')[0] endif ##################################################################### @@ -2559,11 +2559,17 @@ foreach exec : public_programs args : exec.full_path(), depends: exec) + version = meson.project_version() + if name == 'udevadm' + # For compatibility reasons we can't use the full version in udevadm. + version = version.split('~')[0] + endif + test('check-version-' + name, check_version, suite : 'dist', args : [exec.full_path(), - meson.project_version()], + version], depends: exec) endif endforeach diff --git a/meson.version b/meson.version new file mode 100644 index 00000000000..ecb02adbfed --- /dev/null +++ b/meson.version @@ -0,0 +1 @@ +256~devel diff --git a/src/basic/build.c b/src/basic/build.c index 1c52d9a935a..7d6fbf43da1 100644 --- a/src/basic/build.c +++ b/src/basic/build.c @@ -288,7 +288,7 @@ int version(void) { if (colors_enabled()) b = systemd_features_with_color(); - printf("%ssystemd " STRINGIFY(PROJECT_VERSION) "%s (" GIT_VERSION ")\n%s\n", + printf("%ssystemd " PROJECT_VERSION_FULL "%s (" GIT_VERSION ")\n%s\n", ansi_highlight(), ansi_normal(), b ?: systemd_features); return 0; diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index c95132e4207..2e22bdf57fe 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -67,7 +67,7 @@ if meson.is_cross_build() and get_option('sbat-distro') == 'auto' warning('Auto detection of SBAT information not supported when cross-building, disabling SBAT.') elif get_option('sbat-distro') != '' efi_conf.set_quoted('SBAT_PROJECT', meson.project_name()) - efi_conf.set_quoted('PROJECT_VERSION', meson.project_version()) + efi_conf.set_quoted('PROJECT_VERSION', meson.project_version().split('~')[0]) efi_conf.set('PROJECT_URL', conf.get('PROJECT_URL')) if get_option('sbat-distro-generation') < 1 error('SBAT Distro Generation must be a positive integer') @@ -385,7 +385,7 @@ foreach efi_elf_binary : efi_elf_binaries install_tag : 'systemd-boot', command : [ elf2efi_py, - '--version-major=' + meson.project_version(), + '--version-major=' + meson.project_version().split('~')[0], '--version-minor=0', '--efi-major=1', '--efi-minor=1', diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c index b2c2bc644d7..6314ff8d1d9 100644 --- a/src/busctl/busctl.c +++ b/src/busctl/busctl.c @@ -1366,7 +1366,7 @@ static int verb_monitor(int argc, char **argv, void *userdata) { static int verb_capture(int argc, char **argv, void *userdata) { _cleanup_free_ char *osname = NULL; static const char info[] = - "busctl (systemd) " STRINGIFY(PROJECT_VERSION) " (Git " GIT_VERSION ")"; + "busctl (systemd) " PROJECT_VERSION_FULL " (Git " GIT_VERSION ")"; int r; if (isatty(STDOUT_FILENO)) diff --git a/src/core/manager-dump.c b/src/core/manager-dump.c index 6c32d78f3f9..a12d50c91ec 100644 --- a/src/core/manager-dump.c +++ b/src/core/manager-dump.c @@ -64,7 +64,7 @@ static void manager_dump_header(Manager *m, FILE *f, const char *prefix) { * stable between versions. We take the liberty to restructure it entirely between versions and * add/remove fields at will. */ - fprintf(f, "%sManager: systemd " STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")\n", strempty(prefix)); + fprintf(f, "%sManager: systemd " PROJECT_VERSION_FULL " (" GIT_VERSION ")\n", strempty(prefix)); fprintf(f, "%sFeatures: %s\n", strempty(prefix), systemd_features); for (ManagerTimestamp q = 0; q < _MANAGER_TIMESTAMP_MAX; q++) { diff --git a/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-fido2.c b/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-fido2.c index 2f79d07a87f..a736f753e96 100644 --- a/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-fido2.c +++ b/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-fido2.c @@ -18,7 +18,7 @@ /* for libcryptsetup debug purpose */ _public_ const char *cryptsetup_token_version(void) { - return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")"; + return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" PROJECT_VERSION_FULL " (" GIT_VERSION ")"; } _public_ int cryptsetup_token_open_pin( diff --git a/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-pkcs11.c b/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-pkcs11.c index 98f4b08b763..5a7cbe01b16 100644 --- a/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-pkcs11.c +++ b/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-pkcs11.c @@ -18,7 +18,7 @@ /* for libcryptsetup debug purpose */ _public_ const char *cryptsetup_token_version(void) { - return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")"; + return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" PROJECT_VERSION_FULL " (" GIT_VERSION ")"; } _public_ int cryptsetup_token_open_pin( diff --git a/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-tpm2.c b/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-tpm2.c index b65229992cf..3c36f9a93f5 100644 --- a/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-tpm2.c +++ b/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-tpm2.c @@ -20,7 +20,7 @@ /* for libcryptsetup debug purpose */ _public_ const char *cryptsetup_token_version(void) { - return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")"; + return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" PROJECT_VERSION_FULL " (" GIT_VERSION ")"; } static int log_debug_open_error(struct crypt_device *cd, int r) { diff --git a/src/kernel-install/60-ukify.install.in b/src/kernel-install/60-ukify.install.in index e10dc0f8699..c7fe5108cca 100755 --- a/src/kernel-install/60-ukify.install.in +++ b/src/kernel-install/60-ukify.install.in @@ -27,7 +27,7 @@ from shutil import which from pathlib import Path from typing import Optional -__version__ = '{{PROJECT_VERSION}} ({{GIT_VERSION}})' +__version__ = '{{PROJECT_VERSION_FULL}} ({{GIT_VERSION}})' try: VERBOSE = int(os.environ['KERNEL_INSTALL_VERBOSE']) > 0 diff --git a/src/nspawn/test-nspawn-util.c b/src/nspawn/test-nspawn-util.c index 08c8050dc59..533edde5aaa 100644 --- a/src/nspawn/test-nspawn-util.c +++ b/src/nspawn/test-nspawn-util.c @@ -8,7 +8,7 @@ TEST(systemd_installation_has_version) { int r; - FOREACH_STRING(version, "0", "231", STRINGIFY(PROJECT_VERSION), "999") { + FOREACH_STRING(version, "0", "231", PROJECT_VERSION_FULL, "999") { r = systemd_installation_has_version(saved_argv[1], version); assert_se(r >= 0); log_info("%s has systemd >= %s: %s", diff --git a/src/shared/varlink.c b/src/shared/varlink.c index fa51b84cd4a..59917667952 100644 --- a/src/shared/varlink.c +++ b/src/shared/varlink.c @@ -1310,7 +1310,7 @@ static int generic_method_get_info( return varlink_replyb(link, JSON_BUILD_OBJECT( JSON_BUILD_PAIR_STRING("vendor", "The systemd Project"), JSON_BUILD_PAIR_STRING("product", product), - JSON_BUILD_PAIR_STRING("version", STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")"), + JSON_BUILD_PAIR_STRING("version", PROJECT_VERSION_FULL " (" GIT_VERSION ")"), JSON_BUILD_PAIR_STRING("url", "https://systemd.io/"), JSON_BUILD_PAIR_STRV("interfaces", interfaces))); } diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index efa780992fb..e5724c8ac20 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -50,7 +50,7 @@ from typing import (Any, import pefile # type: ignore -__version__ = '{{PROJECT_VERSION}} ({{GIT_VERSION}})' +__version__ = '{{PROJECT_VERSION_FULL}} ({{GIT_VERSION}})' EFI_ARCH_MAP = { # host_arch glob : [efi_arch, 32_bit_efi_arch if mixed mode is supported] diff --git a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh index c6d140acb84..89e3cbd3517 100755 --- a/tools/meson-vcs-tag.sh +++ b/tools/meson-vcs-tag.sh @@ -4,14 +4,15 @@ set -u set -o pipefail -dir="${1:?}" -fallback="${2:?}" -version_tag="${3:-}" +dir="${1:-.}" +version_tag="${2:-}" if [ -n "${version_tag}" ]; then # If -Dversion_tag= was used, just use that without further changes. echo "${version_tag}" else + read -r project_version <"${dir}/meson.version" + # Check that we have either .git/ (a normal clone) or a .git file (a work-tree) # and that we don't get confused if a tarball is extracted in a higher-level # git repository. @@ -22,13 +23,18 @@ else c='' if [ -e "${dir}/.git" ]; then c="$(git -C "$dir" describe --abbrev=7 --dirty=^ 2>/dev/null)" - if [ -z "$c" ]; then + if [ -n "$c" ]; then + # git describe uses the most recent tag. However, for development versions (e.g. v256~devel), the + # most recent tag will be v255 as there is no tag for development versions. To deal with this, we + # replace the tag with the project version instead. + c="${project_version}-${c#*-}" + else # This call might still fail with permission issues suffix="$(git -C "$dir" describe --always --abbrev=7 --dirty=^ 2>/dev/null)" - [ -n "$suffix" ] && c="${fallback}-${suffix}" + [ -n "$suffix" ] && c="${project_version}-${suffix}" fi fi - [ -z "$c" ] && c="${fallback}" + [ -z "$c" ] && c="${project_version}" # Replace any hyphens with carets which are allowed in versions by pacman whereas hyphens are not. Git # versions with carets will also sort higher than their non-git version counterpart both in pacman # versioning and in version comparison spec versioning. From dbb9a6ad6952685c58352e9344976a7d4d21a2e5 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 14 Feb 2024 19:56:30 +0100 Subject: [PATCH 3/3] meson-vcs-tag: Say version format specification That's the official name so let's use it. --- tools/meson-vcs-tag.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh index 89e3cbd3517..16cf11007d7 100755 --- a/tools/meson-vcs-tag.sh +++ b/tools/meson-vcs-tag.sh @@ -37,6 +37,6 @@ else [ -z "$c" ] && c="${project_version}" # Replace any hyphens with carets which are allowed in versions by pacman whereas hyphens are not. Git # versions with carets will also sort higher than their non-git version counterpart both in pacman - # versioning and in version comparison spec versioning. + # versioning and in version format specification versioning. echo "$c" | sed 's/^v//; s/-/^/g' fi