diff options
-rwxr-xr-x | tools/perf/util/PERF-VERSION-GEN | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN index 1b32e8c0253f..97d76562a1a0 100755 --- a/tools/perf/util/PERF-VERSION-GEN +++ b/tools/perf/util/PERF-VERSION-GEN | |||
@@ -5,17 +5,13 @@ if [ $# -eq 1 ] ; then | |||
5 | fi | 5 | fi |
6 | 6 | ||
7 | GVF=${OUTPUT}PERF-VERSION-FILE | 7 | GVF=${OUTPUT}PERF-VERSION-FILE |
8 | DEF_VER=v0.0.2.PERF | ||
9 | 8 | ||
10 | LF=' | 9 | LF=' |
11 | ' | 10 | ' |
12 | 11 | ||
13 | # First see if there is a version file (included in release tarballs), | 12 | # First check if there is a .git to get the version from git describe |
14 | # then try git-describe, then default. | 13 | # otherwise try to get the version from the kernel makefile |
15 | if test -f version | 14 | if test -d ../../.git -o -f ../../.git && |
16 | then | ||
17 | VN=$(cat version) || VN="$DEF_VER" | ||
18 | elif test -d ../../.git -o -f ../../.git && | ||
19 | VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && | 15 | VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && |
20 | case "$VN" in | 16 | case "$VN" in |
21 | *$LF*) (exit 1) ;; | 17 | *$LF*) (exit 1) ;; |
@@ -27,7 +23,12 @@ elif test -d ../../.git -o -f ../../.git && | |||
27 | then | 23 | then |
28 | VN=$(echo "$VN" | sed -e 's/-/./g'); | 24 | VN=$(echo "$VN" | sed -e 's/-/./g'); |
29 | else | 25 | else |
30 | VN="$DEF_VER" | 26 | eval `grep '^VERSION\s*=' ../../Makefile|tr -d ' '` |
27 | eval `grep '^PATCHLEVEL\s*=' ../../Makefile|tr -d ' '` | ||
28 | eval `grep '^SUBLEVEL\s*=' ../../Makefile|tr -d ' '` | ||
29 | eval `grep '^EXTRAVERSION\s*=' ../../Makefile|tr -d ' '` | ||
30 | |||
31 | VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}" | ||
31 | fi | 32 | fi |
32 | 33 | ||
33 | VN=$(expr "$VN" : v*'\(.*\)') | 34 | VN=$(expr "$VN" : v*'\(.*\)') |