From: John Garry <john.garry@huawei.com>
To: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
<mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>,
<jolsa@redhat.com>, <namhyung@kernel.org>
Cc: <linux-perf-users@vger.kernel.org>, <irogers@google.com>,
<olsajiri@gmail.com>, <rric@kernel.org>, <ak@linux.intel.com>,
John Garry <john.garry@huawei.com>
Subject: [PATCH v2 2/2] perf: Fix version kernel tag
Date: Mon, 21 Feb 2022 21:16:49 +0800 [thread overview]
Message-ID: <1645449409-158238-3-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1645449409-158238-1-git-send-email-john.garry@huawei.com>
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
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 a4147f0f9138 ("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>
---
tools/perf/util/PERF-VERSION-GEN | 13 ++++---------
1 file 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
--
2.26.2
next prev parent reply other threads:[~2022-02-21 13:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 13:16 [PATCH v2 0/2] perf tool versioning fixes John Garry
2022-02-21 13:16 ` [PATCH v2 1/2] perf: Fix dependency for version file creation John Garry
2022-02-21 13:16 ` John Garry [this message]
[not found] ` <CAP-5=fXT3VYB2uBXmihuruq==FENLFcFSHMLY0Fk29pRvU-wag@mail.gmail.com>
2022-03-11 8:27 ` [PATCH v2 2/2] perf: Fix version kernel tag John Garry
2022-03-14 22:12 ` Ian Rogers
2022-03-15 11:31 ` John Garry
2022-02-25 19:37 ` [PATCH v2 0/2] perf tool versioning fixes John Garry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1645449409-158238-3-git-send-email-john.garry@huawei.com \
--to=john.garry@huawei.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=olsajiri@gmail.com \
--cc=peterz@infradead.org \
--cc=rric@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).