From 6a4fcf8cefceba151e11f85e784c8962b6fc383b Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 4 Jul 2024 14:44:21 +0200 Subject: [PATCH] meson: Fix various versions 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 | 19 ++++++++++--------- src/basic/build.c | 4 ++-- src/boot/efi/meson.build | 6 +++--- src/kernel-install/60-ukify.install.in | 2 +- src/ukify/ukify.py | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/meson.build b/meson.build index 15bb11ecd49..35d3de37a62 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/src/basic/build.c b/src/basic/build.c index 3ab25f72a7c..488ed207138 100644 --- a/src/basic/build.c +++ b/src/basic/build.c @@ -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; } diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index e620cc1b18a..d98d2de2817 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -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', diff --git a/src/kernel-install/60-ukify.install.in b/src/kernel-install/60-ukify.install.in index 54a5dafa72e..076390dd047 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_FULL}} ({{VERSION_TAG}})' +__version__ = '{{PROJECT_VERSION}} ({{VERSION_TAG}})' try: VERBOSE = int(os.environ['KERNEL_INSTALL_VERBOSE']) > 0 diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index 5a36ce06eea..3478ff56898 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -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]