]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Fix various versions
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 4 Jul 2024 12:44:21 +0000 (14:44 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 4 Jul 2024 17:28:12 +0000 (19:28 +0200)
Follow up for 8b3b01c4b7e0fde39b4be354990ee68f5e612c52

We switch to PROJECT_VERSION instead of PROJECT_VERSION_FULL where
we report our version and which is likely being parsed to avoid
breaking compat. If we didn't, the output would change from systemd
255 to systemd 255.1 which could break various tools.

meson.build
src/basic/build.c
src/boot/efi/meson.build
src/kernel-install/60-ukify.install.in
src/ukify/ukify.py

index 15bb11ecd494174e0cb2fd28d2c8822a67cdc0b3..35d3de37a62a5f0d557fabc5f55080d90abaa8e1 100644 (file)
@@ -13,12 +13,19 @@ project('systemd', 'c',
         meson_version : '>= 0.60.0',
        )
 
+project_major_version = meson.project_version().split('.')[0].split('~')[0]
+if meson.project_version().contains('.')
+        project_minor_version = meson.project_version().split('.')[-1].split('~')[0]
+else
+        project_minor_version = '0'
+endif
+
 libsystemd_version = '0.39.0'
 libudev_version = '1.7.9'
 
 conf = configuration_data()
 conf.set_quoted('PROJECT_URL', 'https://systemd.io/')
-conf.set('PROJECT_VERSION', meson.project_version().split('~')[0],
+conf.set('PROJECT_VERSION', project_major_version,
          description : 'Numerical project version (used where a simple number is expected)')
 conf.set_quoted('PROJECT_VERSION_FULL', meson.project_version(), description : 'Full project version')
 
@@ -1996,7 +2003,7 @@ version_h = vcs_tag(
 
 shared_lib_tag = get_option('shared-lib-tag')
 if shared_lib_tag == ''
-        shared_lib_tag = meson.project_version().split('~')[0]
+        shared_lib_tag = project_major_version
 endif
 
 #####################################################################
@@ -2749,17 +2756,11 @@ 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(),
-                             version],
+                             project_major_version],
                      depends: exec)
         endif
 endforeach
index 3ab25f72a7c671705488797fb82b4b8987aa2e05..488ed2071382175ce3d8dbf40ffbed14982613d1 100644 (file)
@@ -287,8 +287,8 @@ int version(void) {
         if (colors_enabled())
                 b = systemd_features_with_color();
 
-        printf("%ssystemd " PROJECT_VERSION_FULL "%s (" GIT_VERSION ")\n%s\n",
-               ansi_highlight(), ansi_normal(),
+        printf("%ssystemd %i%s (" GIT_VERSION ")\n%s\n",
+               ansi_highlight(), PROJECT_VERSION, ansi_normal(),
                b ?: systemd_features);
         return 0;
 }
index e620cc1b18a2db938ed5b710da933fe7a4c6ba24..d98d2de281709d8e06d4efa3e28ee3b83669c00c 100644 (file)
@@ -63,7 +63,7 @@ foreach ctype : ['color-normal', 'color-entry', 'color-highlight', 'color-edit']
                 'EFI_' + c[1].strip().underscorify().to_upper()))
 endforeach
 
-efi_conf.set_quoted('PROJECT_VERSION', meson.project_version().split('~')[0])
+efi_conf.set_quoted('PROJECT_VERSION', project_major_version)
 efi_conf.set_quoted('VERSION_TAG', version_tag)
 efi_conf.set('PROJECT_URL', conf.get('PROJECT_URL'))
 
@@ -391,8 +391,8 @@ foreach efi_elf_binary : efi_elf_binaries
                 install_tag : 'systemd-boot',
                 command : [
                         elf2efi_py,
-                        '--version-major=' + meson.project_version().split('.')[0].split('~')[0],
-                        '--version-minor=' + meson.project_version().split('.')[-1].split('~')[0],
+                        '--version-major=' + project_major_version,
+                        '--version-minor=' + project_minor_version,
                         '--efi-major=1',
                         '--efi-minor=1',
                         '--subsystem=10',
index 54a5dafa72e63ff0833ee78e138423b7a7612c1a..076390dd0475e2bc6d75348b3869fca7d03c5fff 100755 (executable)
@@ -27,7 +27,7 @@ from shutil import which
 from pathlib import Path
 from typing import Optional
 
-__version__ = '{{PROJECT_VERSION_FULL}} ({{VERSION_TAG}})'
+__version__ = '{{PROJECT_VERSION}} ({{VERSION_TAG}})'
 
 try:
     VERBOSE = int(os.environ['KERNEL_INSTALL_VERBOSE']) > 0
index 5a36ce06eeaf9e275a0722b17a51c833ddffa972..3478ff5689886ea50b04594fcefaa6a16df0c3e9 100755 (executable)
@@ -51,7 +51,7 @@ from typing import (Any,
 
 import pefile  # type: ignore
 
-__version__ = '{{PROJECT_VERSION_FULL}} ({{VERSION_TAG}})'
+__version__ = '{{PROJECT_VERSION}} ({{VERSION_TAG}})'
 
 EFI_ARCH_MAP = {
     # host_arch glob : [efi_arch, 32_bit_efi_arch if mixed mode is supported]