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

\
 
 \ /
  Last update: 2022-09-28 19:26    [W:0.080 / U:0.912 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site