Skip to content

Commit 7572733

Browse files
John Garryacmel
authored andcommitted
perf tools: Fix version kernel tag
Generating the version kernel tag relies on "git describe" command to get the latest Linus kernel tag. However, when working from clones of Linus' git we may not have the latest tag. For example, when working on Arnaldo's acme.git, we can have this: $ git branch perf/core $ head -n 5 ../../Makefile | tail -n 4 VERSION = 5 PATCHLEVEL = 17 SUBLEVEL = 0 EXTRAVERSION = -rc3 $ git describe --abbrev=0 --match "v[0-9].[0-9]*" v4.13-rc5 Indeed using tags is a problem as it relies on tags being pulled from Linus' git (and pushed to the clone). In commit a4147f0 ("perf tools: Fix perf version generation") Robert introduced a change to use the kernelversion rule to generate the kernel tag when no git tags are available. However, as mentioned above, the tag we generate may be incorrect, so just always use kernelversion to get the tag (apart from building perf out of tree). Signed-off-by: John Garry <john.garry@huawei.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Acked-by: Ian Rogers <irogers@google.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Robert Richter <rric@kernel.org> Link: https://lore.kernel.org/r/1645449409-158238-3-git-send-email-john.garry@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 4e666cd commit 7572733

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

tools/perf/util/PERF-VERSION-GEN

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,18 @@ LF='
1111
'
1212

1313
#
14-
# First check if there is a .git to get the version from git describe
15-
# otherwise try to get the version from the kernel Makefile
14+
# Always try first to get the version from the kernel Makefile
1615
#
1716
CID=
1817
TAG=
1918
if test -d ../../.git -o -f ../../.git
2019
then
21-
TAG=$(git describe --abbrev=0 --match "v[0-9].[0-9]*" 2>/dev/null )
20+
TAG=$(MAKEFLAGS= make -sC ../.. kernelversion)
2221
CID=$(git log -1 --abbrev=12 --pretty=format:"%h" 2>/dev/null) && CID="-g$CID"
23-
elif test -f ../../PERF-VERSION-FILE
24-
then
22+
else
2523
TAG=$(cut -d' ' -f3 ../../PERF-VERSION-FILE | sed -e 's/\"//g')
2624
fi
27-
if test -z "$TAG"
28-
then
29-
TAG=$(MAKEFLAGS= make -sC ../.. kernelversion)
30-
fi
25+
3126
VN="$TAG$CID"
3227
if test -n "$CID"
3328
then

0 commit comments

Comments
 (0)