mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 13:22:23 +00:00
688b2c2f17
If git is installed we'll have a 'perf --version' output of this form: $ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install $ perf --version perf version 3.7.rc3.g3afad6 Now on a machine without git installed: $ mv /home/acme/bin/git /home/acme/bin/git.OFF $ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install $ perf --version perf version 3.7.0-rc2 That is, no error message due to git not being installed will appear on the screen and instead the version string in the top level Makefile will be used. Requested-by: Ingo Molnar <mingo@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-am6yp6phvxyjmyndxogpunjv@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
39 lines
703 B
Bash
Executable File
39 lines
703 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [ $# -eq 1 ] ; then
|
|
OUTPUT=$1
|
|
fi
|
|
|
|
GVF=${OUTPUT}PERF-VERSION-FILE
|
|
|
|
LF='
|
|
'
|
|
|
|
#
|
|
# 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 tag 2>/dev/null | tail -1 | grep -E "v[0-9].[0-9]*")
|
|
then
|
|
VN=$(echo $VN"-g"$(git log -1 --abbrev=4 --pretty=format:"%h" HEAD))
|
|
VN=$(echo "$VN" | sed -e 's/-/./g');
|
|
else
|
|
VN=$(MAKEFLAGS= make -sC ../.. kernelversion)
|
|
fi
|
|
|
|
VN=$(expr "$VN" : v*'\(.*\)')
|
|
|
|
if test -r $GVF
|
|
then
|
|
VC=$(sed -e 's/^PERF_VERSION = //' <$GVF)
|
|
else
|
|
VC=unset
|
|
fi
|
|
test "$VN" = "$VC" || {
|
|
echo >&2 "PERF_VERSION = $VN"
|
|
echo "PERF_VERSION = $VN" >$GVF
|
|
}
|
|
|
|
|