diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-02-16 16:58:58 +0100 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-02-21 14:01:25 +0100 |
commit | 3f6ce3d4f04de0f765bb3bde0e400d0823829486 (patch) | |
tree | dffc973b75f87412a4298f251abeaa8a6fd92fc1 /tools | |
parent | Set SYSTEMD_LOG_LEVEL=info explicitly in test-sysusers (diff) | |
download | systemd-3f6ce3d4f04de0f765bb3bde0e400d0823829486.tar.xz systemd-3f6ce3d4f04de0f765bb3bde0e400d0823829486.zip |
meson: Decouple the version tag from the vcs tag
Let's split off a new vcs-tag option from version-tag that configures whether
the current commit should be appended to the version tag. Doing this saves
us from having to fiddle around with generating git versions in packaging
specs and instead let's meson do it for us, even if we pass in a custom
version tag.
With this approach there's no more need for tools/meson-vcs-tag.sh so
we remove it.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/meson-vcs-tag.sh | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh deleted file mode 100755 index 16cf11007d..0000000000 --- a/tools/meson-vcs-tag.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: LGPL-2.1-or-later - -set -u -set -o pipefail - -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. - # - # If the working tree has no tags (CI builds), the first git-describe will fail - # and we fall back to project_version-commitid instead. - - c='' - if [ -e "${dir}/.git" ]; then - c="$(git -C "$dir" describe --abbrev=7 --dirty=^ 2>/dev/null)" - 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="${project_version}-${suffix}" - fi - fi - [ -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 format specification versioning. - echo "$c" | sed 's/^v//; s/-/^/g' -fi |