Messages in this thread Patch in this message | | | From | Matthieu Baerts <> | Subject | [PATCH perf] perf tools: .git/ORIG_HEAD might not exist | Date | Tue, 29 Mar 2022 11:31:20 +0200 |
| |
It seems it cannot be assumed .git/ORIG_HEAD exists if .git/HEAD is there.
Indeed, recently our public CI reported[1] the following error when compiling Perf tool:
$ cd tools/perf $ make -j4 -l4 O=/tmp/(...)/perf DESTDIR=/usr install (...) make[2]: *** No rule to make target '../../.git/ORIG_HEAD', needed by '/tmp/(...)/perf/PERF-VERSION-FILE'.
This is because apparently[2] Cirrus Ci uses a Git client implemented purely in Go[3] to perform a clone. Most likely, this tool doesn't create any .git/ORIG_HEAD file but .git/HEAD is there. The error can indeed be reproduced by renaming this .git/ORIG_HEAD file while keeping .git/HEAD. In other words, it means it is not enough to check the presence of .git/HEAD to assume .git/ORIG_HEAD exists as well.
With the modification here, the version file is always regenerated if .git/ORIG_HEAD file is not present. But that is not an issue as kernel devs probably don't use such tools in their dev env and it can be assumed for them that they have both .git/HEAD and .git/ORIG_HEAD files.
[1] https://cirrus-ci.com/task/5673396527693824?logs=test#L5026 [2] https://cirrus-ci.org/guide/tips-and-tricks/ [3] https://github.com/go-git/go-git
Fixes: 4e666cdb06ee ("perf tools: Fix dependency for version file creation") Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> --- tools/perf/Makefile.perf | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 9c935f86d172..2f64e4904bbb 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -1143,10 +1143,12 @@ endif # Trick: if ../../.git does not exist - we are building out of tree for example, # then force version regeneration: # +GIT-HEAD-PHONY = ifeq ($(wildcard ../../.git/HEAD),) - GIT-HEAD-PHONY = ../../.git/HEAD ../../.git/ORIG_HEAD -else - GIT-HEAD-PHONY = + GIT-HEAD-PHONY += ../../.git/HEAD +endif +ifeq ($(wildcard ../../.git/ORIG_HEAD),) + GIT-HEAD-PHONY += ../../.git/ORIG_HEAD endif FORCE: base-commit: ab0809af0bee88b689ba289ec8c40aa2be3a17ec -- 2.34.1
| |