Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4147f0f authored by Robert Richter's avatar Robert Richter Committed by Arnaldo Carvalho de Melo
Browse files

perf tools: Fix perf version generation



The tag of the perf version is wrongly determined, always the latest tag
is taken regardless of the HEAD commit:

 $ perf --version
 perf version 3.9.rc8.gd7f5d3
 $ git describe d7f5d3
 v3.9-rc7-154-gd7f5d33
 $ head -n 4 Makefile
 VERSION = 3
 PATCHLEVEL = 9
 SUBLEVEL = 0
 EXTRAVERSION = -rc7

In other cases no tag might be found.

This patch fixes this.

This new implementation handles also the case if there are no tags at
all found in the git repo but there is a commit id.

Signed-off-by: default avatarRobert Richter <robert.richter@calxeda.com>
Link: http://lkml.kernel.org/r/1368006214-12912-1-git-send-email-rric@kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 582ec082
Loading
Loading
Loading
Loading
+15 −6
Original line number Original line Diff line number Diff line
@@ -13,13 +13,22 @@ LF='
# First check if there is a .git to get the version from git describe
# First check if there is a .git to get the version from git describe
# otherwise try to get the version from the kernel Makefile
# otherwise try to get the version from the kernel Makefile
#
#
if test -d ../../.git -o -f ../../.git &&
CID=
	VN=$(git tag 2>/dev/null | tail -1 | grep -E "v[0-9].[0-9]*")
TAG=
if test -d ../../.git -o -f ../../.git
then
then
	VN=$(echo $VN"-g"$(git log -1 --abbrev=4 --pretty=format:"%h" HEAD))
	TAG=$(git describe --abbrev=0 --match "v[0-9].[0-9]*" 2>/dev/null )
	VN=$(echo "$VN" | sed -e 's/-/./g');
	CID=$(git log -1 --abbrev=4 --pretty=format:"%h" 2>/dev/null) && CID="-g$CID"
else
fi
	VN=$(MAKEFLAGS= make -sC ../.. kernelversion)
if test -z "$TAG"
then
	TAG=$(MAKEFLAGS= make -sC ../.. kernelversion)
fi
VN="$TAG$CID"
if test -n "$CID"
then
	# format version string, strip trailing zero of sublevel:
	VN=$(echo "$VN" | sed -e 's/-/./g;s/\([0-9]*[.][0-9]*\)[.]0/\1/')
fi
fi


VN=$(expr "$VN" : v*'\(.*\)')
VN=$(expr "$VN" : v*'\(.*\)')