linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] Documentation/Sphinx
@ 2016-05-20 13:39 Jani Nikula
  2016-05-20 13:39 ` [PATCH 01/10] kernel-doc: fix use of uninitialized value Jani Nikula
                   ` (11 more replies)
  0 siblings, 12 replies; 45+ messages in thread
From: Jani Nikula @ 2016-05-20 13:39 UTC (permalink / raw)
  To: Markus Heiser
  Cc: Jani Nikula, Daniel Vetter, Jonathan Corbet, Grant Likely,
	Mauro Carvalho Chehab, Dan Allen, Russel Winder, Keith Packard,
	LKML, linux-doc, Hans Verkuil

Hi Jon, all -

I've had a few moments of spare time to look into Sphinx. This is a sort
of status report on the progress.

I suppose we all thought it would be easiest to use docproc for the
Sphinx toolchain, for starters. I tried it, hard, and even sent a bunch
of docproc prep patches. However I ran into some problems. Out-of-tree
builds were a nightmare, as Sphinx has trouble to pick up some of the
files from $(srctree) and some from $(objtree). Having dependencies on
the source files work without rebuilding everything was getting tricky
too.

I decided to look into writing a Sphinx extension for kernel-doc, and it
turns out to be a really nice solution. We can keep all the .rst files
in $(srctree), we don't have to explicitly specify the .rst files to
process, there are no intermediate files, and Sphinx runs the kernel-doc
script using the extension based on the directives in the .rst
files. The extension tells Sphinx about the dependencies on the source
files, and Sphinx handles rebuilding as needed. Out-of-tree builds just
work. Sites like https://readthedocs.org/ can build the documentation,
including kernel-doc, without extra tweaks. As a whole, the build
becomes much simpler.

There are a few tradeoffs, of course. First, this requires that the
EXPORT_SYMBOL markers are placed immediately after the function being
exported, as kernel-doc will only look at one file at a time. This is
the recommendation anyway. See the corresponding patch for further
details ("kernel-doc: support printing exported and non-exported
symbols"). Second, we lose support for the !C docproc directive to check
that all kernel-doc comments in a file are used. This is probably
something we'd like to have back in the future, but at this time I think
it's an acceptable tradeoff wrt the gains.

With this, we can put any .rst files (including ones that have
kernel-doc directives) anywhere under Documentation, add a link to them
in Documentation/index.rst table of contents, and it will just work. It
can't get much simpler than that.

At this time I've put most effort into the configuration and build side
of things, solving the problems described above, and handling missing
tools and packages gracefully. There are still issues to be ironed out
in a) the kernel-doc script rst output and b) the xml template to rst
conversion. These are somewhat orthogonal from each other and the build,
and I expect some hand-editing will be required in the end.

The patches are available in the "sphinx" branch of [1], and I've set up
a project at Read the Docs to build that into documentation [2] (mostly
to test this approach also works and so I don't have to host this
anywhere).

Any comments are welcome, but please do remember that I've focused on
polishing the toolchain and build, not the output quality, with release
early, release often in mind.

BR,
Jani.


[1] git://people.freedesktop.org/~jani/drm
[2] https://kernel.readthedocs.io/



Jani Nikula (9):
  kernel-doc: fix use of uninitialized value
  kernel-doc: support printing exported and non-exported symbols
  Documentation/sphinx: add basic working Sphinx configuration and build
  Documentation: add .gitignore
  Documentation/sphinx: add Sphinx kernel-doc directive extension
  Documentation/sphinx: configure the kernel-doc extension
  Documentation: add kernel hacking rst
  Documentation: add kernel api rst
  Documentation: moar files

Jonathan Corbet (1):
  sphinx: cheesy script to convert .tmpl files

 Documentation/.gitignore                  |    1 +
 Documentation/DocBook/Makefile            |    7 +-
 Documentation/Makefile.sphinx             |   63 +
 Documentation/conf.py                     |  384 +++++
 Documentation/crypto-API.rst              | 1870 +++++++++++++++++++++
 Documentation/filesystems.rst             |  314 ++++
 Documentation/gpu.rst                     | 2556 +++++++++++++++++++++++++++++
 Documentation/index.rst                   |   30 +
 Documentation/kernel-api.rst              |  419 +++++
 Documentation/kernel-hacking.rst          |  795 +++++++++
 Documentation/sphinx/convert_template.sed |   14 +
 Documentation/sphinx/kernel-doc.py        |   99 ++
 Documentation/sphinx/post_convert.sed     |   19 +
 Documentation/sphinx/tmplcvt              |   19 +
 Makefile                                  |    5 +-
 scripts/kernel-doc                        |   32 +-
 16 files changed, 6619 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/.gitignore
 create mode 100644 Documentation/Makefile.sphinx
 create mode 100644 Documentation/conf.py
 create mode 100644 Documentation/crypto-API.rst
 create mode 100644 Documentation/filesystems.rst
 create mode 100644 Documentation/gpu.rst
 create mode 100644 Documentation/index.rst
 create mode 100644 Documentation/kernel-api.rst
 create mode 100644 Documentation/kernel-hacking.rst
 create mode 100644 Documentation/sphinx/convert_template.sed
 create mode 100644 Documentation/sphinx/kernel-doc.py
 create mode 100644 Documentation/sphinx/post_convert.sed
 create mode 100755 Documentation/sphinx/tmplcvt

-- 
2.1.4

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2016-06-29 12:41 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-20 13:39 [PATCH 00/10] Documentation/Sphinx Jani Nikula
2016-05-20 13:39 ` [PATCH 01/10] kernel-doc: fix use of uninitialized value Jani Nikula
2016-05-20 13:39 ` [PATCH 02/10] kernel-doc: support printing exported and non-exported symbols Jani Nikula
2016-05-20 13:39 ` [PATCH 03/10] Documentation/sphinx: add basic working Sphinx configuration and build Jani Nikula
2016-05-20 13:39 ` [PATCH 04/10] Documentation: add .gitignore Jani Nikula
2016-05-20 13:39 ` [PATCH 05/10] Documentation/sphinx: add Sphinx kernel-doc directive extension Jani Nikula
2016-06-03 20:35   ` Jonathan Corbet
2016-06-04  6:57     ` Markus Heiser
2016-05-20 13:39 ` [PATCH 06/10] Documentation/sphinx: configure the kernel-doc extension Jani Nikula
2016-05-20 13:39 ` [PATCH 07/10] sphinx: cheesy script to convert .tmpl files Jani Nikula
2016-05-20 13:39 ` [PATCH 08/10] Documentation: add kernel hacking rst Jani Nikula
2016-05-20 13:39 ` [PATCH 09/10] Documentation: add kernel api rst Jani Nikula
2016-05-20 13:39 ` [PATCH 10/10] Documentation: moar files Jani Nikula
2016-05-29 20:33 ` [PATCH 00/10] Documentation/Sphinx Jani Nikula
2016-05-30  9:10   ` Daniel Vetter
2016-05-30 10:47     ` Markus Heiser
2016-05-30 14:46       ` Jani Nikula
2016-05-30 15:29         ` Daniel Vetter
2016-05-30 16:39         ` Markus Heiser
2016-05-30 20:05           ` Jani Nikula
2016-05-30 21:23             ` Mauro Carvalho Chehab
2016-05-31 10:16               ` Markus Heiser
2016-06-24 10:40                 ` Mauro Carvalho Chehab
2016-06-27  6:15                   ` Markus Heiser
2016-06-27 17:08                     ` Mauro Carvalho Chehab
2016-06-29 12:41                       ` Markus Heiser
2016-05-31  7:27             ` Markus Heiser
2016-05-31  8:07               ` Daniel Vetter
2016-05-31  9:39                 ` Markus Heiser
2016-05-31 10:30                   ` Jani Nikula
2016-05-31 11:12                     ` Markus Heiser
2016-06-03 20:47             ` rst2pdf (was [PATCH 00/10] Documentation/Sphinx) Jonathan Corbet
2016-06-07  6:02               ` Markus Heiser
2016-06-07  6:44                 ` Jani Nikula
2016-06-10 17:08                   ` Markus Heiser
2016-06-03 21:04             ` [PATCH 00/10] Documentation/Sphinx Jonathan Corbet
2016-06-03 22:54               ` Daniel Vetter
2016-06-04 11:45               ` Jani Nikula
2016-06-01  1:07     ` Jonathan Corbet
2016-06-01  6:42       ` Daniel Vetter
2016-06-03 20:16 ` Jonathan Corbet
2016-06-03 20:24   ` Daniel Vetter
2016-06-03 20:27     ` Jonathan Corbet
2016-06-04 13:01       ` Jani Nikula
2016-06-04 12:54   ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).