X-Git-Url: https://git.distorted.org.uk/~mdw/runlisp/blobdiff_plain/e34ec1c255cf9c31b322bafc4b396d067c4b558a..8a060232a9ca770d898eb0dc9cf4b4e174bf3f8a:/auto-version.in diff --git a/auto-version.in b/auto-version.in index d229a29..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 [ -e .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