Skip to contentSkip to conversation

bpf_doc: use silent mode when exec make cmd

PATCH Applied Hangbin Liu 4 participants 4 messages Mar 15, 2024 BPF

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf_doc: use silent mode when exec make cmd

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")
---
 scripts/bpf_doc.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/bpf_doc.py +2 -2
index 4606944984ee..c55878bddfdd 100755
@@ -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'
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

2024-03-15 02:34 UTC+0000 ~ Hangbin Liu <[email protected]>

Quoted 28 lines

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")
---
 scripts/bpf_doc.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/bpf_doc.py +0 -0
index 4606944984ee..c55878bddfdd 100755

scripts/bpf_doc.py class PrinterRST(Printer): · line 421

Quoted 10 lines
scripts/bpf_doc.py +2 -2
@@ -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'

This can probably go through bpf-next, though.

Thanks!

Acked-by on v1 1/1
#2 lore raw
In reply to Hangbin Liu

Hi!

Quoted 8 lines · Hangbin Liu

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'
Quoted 6 lines

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

Thanks!
Alex

Quoted 27 lines

6.8.0

Fixes fd0a38f9c37d ("scripts/bpf: Set version attribute for bpf-helpers(7) man page")
---
 scripts/bpf_doc.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/bpf_doc.py +2 -2
index 4606944984ee..c55878bddfdd 100755
@@ -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'
Signature · 1 line
2.43.0
Signature · 1 line
<https://www.alejandro-colomar.es/>
#3 lore raw
In reply to Hangbin Liu
This patch was applied to bpf/bpf.git (master) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to bpf/bpf.git (master)
by Daniel Borkmann <[email protected]>:

Quoted 9 lines · On Fri, 15 Mar 2024 10:34:43 +0800 you wrote:

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'

[...]

Here is the summary with links:
- [bpf] bpf_doc: use silent mode when exec make cmd

    https://git.kernel.org/bpf/bpf/c/5384cc0d1a88

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html