mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 17:41:22 +00:00
f24fb53984
This explodes the build if HEAD is signed, since the generated version is gpg: Signature made Mon 26 Dec 2022 20:34:48 CET, then a few more lines, then the SHA. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/7c9637711271f50ec2341fb8a7c29585335dab04.1672174189.git.nabijaczleweli@nabijaczleweli.xyz Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
53 lines
1013 B
Bash
Executable File
53 lines
1013 B
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
if [ $# -eq 1 ] ; then
|
|
OUTPUT=$1
|
|
fi
|
|
|
|
GVF=${OUTPUT}PERF-VERSION-FILE
|
|
|
|
LF='
|
|
'
|
|
|
|
#
|
|
# Use version from kernel Makefile unless not in a git repository and
|
|
# PERF-VERSION-FILE exists
|
|
#
|
|
CID=
|
|
TAG=
|
|
if test -d ../../.git -o -f ../../.git
|
|
then
|
|
TAG=$(MAKEFLAGS= make -sC ../.. kernelversion)
|
|
CID=$(git log -1 --abbrev=12 --pretty=format:"%h" --no-show-signature 2>/dev/null) && CID="-g$CID"
|
|
elif test -f ../../PERF-VERSION-FILE
|
|
then
|
|
TAG=$(cut -d' ' -f3 ../../PERF-VERSION-FILE | sed -e 's/\"//g')
|
|
fi
|
|
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
|
|
|
|
VN=$(expr "$VN" : v*'\(.*\)')
|
|
|
|
if test -r $GVF
|
|
then
|
|
VC=$(sed -e 's/^#define PERF_VERSION "\(.*\)"/\1/' <$GVF)
|
|
else
|
|
VC=unset
|
|
fi
|
|
test "$VN" = "$VC" || {
|
|
echo >&2 " PERF_VERSION = $VN"
|
|
echo "#define PERF_VERSION \"$VN\"" >$GVF
|
|
}
|
|
|
|
|