summaryrefslogtreecommitdiffstats
path: root/tools/meson-vcs-tag.sh
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-10-25 09:53:49 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2022-10-25 13:23:57 +0200
commitaa314c87c570e2716168a850e5392ca44135fbf2 (patch)
tree6473529bed588310f215181600c8a5c2ebbe3f3b /tools/meson-vcs-tag.sh
parentbtrfs-util: move btrfs_defrag_fd() from fd-util.[ch] (diff)
downloadsystemd-aa314c87c570e2716168a850e5392ca44135fbf2.tar.xz
systemd-aa314c87c570e2716168a850e5392ca44135fbf2.zip
Report version string as in the Boot Loader Spec, fix boot loader upgrades
We generate a "version string" that is reported by various tools. This patch changes this version string to use the characters specified for the version string in the Boot Loader Specification. We start using the special characters we have in the spec for this exact purpose and thus fix version comparisons. We also stop using '+' which is not part of the allowed charset and is used for boot attempt counting and should not be part of the version string. The version string is (among other places) used in sd-boot and the comparison result is used by 'bootctl update' to decide whether to install a new binary. Before, because 'nn-rc1' compares higher than 'nn', we would refuse to upgrade pre-release versions. The boot loader is the primary motivation. I'm not aware of programatic version comparisons in other places, but it makes sense to use the same versions string everywhere. (This patch effectively only matters for non-distro builds, because distro builds presumably use -Dversion-tag to set something meaningful. Ideally, those version strings are compatible with our version strings, but this is outside of our control.)
Diffstat (limited to 'tools/meson-vcs-tag.sh')
-rwxr-xr-xtools/meson-vcs-tag.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh
index 8ce692498a..3964a8e198 100755
--- a/tools/meson-vcs-tag.sh
+++ b/tools/meson-vcs-tag.sh
@@ -14,4 +14,6 @@ cd "$dir"
# 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.
-[ -e .git ] && git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback"
+[ -e .git ] && \
+ git describe --abbrev=7 --dirty=^ 2>/dev/null | sed 's/^v//; s/-rc/~rc/' || \
+ echo "$fallback"