Messages in this thread | | | From | Will Chandler <> | Subject | Re: [PATCH] perf tools: Fix empty version number when building outside of a git repo | Date | Wed, 28 Sep 2022 13:26:04 -0400 |
| |
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?
| |