[PATCH] docs: sphinx-build-wrapper: include localversion in kernel version string

From: Randy Dunlap

Date: Sat Aug 08 2026 - 00:53:53 EST


Add any localversion* text to the kernel version string
so that the docs index (home) page accurately indicates what
the docs build version is.

E.g.:
7.2.0-rc6-next-20260807

Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
---
Cc: Jonathan Corbet <corbet@xxxxxxx>
Cc: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
Cc: linux-doc@xxxxxxxxxxxxxxx

tools/docs/sphinx-build-wrapper | 9 +++++++++
1 file changed, 9 insertions(+)

--- linux-next-20260807.orig/tools/docs/sphinx-build-wrapper
+++ linux-next-20260807/tools/docs/sphinx-build-wrapper
@@ -220,6 +220,15 @@ class SphinxBuilder:
self.pdflatex = os.environ.get("PDFLATEX", "xelatex")

#
+ # Add localversion* to kernelversion if present
+ #
+ for file in glob(os.environ["srctree"] + "/localversion*"):
+ if not file.endswith(".orig"):
+ with open(file, 'r', encoding='utf-8') as f:
+ text = f.read()
+ self.kernelversion += text
+
+ #
# Kernel main Makefile defines a PYTHON3 variable whose default is
# "python3". When set to a different value, it allows running a
# diferent version than the default official python3 package.