diff options
author | John Garry <john.garry@huawei.com> | 2022-02-21 16:16:49 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-03-22 23:12:40 +0300 |
commit | 7572733b84997d23077ebd852703055034b7a1d2 (patch) | |
tree | 559af44615a68fb1537701ef8f4e48f565f9ea8f /tools/perf/util | |
parent | 4e666cdb06eede2069a7b1a96a1359d1c441a3eb (diff) | |
download | linux-7572733b84997d23077ebd852703055034b7a1d2.tar.xz |
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 a4147f0f91386540 ("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>
Diffstat (limited to 'tools/perf/util')
-rwxr-xr-x | tools/perf/util/PERF-VERSION-GEN | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN index 59241ff342be..0ee5af529238 100755 --- a/tools/perf/util/PERF-VERSION-GEN +++ b/tools/perf/util/PERF-VERSION-GEN @@ -11,23 +11,18 @@ 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 +# Always try first to get the version from the kernel Makefile # CID= TAG= if test -d ../../.git -o -f ../../.git then - TAG=$(git describe --abbrev=0 --match "v[0-9].[0-9]*" 2>/dev/null ) + TAG=$(MAKEFLAGS= make -sC ../.. kernelversion) CID=$(git log -1 --abbrev=12 --pretty=format:"%h" 2>/dev/null) && CID="-g$CID" -elif test -f ../../PERF-VERSION-FILE -then +else 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 |