make_version: cut off slashes in git

If we are based on a git tag with a name (such as 'upstream/2.10.2'),
remove everything up to the slash.

While we're at it, remove a leading '1%' that gets into the version
string as part of the version tag (a Debian version with an epoch: '1:'
is converted to '1%').

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
This commit is contained in:
Tzafrir Cohen 2015-10-21 12:08:41 +03:00
parent b471526700
commit 4676ad6671
1 changed files with 2 additions and 0 deletions

View File

@ -68,6 +68,8 @@ elif [ -d ${1}/.git ]; then
# options.
VERSION=GIT-`git rev-parse --short --verify HEAD`${MODIFIED}
fi
VERSION=${VERSION##*/} # Remove leading slashes: upsteram/2.10.2
VERSION=${VERSION#[1-9]%} # Remove 1% from tag (tag from Debian epoch)
echo ${VERSION}
else
PARTS=`LANG=C git log --pretty=full | grep -F "git-svn-id:" | head -1 | awk '{print $2;}' | sed -e s:^.*/svn/$2/:: | sed -e 's:/: :g' | sed -e 's/@.*$//g'`