aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@calxeda.com>2013-05-08 05:43:34 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-07-08 17:09:52 -0400
commita4147f0f91386540316e468f3a3674a498dada5f (patch)
treeba9ee1366e013a0589c58c275e0fe54d3b19c8df /tools
parent582ec0829b3dd74d8c0f58403a3f9df8cbaa9c7d (diff)
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: Robert Richter <robert.richter@calxeda.com> Link: http://lkml.kernel.org/r/1368006214-12912-1-git-send-email-rric@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/perf/util/PERF-VERSION-GEN21
1 files changed, 15 insertions, 6 deletions
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index 055fef34b6f6..15a77b7c0e36 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -13,13 +13,22 @@ LF='
13# First check if there is a .git to get the version from git describe 13# First check if there is a .git to get the version from git describe
14# otherwise try to get the version from the kernel Makefile 14# otherwise try to get the version from the kernel Makefile
15# 15#
16if test -d ../../.git -o -f ../../.git && 16CID=
17 VN=$(git tag 2>/dev/null | tail -1 | grep -E "v[0-9].[0-9]*") 17TAG=
18if test -d ../../.git -o -f ../../.git
18then 19then
19 VN=$(echo $VN"-g"$(git log -1 --abbrev=4 --pretty=format:"%h" HEAD)) 20 TAG=$(git describe --abbrev=0 --match "v[0-9].[0-9]*" 2>/dev/null )
20 VN=$(echo "$VN" | sed -e 's/-/./g'); 21 CID=$(git log -1 --abbrev=4 --pretty=format:"%h" 2>/dev/null) && CID="-g$CID"
21else 22fi
22 VN=$(MAKEFLAGS= make -sC ../.. kernelversion) 23if test -z "$TAG"
24then
25 TAG=$(MAKEFLAGS= make -sC ../.. kernelversion)
26fi
27VN="$TAG$CID"
28if test -n "$CID"
29then
30 # format version string, strip trailing zero of sublevel:
31 VN=$(echo "$VN" | sed -e 's/-/./g;s/\([0-9]*[.][0-9]*\)[.]0/\1/')
23fi 32fi
24 33
25VN=$(expr "$VN" : v*'\(.*\)') 34VN=$(expr "$VN" : v*'\(.*\)')