diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-02-14 11:04:36 +0100 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-02-14 15:36:34 +0100 |
commit | ea2a57bee3506c8a724034c3ba0de2c87b47173b (patch) | |
tree | 347b206885a81679b6d0916538b7c8c0249ebca1 /tools | |
parent | docs: Use v255~rc1 instead of v255-rc1 (diff) | |
download | systemd-ea2a57bee3506c8a724034c3ba0de2c87b47173b.tar.xz systemd-ea2a57bee3506c8a724034c3ba0de2c87b47173b.zip |
meson: Start adding devel and rc suffixes to the project version
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.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/meson-vcs-tag.sh | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh index c6d140acb8..89e3cbd351 100755 --- a/tools/meson-vcs-tag.sh +++ b/tools/meson-vcs-tag.sh @@ -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. |