BPF List
 help / color / mirror / Atom feed
* [PATCH bpf] bpf_doc: use silent mode when exec make cmd
@ 2024-03-15  2:34 Hangbin Liu
  2024-03-15 10:31 ` Quentin Monnet
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hangbin Liu @ 2024-03-15  2:34 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Quentin Monnet, Alejandro Colomar, Hangbin Liu, Michael Hofmann

When getting kernel version via make, the result may be polluted by other
output, like directory change info. e.g.
$ export MAKEFLAGS="-w"
$ make kernelversion
make: Entering directory '/home/net'
6.8.0
make: Leaving directory '/home/net'

This will distort the reStructuredText output and make latter rst2man
failed like:
bpf-helpers.rst:20: (WARNING/2) Field list ends without a blank line; unexpected unindent.

Using silent mode would help. e.g.
$ make -s --no-print-directory kernelversion
6.8.0

Fixes: fd0a38f9c37d ("scripts/bpf: Set version attribute for bpf-helpers(7) man page")
Signed-off-by: Michael Hofmann <mhofmann@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 scripts/bpf_doc.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/bpf_doc.py b/scripts/bpf_doc.py
index 4606944984ee..c55878bddfdd 100755
--- a/scripts/bpf_doc.py
+++ b/scripts/bpf_doc.py
@@ -414,8 +414,8 @@ class PrinterRST(Printer):
             version = version.stdout.decode().rstrip()
         except:
             try:
-                version = subprocess.run(['make', 'kernelversion'], cwd=linuxRoot,
-                                         capture_output=True, check=True)
+                version = subprocess.run(['make', '-s', '--no-print-directory', 'kernelversion'],
+                                         cwd=linuxRoot, capture_output=True, check=True)
                 version = version.stdout.decode().rstrip()
             except:
                 return 'Linux'
-- 
2.43.0


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

end of thread, other threads:[~2024-03-15 13:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-15  2:34 [PATCH bpf] bpf_doc: use silent mode when exec make cmd Hangbin Liu
2024-03-15 10:31 ` Quentin Monnet
2024-03-15 11:21 ` Alejandro Colomar
2024-03-15 13:50 ` patchwork-bot+netdevbpf

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