scripts/bpf_doc: Use silent mode when exec make cmd

[ Upstream commit 5384cc0d1a ]

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: fd0a38f9c3 ("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>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Acked-by: Alejandro Colomar <alx@kernel.org>
Link: https://lore.kernel.org/bpf/20240315023443.2364442-1-liuhangbin@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Hangbin Liu 2024-03-15 10:34:43 +08:00 committed by Greg Kroah-Hartman
parent 347385861c
commit 8333aae9bb

View File

@ -396,8 +396,8 @@ class PrinterRST(Printer):
version = version.stdout.decode().rstrip() version = version.stdout.decode().rstrip()
except: except:
try: try:
version = subprocess.run(['make', 'kernelversion'], cwd=linuxRoot, version = subprocess.run(['make', '-s', '--no-print-directory', 'kernelversion'],
capture_output=True, check=True) cwd=linuxRoot, capture_output=True, check=True)
version = version.stdout.decode().rstrip() version = version.stdout.decode().rstrip()
except: except:
return 'Linux' return 'Linux'