Skip to contentSkip to conversation

some patches against build-script

PATCH Superseded Mauro Carvalho Chehab 3 participants 7 messages Sep 29, 2025 – Oct 1, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover some patches against build-script

Hi Jon,

This small patch series contain 3 minor fixes/cleanups for sphinx-build-wrapper addressing some corner usecases.

Patch 1 was already submitted. It avoids 2 harmless warnings when texlive is not installed.

Patch 2 fixes the checker for latexmk (PDFLATEX env) when texlive is not installed.

Patch 3 restores the logic to store *.pyc files under builddir instead of sourcedir.

Mauro Carvalho Chehab (3):
docs: Makefile: avoid a warning when using without texlive tools/docs: sphinx-build-wrapper: pdflatex is needed only for pdf
docs: Makefile: use PYTHONPYCACHEPREFIX

 Documentation/Makefile          | 19 ++++++++-----------
 tools/docs/sphinx-build-wrapper |  2 +-
 2 files changed, 9 insertions(+), 12 deletions(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH 1/3 docs: Makefile: avoid a warning when using without texlive

As reported by Randy, running make htmldocs on a machine without textlive now produce warnings:

    $ make O=DOCS htmldocs
    ../Documentation/Makefile:70: warning: overriding recipe for target 'pdfdocs'
    ../Documentation/Makefile:61: warning: ignoring old recipe for target 'pdfdocs'

That's because the code has now two definitions for pdfdocs in case $PDFLATEX command is not found. With the new script, such special case is not needed anymore, as the script checks it.

Drop the special case. Even after dropping it, on a machine without LaTeX, it will still produce an error as expected, as running:

    $ ./tools/docs/sphinx-build-wrapper pdfdocs
    Error: pdflatex or latexmk required for PDF generation

does the check. After applying the patch we have:

    $ make SPHINXDIRS=peci htmldocs
    Using alabaster theme
    Using Python kernel-doc
    $ make SPHINXDIRS=peci pdfdocs
    Error: pdflatex or latexmk required for PDF generation
    make[2]: *** [Documentation/Makefile:64: pdfdocs] Error 1
    make[1]: *** [/root/Makefile:1808: pdfdocs] Error 2
    make: *** [Makefile:248: __sub-make] Error 2

Which is the expected behavior.

---
 Documentation/Makefile | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
Documentation/Makefile +4 -9
index c60db1038c9c..f764604fa1ac 100644
@@ -66,20 +66,15 @@ htmldocs mandocs infodocs texinfodocs latexdocs epubdocs xmldocs pdfdocs linkche
 		--builddir="$(BUILDDIR)" --deny-vf=$(FONTS_CONF_DENY_VF) \
 		--theme=$(DOCS_THEME) --css=$(DOCS_CSS) --paper=$(PAPER)
 
-# Special handling for pdfdocs
-ifneq ($(shell which $(PDFLATEX) >/dev/null 2>&1; echo $$?),0)
-pdfdocs:
-	$(warning The '$(PDFLATEX)' command was not found. Make sure you have it installed and in PATH to produce PDF output.)
-	@echo "  SKIP    Sphinx $@ target."
-endif
 
-htmldocs-redirects: $(srctree)/Documentation/.renames.txt
-	@tools/docs/gen-redirects.py --output $(BUILDDIR) < $<
-endif # HAVE_SPHINX
+endif
 
 # The following targets are independent of HAVE_SPHINX, and the rules should
 # work or silently pass without Sphinx.
 
+htmldocs-redirects: $(srctree)/Documentation/.renames.txt
+	@tools/docs/gen-redirects.py --output $(BUILDDIR) < $<
+
 refcheckdocs:
 	$(Q)cd $(srctree);scripts/documentation-file-ref-check
 
Signature · 1 line
2.51.0
reviewer Acked-by Tested-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] docs: Makefile: avoid a warning when using without texlive

Quoted 30 lines · Mauro Carvalho Chehab

As reported by Randy, running make htmldocs on a machine without textlive now produce warnings:

    $ make O=DOCS htmldocs
    ../Documentation/Makefile:70: warning: overriding recipe for target 'pdfdocs'
    ../Documentation/Makefile:61: warning: ignoring old recipe for target 'pdfdocs'

That's because the code has now two definitions for pdfdocs in case $PDFLATEX command is not found. With the new script, such special case is not needed anymore, as the script checks it.

Drop the special case. Even after dropping it, on a machine without LaTeX, it will still produce an error as expected, as running:

    $ ./tools/docs/sphinx-build-wrapper pdfdocs
    Error: pdflatex or latexmk required for PDF generation

does the check. After applying the patch we have:

    $ make SPHINXDIRS=peci htmldocs
    Using alabaster theme
    Using Python kernel-doc
    $ make SPHINXDIRS=peci pdfdocs
    Error: pdflatex or latexmk required for PDF generation
    make[2]: *** [Documentation/Makefile:64: pdfdocs] Error 1
    make[1]: *** [/root/Makefile:1808: pdfdocs] Error 2
    make: *** [Makefile:248: __sub-make] Error 2
Quoted 4 lines

Which is the expected behavior.

Maybe Closes: ? Anyway:

Thanks.

Quoted 34 lines
---
 Documentation/Makefile | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
Documentation/Makefile +4 -9
index c60db1038c9c..f764604fa1ac 100644
@@ -66,20 +66,15 @@ htmldocs mandocs infodocs texinfodocs latexdocs epubdocs xmldocs pdfdocs linkche
 		--builddir="$(BUILDDIR)" --deny-vf=$(FONTS_CONF_DENY_VF) \
 		--theme=$(DOCS_THEME) --css=$(DOCS_CSS) --paper=$(PAPER)
 
-# Special handling for pdfdocs
-ifneq ($(shell which $(PDFLATEX) >/dev/null 2>&1; echo $$?),0)
-pdfdocs:
-	$(warning The '$(PDFLATEX)' command was not found. Make sure you have it installed and in PATH to produce PDF output.)
-	@echo "  SKIP    Sphinx $@ target."
-endif
 
-htmldocs-redirects: $(srctree)/Documentation/.renames.txt
-	@tools/docs/gen-redirects.py --output $(BUILDDIR) < $<
-endif # HAVE_SPHINX
+endif
 
 # The following targets are independent of HAVE_SPHINX, and the rules should
 # work or silently pass without Sphinx.
 
+htmldocs-redirects: $(srctree)/Documentation/.renames.txt
+	@tools/docs/gen-redirects.py --output $(BUILDDIR) < $<
+
 refcheckdocs:
 	$(Q)cd $(srctree);scripts/documentation-file-ref-check
 
Signature · 1 line
~Randy
#3 lore raw

PATCH 2/3 tools/docs: sphinx-build-wrapper: pdflatex is needed only for pdf

In reply to Mauro Carvalho Chehab

Fix the logic which checks for pdflatex. Currently, it complains for both pdfdocs and latexdocs, but for the latter, all it is needed is Sphinx.

---
 tools/docs/sphinx-build-wrapper | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/docs/sphinx-build-wrapper +1 -1
index cce985dced00..a74998e8309a 100755
@@ -650,7 +650,7 @@ class SphinxBuilder:
             if not sphinxbuild and target != "mandocs":
                 sys.exit(f"Error: {self.sphinxbuild} not found in PATH.\n")
 
-        if builder == "latex":
+        if target == "pdfdocs":
             if not self.pdflatex_cmd and not self.latexmk_cmd:
                 sys.exit("Error: pdflatex or latexmk required for PDF generation")
 
Signature · 1 line
2.51.0
#4 lore raw

PATCH 3/3 docs: Makefile: use PYTHONPYCACHEPREFIX

In reply to Mauro Carvalho Chehab

Previous cleanup patches ended dropping it when sphinx-build-wrapper were added. Also, sphinx-pre-install can also generate caches.

So, re-add it for both.

---
 Documentation/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/Makefile +4 -2
index f764604fa1ac..cf26d5332fb5 100644
@@ -60,8 +60,10 @@ else # HAVE_SPHINX
 
 # Common documentation targets
 htmldocs mandocs infodocs texinfodocs latexdocs epubdocs xmldocs pdfdocs linkcheckdocs:
-	$(Q)@$(srctree)/tools/docs/sphinx-pre-install --version-check
-	+$(Q)$(PYTHON3) $(BUILD_WRAPPER) $@ \
+	$(Q)PYTHONPYCACHEPREFIX="$(PYTHONPYCACHEPREFIX)" \
+		@$(srctree)/tools/docs/sphinx-pre-install --version-check
+	+$(Q)PYTHONPYCACHEPREFIX="$(PYTHONPYCACHEPREFIX)" \
+		$(PYTHON3) $(BUILD_WRAPPER) $@ \
 		--sphinxdirs="$(SPHINXDIRS)" $(RUSTDOC) \
 		--builddir="$(BUILDDIR)" --deny-vf=$(FONTS_CONF_DENY_VF) \
 		--theme=$(DOCS_THEME) --css=$(DOCS_CSS) --paper=$(PAPER)
Signature · 1 line
2.51.0
maintainer
#5 lore raw

Re: [PATCH 3/3] docs: Makefile: use PYTHONPYCACHEPREFIX

Quoted 15 lines · Mauro Carvalho Chehab

Previous cleanup patches ended dropping it when sphinx-build-wrapper were added. Also, sphinx-pre-install can also generate caches.

So, re-add it for both.

---
 Documentation/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/Makefile +0 -0
index f764604fa1ac..cf26d5332fb5 100644

Documentation/Makefile else # HAVE_SPHINX · line 66

Quoted 9 lines
Documentation/Makefile +4 -2
@@ -60,8 +60,10 @@ else # HAVE_SPHINX
 
 # Common documentation targets
 htmldocs mandocs infodocs texinfodocs latexdocs epubdocs xmldocs pdfdocs linkcheckdocs:
-	$(Q)@$(srctree)/tools/docs/sphinx-pre-install --version-check
-	+$(Q)$(PYTHON3) $(BUILD_WRAPPER) $@ \
+	$(Q)PYTHONPYCACHEPREFIX="$(PYTHONPYCACHEPREFIX)" \
+		@$(srctree)/tools/docs/sphinx-pre-install --version-check
+	+$(Q)PYTHONPYCACHEPREFIX="$(PYTHONPYCACHEPREFIX)" \
+		$(PYTHON3) $(BUILD_WRAPPER) $@ \

This causes an immediate build fail for me:

/bin/sh: line 1: @./tools/docs/sphinx-pre-install: No such file or directory make[2]: *** [Documentation/Makefile:63: htmldocs] Error 127 make[1]: *** [Makefile:1808: htmldocs] Error 2
make: *** [Makefile:248: __sub-make] Error 2

jon

#6 lore raw

Re: [PATCH 3/3] docs: Makefile: use PYTHONPYCACHEPREFIX

Quoted 18 lines · Jonathan Corbet
Quoted 16 lines · Mauro Carvalho Chehab

Previous cleanup patches ended dropping it when sphinx-build-wrapper were added. Also, sphinx-pre-install can also generate caches.

So, re-add it for both.

---
 Documentation/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/Makefile +0 -0
index f764604fa1ac..cf26d5332fb5 100644
@@ -60,8 +60,10 @@ else # HAVE_SPHINX
 
Quoted 6 lines

Documentation/Makefile else # HAVE_SPHINX · line 64

Quoted 6 lines
Documentation/Makefile +2 -2
 # Common documentation targets
 htmldocs mandocs infodocs texinfodocs latexdocs epubdocs xmldocs pdfdocs linkcheckdocs:
-	$(Q)@$(srctree)/tools/docs/sphinx-pre-install --version-check
-	+$(Q)$(PYTHON3) $(BUILD_WRAPPER) $@ \
+	$(Q)PYTHONPYCACHEPREFIX="$(PYTHONPYCACHEPREFIX)" \
+		@$(srctree)/tools/docs/sphinx-pre-install --version-check

The problem is the "@" here...

Quoted 9 lines

Documentation/Makefile else # HAVE_SPHINX · line 66

Quoted 2 lines
Documentation/Makefile +2 -0
+	+$(Q)PYTHONPYCACHEPREFIX="$(PYTHONPYCACHEPREFIX)" \
+		$(PYTHON3) $(BUILD_WRAPPER) $@ \

This causes an immediate build fail for me:

/bin/sh: line 1: @./tools/docs/sphinx-pre-install: No such file or directory make[2]: *** [Documentation/Makefile:63: htmldocs] Error 127 make[1]: *** [Makefile:1808: htmldocs] Error 2
make: *** [Makefile:248: __sub-make] Error 2

Fixed and will resend you a new version. This /3 series, plus a RFC for kernel-doc are the only one pending.

I'll send the RFC in separate, and send a new version of this one.

Quoted 2 lines

jon

Signature · 2 lines
Thanks,
Mauro