lkml.org 
[lkml]   [2022]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] perf tools: Fix empty version number when building outside of a git repo
From
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

\
 
 \ /
  Last update: 2022-09-29 12:10    [W:0.087 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site