autotools: fix version check

The libsynthesis_3.4.0.47+syncevolution-1-3-99-7-20140203 tag
accidentally matched the check for a non-exact-tag "git-describe"
output (-<number of changes>-g<hash>). Therefore the actual tags
weren't even checked.

Reversing the check such that we look at tags ourselves and proceed with
them if one matches avoids this problem.
This commit is contained in:
Patrick Ohly 2014-02-15 23:09:49 +01:00
parent 969c794606
commit 82bb12c5fc
1 changed files with 7 additions and 7 deletions

View File

@ -48,17 +48,17 @@ checksource ()
# already a hash, abbreviate
hash=`echo $hash | sed -e 's/\(......\).*/\1/'`
fi
# detect -<number of changes>-g<hash> suffix added when tag is older than HEAD
if perl -e "exit !('$describe' =~ m/-[0-9]+-[0-9a-g]{8}\$/);"; then
# remove suffix to get tag (doesn't matter if we do not pick
# the most recent one)
exact=
tag=`echo $describe | sed -e 's/-[0123456789]*-g.*//'`
else
if git show-ref --tags | grep -q $hash; then
# there is at least one tag matching HEAD;
# pick the most recent one (based on lexical sorting)
exact=1
tag=`git show-ref --tags | grep $hash | sort | tail -1 | sed -e 's;.*refs/tags/;;'`
else
# Detect -<number of changes>-g<hash> suffix added when tag is older than HEAD.
# Remove suffix to get tag (doesn't matter if we do not pick
# the most recent one).
exact=
tag=`echo $describe | sed -e 's/-[0123456789]*-g.*//'`
fi
simpletag=$tag
# Hyphens between numbers in the tag are dots in the version