Skip to contentSkip to conversation

perf: Version String fix, for fallback if not from git

PATCH In review Thavidu Ranatunga 2 participants 4 messages Jul 5, 2010 – Jul 8, 2010 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 perf: Version String fix, for fallback if not from git

This gets rid of the default version fallback for Perf and changes it so that it returns the version of the kernel from it's Makefile (if sources were not from git, ie. if it was downloaded from a tarball)

---
 tools/perf/util/PERF-VERSION-GEN |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
tools/perf/util/PERF-VERSION-GEN +9 -8
index 1b32e8c..97d7656 100755
@@ -5,17 +5,13 @@ if [ $# -eq 1 ]  ; then
 fi
 
 GVF=${OUTPUT}PERF-VERSION-FILE
-DEF_VER=v0.0.2.PERF
 
 LF='
 '
 
-# First see if there is a version file (included in release tarballs),
-# then try git-describe, then default.
-if test -f version
-then
-	VN=$(cat version) || VN="$DEF_VER"
-elif test -d ../../.git -o -f ../../.git &&
+# First check if there is a .git to get the version from git describe
+# otherwise try to get the version from the kernel makefile
+if test -d ../../.git -o -f ../../.git &&
 	VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
 	case "$VN" in
 	*$LF*) (exit 1) ;;
@@ -27,7 +23,12 @@ elif test -d ../../.git -o -f ../../.git &&
 then
 	VN=$(echo "$VN" | sed -e 's/-/./g');
 else
-	VN="$DEF_VER"
+	eval `grep '^VERSION\s*=' ../../Makefile|tr -d ' '`
+	eval `grep '^PATCHLEVEL\s*=' ../../Makefile|tr -d ' '`
+	eval `grep '^SUBLEVEL\s*=' ../../Makefile|tr -d ' '`
+	eval `grep '^EXTRAVERSION\s*=' ../../Makefile|tr -d ' '`
+
+	VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}"
 fi
 
 VN=$(expr "$VN" : v*'\(.*\)')
Signature · 1 line
1.6.3.3
#1 lore raw
Commit-ID:  869599ceda4a035cdb3345c563b74cdeef10f790
Gitweb:     http://git.kernel.org/tip/869599ceda4a035cdb3345c563b74cdeef10f790
Author:     Thavidu Ranatunga <[email protected]>
AuthorDate: Mon, 5 Jul 2010 18:00:15 +1000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 5 Jul 2010 10:42:58 +0200

perf: Version String fix, for fallback if not from git

This gets rid of the default version fallback for Perf and changes it so that it returns the version of the kernel from it's Makefile (if sources were not from git, ie. if it was downloaded from a tarball)

LKML-Reference: <[email protected]>

---
 tools/perf/util/PERF-VERSION-GEN |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
tools/perf/util/PERF-VERSION-GEN +9 -8
index 1b32e8c..97d7656 100755
@@ -5,17 +5,13 @@ if [ $# -eq 1 ]  ; then
 fi
 
 GVF=${OUTPUT}PERF-VERSION-FILE
-DEF_VER=v0.0.2.PERF
 
 LF='
 '
 
-# First see if there is a version file (included in release tarballs),
-# then try git-describe, then default.
-if test -f version
-then
-	VN=$(cat version) || VN="$DEF_VER"
-elif test -d ../../.git -o -f ../../.git &&
+# First check if there is a .git to get the version from git describe
+# otherwise try to get the version from the kernel makefile
+if test -d ../../.git -o -f ../../.git &&
 	VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
 	case "$VN" in
 	*$LF*) (exit 1) ;;
@@ -27,7 +23,12 @@ elif test -d ../../.git -o -f ../../.git &&
 then
 	VN=$(echo "$VN" | sed -e 's/-/./g');
 else
-	VN="$DEF_VER"
+	eval `grep '^VERSION\s*=' ../../Makefile|tr -d ' '`
+	eval `grep '^PATCHLEVEL\s*=' ../../Makefile|tr -d ' '`
+	eval `grep '^SUBLEVEL\s*=' ../../Makefile|tr -d ' '`
+	eval `grep '^EXTRAVERSION\s*=' ../../Makefile|tr -d ' '`
+
+	VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}"
 fi
 
 VN=$(expr "$VN" : v*'\(.*\)')
#2 lore raw
In reply to Thavidu Ranatunga

Em Mon, Jul 05, 2010 at 06:00:15PM +1000, Thavidu Ranatunga escreveu:

Quoted 11 lines

This gets rid of the default version fallback for Perf and changes it so that it returns the version of the kernel from it's Makefile (if sources were not from git, ie. if it was downloaded from a tarball)

tools/perf/util/PERF-VERSION-GEN +0 -0
 	VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
 	case "$VN" in
 	*$LF*) (exit 1) ;;

tools/perf/util/PERF-VERSION-GEN elif test -d ../../.git -o -f ../../.git && · line 31

Quoted 10 lines
tools/perf/util/PERF-VERSION-GEN +6 -1
@@ -27,7 +23,12 @@ elif test -d ../../.git -o -f ../../.git &&
 then
 	VN=$(echo "$VN" | sed -e 's/-/./g');
 else
-	VN="$DEF_VER"
+	eval `grep '^VERSION\s*=' ../../Makefile|tr -d ' '`
+	eval `grep '^PATCHLEVEL\s*=' ../../Makefile|tr -d ' '`
+	eval `grep '^SUBLEVEL\s*=' ../../Makefile|tr -d ' '`
+	eval `grep '^EXTRAVERSION\s*=' ../../Makefile|tr -d ' '`
+
+	VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}"

This makes 'make perf-tarbz2-src-pkg':

[acme@emilia linux-2.6-tip]$ make perf-tarbz2-src-pkg
TAR
[acme@emilia linux-2.6-tip]$ mv perf-2.6.35-rc4.tar.bz2 /tmp [acme@emilia linux-2.6-tip]$ cd /tmp
[acme@emilia tmp]$ tar xf perf-2.6.35-rc4.tar.bz2 [acme@emilia tmp]$ cd perf-2.6.35-rc4/tools/perf [acme@emilia perf]$ make
grep: ../../Makefile: No such file or directory
grep: ../../Makefile: No such file or directory

- Arnaldo

#3 lore raw

Em Thu, Jul 08, 2010 at 05:57:54PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 17 lines

Em Mon, Jul 05, 2010 at 06:00:15PM +1000, Thavidu Ranatunga escreveu:

tools/perf/util/PERF-VERSION-GEN elif test -d ../../.git -o -f ../../.git && · line 31

Quoted 13 lines

This gets rid of the default version fallback for Perf and changes it so that it returns the version of the kernel from it's Makefile (if sources were not from git, ie. if it was downloaded from a tarball)

tools/perf/util/PERF-VERSION-GEN +6 -1
-	VN="$DEF_VER"
+	eval `grep '^VERSION\s*=' ../../Makefile|tr -d ' '`
+	eval `grep '^PATCHLEVEL\s*=' ../../Makefile|tr -d ' '`
+	eval `grep '^SUBLEVEL\s*=' ../../Makefile|tr -d ' '`
+	eval `grep '^EXTRAVERSION\s*=' ../../Makefile|tr -d ' '`
+
+	VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}"

This makes 'make perf-tarbz2-src-pkg':

Quoted 9 lines

[acme@emilia linux-2.6-tip]$ make perf-tarbz2-src-pkg
TAR
[acme@emilia linux-2.6-tip]$ mv perf-2.6.35-rc4.tar.bz2 /tmp [acme@emilia linux-2.6-tip]$ cd /tmp
[acme@emilia tmp]$ tar xf perf-2.6.35-rc4.tar.bz2 [acme@emilia tmp]$ cd perf-2.6.35-rc4/tools/perf [acme@emilia perf]$ make
grep: ../../Makefile: No such file or directory
grep: ../../Makefile: No such file or directory

But at least the 'make perf-tar*' targets aren't in perf/urgent, so I'll work on a fix for perf/core (aka 2.6.36).

- Arnaldo