mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Will Chandler <wfc@wfchandler.org>
Cc: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
	<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] perf tools: Fix empty version number when building outside of a git repo
Date: Thu, 29 Sep 2022 11:09:12 +0100	[thread overview]
Message-ID: <2a4a15a4-55cd-f98b-4b14-474f24e2c308@huawei.com> (raw)
In-Reply-To: <87A1F5B6-3F60-4988-8BA6-A993E5789C80@wfchandler.org>

On 28/09/2022 18:26, Will Chandler wrote:
> On 28 Sep 2022, at 5:21, John Garry wrote:
> 
>> This looks ok. But did you consider going back to same flow as pre-7572733b8499 to avoid a Makefile check, like:
>>
>> ---8<----
>>
>> CID=
>> TAG=
>> 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"
>> 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
>>
>> --->8---
>>
>> The evaluation for $TAG is not really needed in the first leg since the fallback does the same thing, but just added for clarity.
> 
> I think that would be fine as well. I don't have a strong opinion on which one
> is easier to follow.
> 
> Looking at this more closely, there is a slight difference between the two
> approaches. In the problem scenario my patch will always use `make kernelversion`,
> while pre-7572733b8499 starts with PERF-VERSION-FILE if available, falling
> back to the Makefile.
> 
> With the old approach PERF-VERSION-FILE could be used to manually
> override the version, but this is inconsistent with how the version is
> generated when building in a git repo. Is this relevant?

Hmmm... maybe someone would want to customise PERF-VERSION-FILE for 
their own distro. Not sure. But then fiddling with PERF-VERSION-FILE 
might break the parsing so...I guess not.

BTW, is there any other method of building the perf code not considered? 
So far I know:
a. in git tree
b. perf-tar-src-pkg
c. tarball

Thanks,
John

  reply	other threads:[~2022-09-29 10:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27 19:52 Will Chandler
2022-09-28  9:21 ` John Garry
2022-09-28 17:26   ` Will Chandler
2022-09-29 10:09     ` John Garry [this message]
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

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=2a4a15a4-55cd-f98b-4b14-474f24e2c308@huawei.com \
    --to=john.garry@huawei.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®