All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: John Garry <john.garry@huawei.com>
Cc: Will Chandler <wfc@wfchandler.org>,
	peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	namhyung@kernel.org, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] perf tools: Fix empty version number when building outside of a git repo
Date: Fri, 30 Sep 2022 13:43:41 -0300	[thread overview]
Message-ID: <Yzccvf367WOK44U6@kernel.org> (raw)
In-Reply-To: <30a2631b-341c-8c41-52dd-becb40bfc4be@huawei.com>

Em Fri, Sep 30, 2022 at 05:14:43PM +0100, John Garry escreveu:
> On 30/09/2022 16:11, Will Chandler wrote:
> > When perf is built in a full source tree that is not a git repository,
> > e.g. from a kernel source tarball, `perf version` will print empty tag
> > and commit strings:
> > 
> >    $ perf version
> >    perf version
> > 
> > Currently the tag version is only generated from the root Makefile when
> > building in a git repository. If PERF-VERSION-FILE has not been
> > generated and the source tree is not in a git repository, then
> > PERF-VERSION-GEN will return an empty version.
> > 
> > The problem can be reproduced with the following steps:
> > 
> >    $ wget https://git.kernel.org/torvalds/t/linux-6.0-rc7.tar.gz
> >    $ tar -xf linux-6.0-rc7.tar.gz && cd linux-6.0-rc7
> >    $ make -C tools/perf
> >    $ tools/perf/perf -v
> >    perf version
> > 
> > Builds from tarballs generated with `make perf-tar-src-pkg` are not
> > impacted by this issue as PERF-VERSION-FILE is included in the archive.
> > 
> > The perf RPM provided by Fedora for 5.18+ is experiencing this problem.
> > Package build logs[0] show that the build is attempting to fall back on
> > PERF-VERSION-FILE, but it is not present.
> > 
> > To resolve this, revert back to the previous logic of using the kernel
> > Makefile version if not in a git repository and PERF-VERSION-FILE does
> > not exist.
> > 
> > [0] https://kojipkgs.fedoraproject.org/packages/kernel-tools/5.19.4/200.fc36/data/logs/x86_64/build.log
> > 
> > Fixes: 7572733b8499 ("perf tools: Fix version kernel tag, 2022-02-21")
> > Signed-off-by: Will Chandler <wfc@wfchandler.org>
> 
> This looks fine, thanks.
> 
> Reviewed-by: John Garry <john.garry@huawei.com>

Tested, fixed the problem, applied.

- Arnaldo
 
> > ---
> > Range-diff against v1:
> > 1:  8195a5ccd82d < -:  ------------ perf tools: Fix empty version number when building outside of a git repo
> > -:  ------------ > 1:  a3beccdab700 perf tools: Fix empty version number when building outside of a git repo
> > 
> >   tools/perf/util/PERF-VERSION-GEN | 10 ++++++++--
> >   1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
> > index 0ee5af529238..3cc42821d9b3 100755
> > --- a/tools/perf/util/PERF-VERSION-GEN
> > +++ b/tools/perf/util/PERF-VERSION-GEN
> > @@ -11,7 +11,8 @@ LF='
> >   '
> >   #
> > -# Always try first to get the version from the kernel Makefile
> > +# Use version from kernel Makefile unless not in a git repository and
> > +# PERF-VERSION-FILE exists
> >   #
> >   CID=
> >   TAG=
> > @@ -19,9 +20,14 @@ if test -d ../../.git -o -f ../../.git
> >   then
> >   	TAG=$(MAKEFLAGS= make -sC ../.. kernelversion)
> >   	CID=$(git log -1 --abbrev=12 --pretty=format:"%h" 2>/dev/null) && CID="-g$CID"
> > -else
> > +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"

-- 

- Arnaldo

      reply	other threads:[~2022-09-30 16:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27 19:52 [PATCH] perf tools: Fix empty version number when building outside of a git repo Will Chandler
2022-09-28  9:21 ` John Garry
2022-09-28 17:26   ` Will Chandler
2022-09-29 10:09     ` John Garry
2022-09-29 19:06       ` Will Chandler
2022-09-29 19:16         ` Arnaldo Carvalho de Melo
2022-09-30 10:23         ` John Garry
2022-09-30 15:11 ` [PATCH v2] " Will Chandler
2022-09-30 16:14   ` John Garry
2022-09-30 16:43     ` Arnaldo Carvalho de Melo [this message]

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=Yzccvf367WOK44U6@kernel.org \
    --to=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=wfc@wfchandler.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.