mirror of
https://github.com/systemd/systemd.git
synced 2025-01-21 22:04:01 +03:00
meson: Bring back use of vcs_tag
The use of vcs_tag was dropped in #28567, which results in builds having stale version information once new commit are made. This also fixes a case where CI builds would have no version information because they are checked out without any tags for git-describe to use. Additionally, use `--git-dir` now, as that particular issues seems to have been fixed by now.
This commit is contained in:
parent
82007efa44
commit
c78b611e48
44
meson.build
44
meson.build
@ -1808,29 +1808,31 @@ xml_helper_py = find_program('tools/xml_helper.py')
|
||||
############################################################
|
||||
|
||||
version_tag = get_option('version-tag')
|
||||
if version_tag == ''
|
||||
# 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.
|
||||
if git.found() and fs.exists(project_source_root / '.git')
|
||||
# Apparently git describe has a bug where it always considers the work-tree dirty when
|
||||
# invoked with --git-dir (even though 'git status' is happy). Work around this issue by
|
||||
# cd-ing to the source directory.
|
||||
version_tag = run_command(
|
||||
sh, '-c',
|
||||
'cd "$MESON_SOURCE_ROOT"; git describe --abbrev=7 --dirty=^ 2>/dev/null | sed "s/^v//; s/-rc/~rc/"',
|
||||
check : true,
|
||||
).stdout().strip()
|
||||
else
|
||||
version_tag = meson.project_version()
|
||||
endif
|
||||
# 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.
|
||||
if version_tag == '' and git.found() and fs.exists(project_source_root / '.git')
|
||||
version_h = vcs_tag(
|
||||
input : 'src/version/version.h.in',
|
||||
output : 'version.h',
|
||||
# If the working tree has no tags (CI builds), the first git-describe will fail
|
||||
# and we fall back to project_version-commitid instead.
|
||||
# TODO: Use 'sh' variable with meson >= 0.63.0
|
||||
command: ['sh',
|
||||
'-euc',
|
||||
'''git -C "$1" describe --abbrev=7 --dirty=^ 2>/dev/null ||
|
||||
echo "$2-$(git -C "$1" describe --always --abbrev=7)" |
|
||||
sed 's/^v//; s/-rc/~rc/' ''',
|
||||
'_',
|
||||
project_source_root,
|
||||
meson.project_version()])
|
||||
else
|
||||
vcs_data = configuration_data()
|
||||
vcs_data.set('VCS_TAG', version_tag == '' ? meson.project_version() : version_tag)
|
||||
version_h = configure_file(configuration : vcs_data,
|
||||
input : 'src/version/version.h.in',
|
||||
output : 'version.h')
|
||||
endif
|
||||
|
||||
vcs_data = configuration_data()
|
||||
vcs_data.set('VCS_TAG', version_tag)
|
||||
version_h = configure_file(configuration : vcs_data,
|
||||
input : 'src/version/version.h.in',
|
||||
output : 'version.h')
|
||||
|
||||
versiondep = declare_dependency(
|
||||
sources : version_h,
|
||||
include_directories : include_directories('.'),
|
||||
|
@ -92,9 +92,11 @@ elif get_option('sbat-distro') != ''
|
||||
|
||||
pkgver = get_option('sbat-distro-version')
|
||||
if pkgver == ''
|
||||
pkgver = version_tag
|
||||
# This is determined during build, not configuration, so we can't display it yet.
|
||||
efi_conf.set('SBAT_DISTRO_VERSION', 'GIT_VERSION')
|
||||
else
|
||||
efi_conf.set_quoted('SBAT_DISTRO_VERSION', pkgver)
|
||||
endif
|
||||
efi_conf.set_quoted('SBAT_DISTRO_VERSION', pkgver)
|
||||
endif
|
||||
|
||||
summary({'UEFI architectures' : efi_arch + (efi_arch_alt == '' ? '' : ', ' + efi_arch_alt)},
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#ifdef SBAT_DISTRO
|
||||
# include "version.h"
|
||||
# define SBAT_SECTION_TEXT \
|
||||
"sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md\n" \
|
||||
SBAT_PROJECT ",1,The systemd Developers," SBAT_PROJECT "," PROJECT_VERSION "," PROJECT_URL "\n" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user