[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87A1F5B6-3F60-4988-8BA6-A993E5789C80@wfchandler.org>
Date: Wed, 28 Sep 2022 13:26:04 -0400
From: Will Chandler <wfc@...handler.org>
To: John Garry <john.garry@...wei.com>
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
mark.rutland@....com, alexander.shishkin@...ux.intel.com,
jolsa@...nel.org, namhyung@...nel.org,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf tools: Fix empty version number when building outside of a git repo
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?
Powered by blists - more mailing lists