X-Git-Url: https://git.distorted.org.uk/~mdw/runlisp/blobdiff_plain/d9b245f4db6df803b96b8431a660ba14078ec6bd..4e2368592f2b964ccd971ebf73c7b4268df5d666:/auto-version.in diff --git a/auto-version.in b/auto-version.in index c9b1e27..5e0e59d 100755 --- a/auto-version.in +++ b/auto-version.in @@ -71,13 +71,15 @@ fi ### Main program. ## If this is a Git checkout then Git should be able to identify the version. -if [ -d .git ] && version=$(git describe --abbrev=4 2>/dev/null); then - - ## If the working tree is dirty, indicate with a `+'. - case "$(git diff-index --name-only HEAD)" in - "") ;; - *) version="$version+" ;; - esac +## If there's also a Debian version, and that ends in a `~', then prefix the +## Git version with this. Note that `pkg-config' is not very good, and, in +## particular, doesn't support the convention that `~' sorts before anything +## else, even the empty string, despite claiming to implement the RPM +## version-comparison algorithm which specifies this behaviour, so one must +## be careful when choosing `~' prefixes. +if [ -e .git ] && version=$(git describe --abbrev=4 --dirty=+ 2>/dev/null); then + debver=$(sed -n '/^.*(\(.*\)).*$/ { s::\1:p; q; }' debian/changelog) + case $debver in *~) version=$debver$version ;; esac echo "$version" exit 0 fi