Skip to contentSkip to conversation

doc: Replace DocBook with sphinx-based docs

PATCH In review Mario Six 4 participants 6 messages Jul 10, 2018 – Jul 26, 2018

Subsystems (3)
lore
Share & tools
lore

Mario Six

author
#0 lore raw

PATCH 1/1 doc: Replace DocBook with sphinx-based docs

The Linux kernel moved to sphinx-based documentation and got rid of the DocBook based documentation quite a while ago. Hence, the DocBook documentation for U-Boot should be converted as well.

To achieve this, import the necessary files from Linux v4.17, and convert the current DocBook documentation (three files altogether) to sphinx/reStructuredText.

For now, all old DocBook documentation was merged into a single handbook, tentatively named "U-Boot Hacker Manual".

For some source files, the documentation style was changed to comply with kernel-doc; no functional changes were applied.

---
 Documentation/.gitignore                          |    2 +
 Documentation/Makefile                            |  124 +
 Documentation/conf.py                             |  528 +++++
 Documentation/index.rst                           |  117 +
 Documentation/media/Makefile                      |   38 +
 Documentation/media/linker_lists.h.rst.exceptions |    0
 Documentation/sphinx-static/theme_overrides.css   |   89 +
 Documentation/sphinx/cdomain.py                   |  165 ++
 Documentation/sphinx/kernel_include.py            |  190 ++
 Documentation/sphinx/kerneldoc.py                 |  146 ++
 Documentation/sphinx/kfigure.py                   |  551 +++++
 Documentation/sphinx/load_config.py               |   32 +
 Documentation/sphinx/parse-headers.pl             |  401 ++++
 Documentation/sphinx/requirements.txt             |    3 +
 Documentation/sphinx/rstFlatTable.py              |  376 +++
 Makefile                                          |    8 +-
 doc/DocBook/.gitignore                            |   15 -
 doc/DocBook/Makefile                              |  222 --
 doc/DocBook/docbook.css                           |   16 -
 doc/DocBook/efi.tmpl                              |   17 -
 doc/DocBook/linker_lists.tmpl                     |   46 -
 doc/DocBook/stdio.tmpl                            |   46 -
 doc/DocBook/stylesheet.xsl                        |   10 -
 include/linker_lists.h                            |  164 +-
 lib/efi_loader/efi_boottime.c                     |  946 ++++----
 scripts/kernel-doc                                | 2527 +++++++++------------
 26 files changed, 4375 insertions(+), 2404 deletions(-)
 create mode 100644 Documentation/.gitignore
 create mode 100644 Documentation/Makefile
 create mode 100644 Documentation/conf.py
 create mode 100644 Documentation/index.rst
 create mode 100644 Documentation/media/Makefile
 create mode 100644 Documentation/media/linker_lists.h.rst.exceptions
 create mode 100644 Documentation/sphinx-static/theme_overrides.css
 create mode 100644 Documentation/sphinx/cdomain.py
 create mode 100755 Documentation/sphinx/kernel_include.py
 create mode 100644 Documentation/sphinx/kerneldoc.py
 create mode 100644 Documentation/sphinx/kfigure.py
 create mode 100644 Documentation/sphinx/load_config.py
 create mode 100755 Documentation/sphinx/parse-headers.pl
 create mode 100644 Documentation/sphinx/requirements.txt
 create mode 100755 Documentation/sphinx/rstFlatTable.py
 delete mode 100644 doc/DocBook/.gitignore
 delete mode 100644 doc/DocBook/Makefile
 delete mode 100644 doc/DocBook/docbook.css
 delete mode 100644 doc/DocBook/efi.tmpl
 delete mode 100644 doc/DocBook/linker_lists.tmpl
 delete mode 100644 doc/DocBook/stdio.tmpl
 delete mode 100644 doc/DocBook/stylesheet.xsl
Documentation/.gitignore new file +2 -0
new file mode 100644
index 0000000000..e74fec8693
@@ -0,0 +1,2 @@
+output
+*.pyc
Documentation/Makefile new file +124 -0

124 lines not on this page · raw message

Documentation/conf.py new file +528 -0

528 lines not on this page · raw message

Documentation/index.rst new file +117 -0

117 lines not on this page · raw message

Documentation/media/Makefile new file +38 -0
new file mode 100644
index 0000000000..0efd18ab4d
@@ -0,0 +1,38 @@
+# Rules to convert a .h file to inline RST documentation
+
+SRC_DIR=$(srctree)/Documentation/media
+PARSER = $(srctree)/Documentation/sphinx/parse-headers.pl
+API = $(srctree)/include
+
+FILES = linker_lists.h.rst
+
+TARGETS := $(addprefix $(BUILDDIR)/, $(FILES))
+
+gen_rst = \
+	echo ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
+	${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
+
+quiet_gen_rst = echo '  PARSE   $(patsubst $(srctree)/%,%,$<)'; \
+	${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
+
+silent_gen_rst = ${gen_rst}
+
+$(BUILDDIR)/linker_lists.h.rst: ${API}/linker_lists.h ${PARSER} $(SRC_DIR)/linker_lists.h.rst.exceptions
+	@$($(quiet)gen_rst)
+
+# Media build rules
+
+.PHONY: all html epub xml latex
+
+all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
+html: all
+epub: all
+xml: all
+latex: $(IMGPDF) all
+linkcheck:
+
+clean:
+	-rm -f $(DOTTGT) $(IMGTGT) ${TARGETS} 2>/dev/null
+
+$(BUILDDIR):
+	$(Q)mkdir -p $@
Documentation/media/linker_lists.h.rst.exceptions new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
Documentation/sphinx-static/theme_overrides.css new file +89 -0

89 lines not on this page · raw message

Documentation/sphinx/cdomain.py new file +165 -0

165 lines not on this page · raw message

Documentation/sphinx/kernel_include.py new file +190 -0

190 lines not on this page · raw message

Documentation/sphinx/kerneldoc.py new file +146 -0

146 lines not on this page · raw message

Documentation/sphinx/kfigure.py new file +551 -0

551 lines not on this page · raw message

Documentation/sphinx/load_config.py new file +32 -0
new file mode 100644
index 0000000000..301a21aa4f
@@ -0,0 +1,32 @@
+# -*- coding: utf-8; mode: python -*-
+# pylint: disable=R0903, C0330, R0914, R0912, E0401
+
+import os
+import sys
+from sphinx.util.pycompat import execfile_
+
+# ------------------------------------------------------------------------------
+def loadConfig(namespace):
+# ------------------------------------------------------------------------------
+
+    u"""Load an additional configuration file into *namespace*.
+
+    The name of the configuration file is taken from the environment
+    ``SPHINX_CONF``. The external configuration file extends (or overwrites) the
+    configuration values from the origin ``conf.py``.  With this you are able to
+    maintain *build themes*.  """
+
+    config_file = os.environ.get("SPHINX_CONF", None)
+    if (config_file is not None
+        and os.path.normpath(namespace["__file__"]) != os.path.normpath(config_file) ):
+        config_file = os.path.abspath(config_file)
+
+        if os.path.isfile(config_file):
+            sys.stdout.write("load additional sphinx-config: %s\n" % config_file)
+            config = namespace.copy()
+            config['__file__'] = config_file
+            execfile_(config_file, config)
+            del config['__file__']
+            namespace.update(config)
+        else:
+            sys.stderr.write("WARNING: additional sphinx-config not found: %s\n" % config_file)
Documentation/sphinx/parse-headers.pl new file +401 -0

401 lines not on this page · raw message

Documentation/sphinx/requirements.txt new file +3 -0
new file mode 100644
index 0000000000..742be3e126
@@ -0,0 +1,3 @@
+docutils==0.12
+Sphinx==1.4.9
+sphinx_rtd_theme
Documentation/sphinx/rstFlatTable.py new file +376 -0

376 lines not on this page · raw message

Makefile +5 -3
index 7d5f801eea..2727f819a5 100644
@@ -1713,9 +1713,11 @@ tests:
 
 # Documentation targets
 # ---------------------------------------------------------------------------
-%docs: scripts_basic FORCE
-	$(Q)$(MAKE) $(build)=scripts build_docproc
-	$(Q)$(MAKE) $(build)=doc/DocBook $@
+DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
+	       linkcheckdocs dochelp refcheckdocs
+PHONY += $(DOC_TARGETS)
+$(DOC_TARGETS): scripts_basic FORCE
+	$(Q)$(MAKE) $(build)=Documentation $@
 
 endif #ifeq ($(config-targets),1)
 endif #ifeq ($(mixed-targets),1)
doc/DocBook/.gitignore deleted +0 -15
deleted file mode 100644
index 7ebd5465d9..0000000000
@@ -1,15 +0,0 @@
-*.xml
-*.ps
-*.pdf
-*.html
-*.9.gz
-*.9
-*.aux
-*.dvi
-*.log
-*.out
-*.png
-*.gif
-*.svg
-media-indices.tmpl
-media-entities.tmpl
doc/DocBook/Makefile deleted +0 -222

209 lines not on this page · raw message

doc/DocBook/docbook.css deleted +0 -16
deleted file mode 100644
index 7a79ec54bd..0000000000

Lines of this file are not shown. View the raw message.

doc/DocBook/efi.tmpl deleted +0 -17
deleted file mode 100644
index 5daaae382b..0000000000

Lines of this file are not shown. View the raw message.

doc/DocBook/linker_lists.tmpl deleted +0 -46

46 lines not on this page · raw message

doc/DocBook/stdio.tmpl deleted +0 -46

46 lines not on this page · raw message

doc/DocBook/stylesheet.xsl deleted +0 -10
deleted file mode 100644
index 85b2527519..0000000000

Lines of this file are not shown. View the raw message.

include/linker_lists.h +53 -111

164 lines not on this page · raw message

lib/efi_loader/efi_boottime.c +490 -456

946 lines not on this page · raw message

scripts/kernel-doc +1065 -1462

2,527 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.11.0

Part of the diff is not shown here. View the raw message.

#1 lore raw

PATCH 1/1 doc: Replace DocBook with sphinx-based docs

Quoted 8 lines · Mario Six

The Linux kernel moved to sphinx-based documentation and got rid of the DocBook based documentation quite a while ago. Hence, the DocBook documentation for U-Boot should be converted as well.

To achieve this, import the necessary files from Linux v4.17, and convert the current DocBook documentation (three files altogether) to sphinx/reStructuredText.

Quoted 6 lines

For now, all old DocBook documentation was merged into a single handbook, tentatively named "U-Boot Hacker Manual".

For some source files, the documentation style was changed to comply with kernel-doc; no functional changes were applied.

Hello Mario,

in general I am fine with the conversion.

Unfortunately your patch is not applicable to efi-next.

Applying: doc: Replace DocBook with sphinx-based docs
error: patch failed: lib/efi_loader/efi_boottime.c:2373
error: lib/efi_loader/efi_boottime.c: patch does not apply Patch failed at 0001 doc: Replace DocBook with sphinx-based docs

Please, separate the lib/efi_loader/* related changes from the rest so that they can be merged separately. The EFI part should be based on the efi-next tree of https://github.com/agraf/u-boot.

Please, copy
https://www.kernel.org/doc/Documentation/kernel-doc-nano-HOWTO.txt
into our doc tree as a reference.

Best regards

Heinrich

Quoted 2 lines

---

#2 lore raw
In reply to Mario Six
Quoted 8 lines · Mario Six

The Linux kernel moved to sphinx-based documentation and got rid of the DocBook based documentation quite a while ago. Hence, the DocBook documentation for U-Boot should be converted as well.

To achieve this, import the necessary files from Linux v4.17, and convert the current DocBook documentation (three files altogether) to sphinx/reStructuredText.

Quoted 7 lines

For now, all old DocBook documentation was merged into a single handbook, tentatively named "U-Boot Hacker Manual".

For some source files, the documentation style was changed to comply with kernel-doc; no functional changes were applied.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180724/89357ea1/attachment.sig>
#3 lore raw
Quoted 13 lines · Tom Rini
Quoted 11 lines · Mario Six

The Linux kernel moved to sphinx-based documentation and got rid of the DocBook based documentation quite a while ago. Hence, the DocBook documentation for U-Boot should be converted as well.

To achieve this, import the necessary files from Linux v4.17, and convert the current DocBook documentation (three files altogether) to sphinx/reStructuredText.

For now, all old DocBook documentation was merged into a single handbook, tentatively named "U-Boot Hacker Manual".

Quoted 7 lines
Quoted 4 lines

For some source files, the documentation style was changed to comply with kernel-doc; no functional changes were applied.

Applied to u-boot/master, thanks!

Does anyone see this error?

$ make distclean
scripts/Makefile.clean:15: doc/DocBook/Makefile: No such file or directory
make[1]: *** No rule to make target 'doc/DocBook/Makefile'.  Stop.
Makefile:1610: recipe for target '_clean_doc/DocBook' failed
make: *** [_clean_doc/DocBook] Error 2

York

#4 lore raw
Quoted 22 lines · York Sun
Quoted 13 lines · Tom Rini
Quoted 11 lines · Mario Six

The Linux kernel moved to sphinx-based documentation and got rid of the DocBook based documentation quite a while ago. Hence, the DocBook documentation for U-Boot should be converted as well.

To achieve this, import the necessary files from Linux v4.17, and convert the current DocBook documentation (three files altogether) to sphinx/reStructuredText.

For now, all old DocBook documentation was merged into a single handbook, tentatively named "U-Boot Hacker Manual".

Quoted 7 lines
Quoted 4 lines

For some source files, the documentation style was changed to comply with kernel-doc; no functional changes were applied.

Applied to u-boot/master, thanks!

Quoted 7 lines

Does anyone see this error?

$ make distclean
scripts/Makefile.clean:15: doc/DocBook/Makefile: No such file or directory
make[1]: *** No rule to make target 'doc/DocBook/Makefile'.  Stop.
Makefile:1610: recipe for target '_clean_doc/DocBook' failed
make: *** [_clean_doc/DocBook] Error 2

Yeah, sorry, I've pushed a fix for this earlier today.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180726/8adfb771/attachment.sig>
#5 lore raw
In reply to York Sun
Quoted 22 lines · York Sun
Quoted 13 lines · Tom Rini
Quoted 11 lines · Mario Six

The Linux kernel moved to sphinx-based documentation and got rid of the DocBook based documentation quite a while ago. Hence, the DocBook documentation for U-Boot should be converted as well.

To achieve this, import the necessary files from Linux v4.17, and convert the current DocBook documentation (three files altogether) to sphinx/reStructuredText.

For now, all old DocBook documentation was merged into a single handbook, tentatively named "U-Boot Hacker Manual".

Quoted 7 lines
Quoted 4 lines

For some source files, the documentation style was changed to comply with kernel-doc; no functional changes were applied.

Applied to u-boot/master, thanks!

Quoted 7 lines

Does anyone see this error?

$ make distclean
scripts/Makefile.clean:15: doc/DocBook/Makefile: No such file or directory
make[1]: *** No rule to make target 'doc/DocBook/Makefile'.  Stop.
Makefile:1610: recipe for target '_clean_doc/DocBook' failed
make: *** [_clean_doc/DocBook] Error 2

Ah! Never mind. I see Tom's patch sent yesterday.

York