mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH perf] perf tools: .git/ORIG_HEAD might not exist
@ 2022-03-29  9:31 Matthieu Baerts
  2022-03-29 10:32 ` John Garry
  2022-03-31 17:33 ` Andres Freund
  0 siblings, 2 replies; 5+ messages in thread
From: Matthieu Baerts @ 2022-03-29  9:31 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	John Garry
  Cc: mptcp, Matthieu Baerts, Arnaldo Carvalho de Melo,
	linux-perf-users, linux-kernel

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-31 18:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-29  9:31 [PATCH perf] perf tools: .git/ORIG_HEAD might not exist Matthieu Baerts
2022-03-29 10:32 ` John Garry
2022-03-29 15:12   ` Matthieu Baerts
2022-03-31 17:33 ` Andres Freund
2022-03-31 18:23   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®