]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Start adding devel and rc suffixes to the project version
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 14 Feb 2024 10:04:36 +0000 (11:04 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 14 Feb 2024 14:36:34 +0000 (15:36 +0100)
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.

15 files changed:
docs/RELEASE.md
meson.build
meson.version [new file with mode: 0644]
src/basic/build.c
src/boot/efi/meson.build
src/busctl/busctl.c
src/core/manager-dump.c
src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-fido2.c
src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-pkcs11.c
src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-tpm2.c
src/kernel-install/60-ukify.install.in
src/nspawn/test-nspawn-util.c
src/shared/varlink.c
src/ukify/ukify.py
tools/meson-vcs-tag.sh

index 1ed99b811216431c6f9fc91ec93484c893e79e79..b712ba6b0700ad23a98ee446f47a8c59eed33744 100644 (file)
@@ -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`)
index ff79efd989cb07f633c02c912928e055877818b2..e4a9758ec58af8f59eaba2cfe82d997e15e41c18 100644 (file)
@@ -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 (file)
index 0000000..ecb02ad
--- /dev/null
@@ -0,0 +1 @@
+256~devel
index 1c52d9a935a6b6e4c9588795d5ac5b1608327924..7d6fbf43da18544ed1a9fec8bddedc206f28c815 100644 (file)
@@ -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;
index c95132e4207cdf78843c9c762a2055ca6971ed2d..2e22bdf57fe3068fe824e95792e1ce1c18b8965e 100644 (file)
@@ -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',
index b2c2bc644d7638869531c8bedfcf9dbfd1a04e91..6314ff8d1d9513a4d186770a227604cb8eed2742 100644 (file)
@@ -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))
index 6c32d78f3f9c560bb30c65e8b074e6aa7a5262ae..a12d50c91ec6a14ea4a4f39e089bd0c0452301c4 100644 (file)
@@ -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++) {
index 2f79d07a87ff74ff7e9bbb78102f00c198d04a7b..a736f753e96894f58a80fc5c194de5e5acde9d38 100644 (file)
@@ -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(
index 98f4b08b76302bfff5fbf6a3a9f4f6022fb4625e..5a7cbe01b1697e056cff428fc9c7ec85bdbed45e 100644 (file)
@@ -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(
index b65229992cfc43474dbcf8e493ae31f9bf804faf..3c36f9a93f5a0e0cd5f8b0fc276589a716e19a2f 100644 (file)
@@ -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) {
index e10dc0f8699822af299b6dd3fe3908a3bbe7c1fd..c7fe5108ccaec48478fda48dbd07faa79028dc0b 100755 (executable)
@@ -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
index 08c8050dc5940523912c719629ce1c566684ac1e..533edde5aaa0bd21d233f8eab455d44a8b3ee478 100644 (file)
@@ -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",
index fa51b84cd4a283cd001a3eb523968f71ce0373ac..59917667952a45c9fb75db471e4acdebe1cf3371 100644 (file)
@@ -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)));
 }
index efa780992fb94f5acd6b2b019e2619d81e5a924c..e5724c8ac20d084d009cd2e09464c41c9362c79c 100755 (executable)
@@ -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]
index c6d140acb84245c659a82fa76c61e069e40ed8dd..89e3cbd3517cd1a0562af267d13e962680dccfe4 100755 (executable)
@@ -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.