Add a way to build only media docs
Subsystems (4)
cover Add a way to build only media docs
Being able to build just the media docs is important for us due to several reasons:
1) Media developers community hosts a copy of the media documentation at linuxtv.org
with the very latest under development documents;
2) Nitpicking to identify broken references is important to identify documentation gaps
that need to be addressed on future releases;
3) As media maintainers check patch per patch if a documentation gap is introduced, building media documentation should be as fast as possible.
This patchset adds a media file adding nitpick support and an extra build target that will compile only the media documentation. It also groups all media documentation into one section on the main Kernel document, with is, IMHO, a good thing as we start adding more stuff there.
Jon,
I'd love to see this patch merged early at the -rc cycle, in order to avoid merge conflicts when people start converting other docbooks to Sphinx, as it touches at the main Makefile and at the Sphinx common stuff. Also, as I'll need to patch my build scripts to check for documentation issues with Sphinx, I need them on my master branch, as otherwise my workflow will be broken until the next Kernel release.
So, If you're ok with this patch series, can you submit to Linus on early -rc? Or if you prefer, I can do it myself, with your ack.
Thanks!
Mauro
PS.: I would prefer to have a more generic way to add support to build documentation for only one subsystem, but, as we also need to load an extra python module to be able to enable nitpick mode, I opted, for now, on not doing it too generic. We can rework on it later, as other subsystems would need a similar feature.
Markus Heiser (1):
doc-rst: support additional Sphinx build config override
Mauro Carvalho Chehab (2):
doc-rst: add an option to build media documentation in nitpick mode
doc-rst: remove a bogus comment from Documentation/index.rst
Documentation/Makefile.sphinx | 10 ++++- Documentation/conf.py | 9 ++++ Documentation/index.rst | 7 +-- Documentation/media/conf_nitpick.py | 85 +++++++++++++++++++++++++++++++++++++ Documentation/media/index.rst | 12 ++++++ Documentation/sphinx/load_config.py | 25 +++++++++++ Makefile | 6 +++ 7 files changed, 146 insertions(+), 8 deletions(-) create mode 100644 Documentation/media/conf_nitpick.py create mode 100644 Documentation/media/index.rst create mode 100644 Documentation/sphinx/load_config.py
Signature · 1 line
2.7.4
Em Sat, 6 Aug 2016 09:00:31 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:
Quoted 19 lines
Being able to build just the media docs is important for us due to several reasons:
1) Media developers community hosts a copy of the media documentation at linuxtv.org
with the very latest under development documents;2) Nitpicking to identify broken references is important to identify documentation gaps
that need to be addressed on future releases;3) As media maintainers check patch per patch if a documentation gap is introduced, building media documentation should be as fast as possible.
This patchset adds a media file adding nitpick support and an extra build target that will compile only the media documentation. It also groups all media documentation into one section on the main Kernel document, with is, IMHO, a good thing as we start adding more stuff there.
Jon,
Quoted 8 lines
I'd love to see this patch merged early at the -rc cycle, in order to avoid merge conflicts when people start converting other docbooks to Sphinx, as it touches at the main
Makefileand at the Sphinx common stuff. Also, as I'll need to patch my build scripts to check for documentation issues with Sphinx, I need them on my master branch, as otherwise my workflow will be broken until the next Kernel release.So, If you're ok with this patch series, can you submit to Linus on early -rc? Or if you prefer, I can do it myself, with your ack.
Forgot to comment, but those patches are applied against ustream master branch. I applied them against my development tree at:
https://git.linuxtv.org//mchehab/experimental.git/log/?h=docs-next
Regards,
Mauro
PATCH 1/3 doc-rst: support additional Sphinx build config override
In reply to Mauro Carvalho ChehabFrom: Markus Heiser <[email protected]>
Load an additional configuration file into conf.py 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*.
E.g. to create your own nit-picking *build theme*, create a file Documentation/conf_nitpick.py::
nitpicky=True
nitpick_ignore = [
("c:func", "clock_gettime"),
...
]and run make with SPHINX_CONF environment::
make SPHINX_CONF=conf_nitpick.py htmldocs
--- Documentation/conf.py | 9 +++++++++ Documentation/sphinx/load_config.py | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 Documentation/sphinx/load_config.py
Documentation/conf.py +9 -0
@@ -20,6 +20,8 @@ import os # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('sphinx')) +from load_config import loadConfig + # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here.
@@ -419,3 +421,10 @@ pdf_documents = [ # line arguments. kerneldoc_bin = '../scripts/kernel-doc' kerneldoc_srctree = '..' + + +# ------------------------------------------------------------------------------ +# Since loadConfig overwrites settings from the global namespace, it has to be +# the last statement in the conf.py file +# ------------------------------------------------------------------------------ +loadConfig(globals())
Documentation/sphinx/load_config.py new file +25 -0
@@ -0,0 +1,25 @@ +# -*- coding: utf-8; mode: python -*- +# pylint: disable=R0903, C0330, R0914, R0912, E0401 + +import os +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.exists(config_file): + config_file = os.path.abspath(config_file) + config = namespace.copy() + config['__file__'] = config_file + execfile_(config_file, config) + del config['__file__'] + namespace.update(config)
Signature · 1 line
2.7.4
PATCH 2/3 doc-rst: add an option to build media documentation in nitpick mode
In reply to Mauro Carvalho ChehabWhile writing the media documentation, it is important to be able to check if all symbols that are internal to the documentation were cross-referenced, as this ensures that newer patches won't be introducing documentation gaps.
So, add a way to build only the media documentation in nitpick mode.
--- Documentation/Makefile.sphinx | 10 ++++- Documentation/index.rst | 5 +-- Documentation/media/conf_nitpick.py | 85 +++++++++++++++++++++++++++++++++++++ Documentation/media/index.rst | 12 ++++++ Makefile | 6 +++ 5 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 Documentation/media/conf_nitpick.py create mode 100644 Documentation/media/index.rst
Documentation/Makefile.sphinx +8 -2
@@ -33,12 +33,17 @@ PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter KERNELDOC = $(srctree)/scripts/kernel-doc KERNELDOC_CONF = -D kerneldoc_srctree=$(srctree) -D kerneldoc_bin=$(KERNELDOC) -ALLSPHINXOPTS = -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) -d $(BUILDDIR)/.doctrees $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) -c $(srctree)/$(src) $(SPHINXOPTS) $(srctree)/$(src) +ALLSPHINXOPTS = -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) -d $(BUILDDIR)/.doctrees $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) -c $(srctree)/$(src) $(SPHINXOPTS) # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . quiet_cmd_sphinx = SPHINX $@ - cmd_sphinx = BUILDDIR=$(BUILDDIR) $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(BUILDDIR)/$2 + cmd_sphinx = BUILDDIR=$(BUILDDIR) $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(srctree)/$(src)$3 $(BUILDDIR)/$2 + +# Build only the media docs, in nitpick mode +mediadocs: + $(MAKE) BUILDDIR=$(BUILDDIR) SPHINX_CONF=media/conf_nitpick.py -f $(srctree)/Documentation/media/Makefile htmldocs + $(call cmd,sphinx,html,/media) htmldocs: $(MAKE) BUILDDIR=$(BUILDDIR) -f $(srctree)/Documentation/media/Makefile $@
@@ -70,6 +75,7 @@ cleandocs: dochelp: @echo ' Linux kernel internal documentation in different formats (Sphinx):' @echo ' htmldocs - HTML' + @echo ' mediadocs - built only media books in HTML on nitpick mode' @echo ' pdfdocs - PDF' @echo ' epubdocs - EPUB' @echo ' xmldocs - XML'
Documentation/index.rst +1 -4
@@ -14,10 +14,7 @@ Contents: :maxdepth: 2 kernel-documentation - media/media_uapi - media/media_kapi - media/dvb-drivers/index - media/v4l-drivers/index + media/index gpu/index Indices and tables
Documentation/media/conf_nitpick.py new file +85 -0
85 lines not on this page · raw message
Documentation/media/index.rst new file +12 -0
@@ -0,0 +1,12 @@ +Linux Media Subsystem Documentation +=================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + media_uapi + media_kapi + dvb-drivers/index + v4l-drivers/index
Makefile +6 -0
@@ -1439,6 +1439,12 @@ $(DOC_TARGETS): scripts_basic FORCE $(Q)$(MAKE) $(build)=Documentation -f $(srctree)/Documentation/Makefile.sphinx $@ $(Q)$(MAKE) $(build)=Documentation/DocBook $@ +DOC_NITPIC_TARGETS := mediadocs +PHONY += $(DOC_NITPIC_TARGETS) +$(DOC_NITPIC_TARGETS): scripts_basic FORCE + $(Q)$(MAKE) $(build)=scripts build_docproc build_check-lc_ctype + $(Q)$(MAKE) $(build)=Documentation -f $(srctree)/Documentation/Makefile.sphinx $@ + else # KBUILD_EXTMOD ###
Signature · 1 line
2.7.4
PATCH 3/3 doc-rst: remove a bogus comment from Documentation/index.rst
In reply to Mauro Carvalho ChehabThere's a bogus document at the documentation index saying that there was nothing there, likely a left-over from the initial Sphinx patches. Get rid of it!
--- Documentation/index.rst | 2 -- 1 file changed, 2 deletions(-)
Documentation/index.rst +0 -2
@@ -6,8 +6,6 @@ Welcome to The Linux Kernel's documentation! ============================================ -Nothing for you to see here *yet*. Please move along. - Contents: .. toctree::
Signature · 1 line
2.7.4
Am 06.08.2016 um 14:00 schrieb Mauro Carvalho Chehab <[email protected]>:
Quoted 10 lines
Being able to build just the media docs is important for us due to several reasons:
1) Media developers community hosts a copy of the media documentation at linuxtv.org with the very latest under development documents;
2) Nitpicking to identify broken references is important to identify documentation gaps that need to be addressed on future releases;
3) As media maintainers check patch per patch if a documentation gap is introduced,
Take into account: the gap is detected by "open references" (from the reST-header files), but Sphinx tries to bind a ":ref:" to any anchor which fits (no matter where it comes from). I mean, if we add more and more content or e.g. interpshinx objects, we did not know which targets are available and the risk to get a *false bind* grows with the content.
I don't know, may be in some future you will come into trouble, when you want to refer targets outside of the ./media folder and *detect gaps* in the docs.
This need not be a problem, but you should be aware of, that your "test" is only a test on open/closed links.
Quoted 19 lines
building
media documentation should be as fast as possible.This patchset adds a media file adding nitpick support and an extra build target that will compile only the media documentation. It also groups all media documentation into one section on the main Kernel document, with is, IMHO, a good thing as we start adding more stuff there.
Jon,
I'd love to see this patch merged early at the -rc cycle, in order to avoid merge conflicts when people start converting other docbooks to Sphinx, as it touches at the main
Makefileand at the Sphinx common stuff. Also, as I'll need to patch my build scripts to check for documentation issues with Sphinx, I need them on my master branch, as otherwise my workflow will be broken until the next Kernel release.So, If you're ok with this patch series, can you submit to Linus on early -rc? Or if you prefer, I can do it myself, with your ack.
Quoted 7 lines
Thanks!
MauroPS.: I would prefer to have a more generic way to add support to build documentation for only one subsystem, but, as we also need to load an extra python module to be able to enable nitpick mode, I opted, for now, on not doing it too generic. We can rework on it later, as other subsystems would need a similar feature.
Within my POC I called it "books", may it is better to call them "sphinx-projects", but for the first and the concept it should good enough to stay with "books" / see Makefile.reST [1] ::
# Sphinx projects, we call them *books* which is more common to authors. BOOKS_FOLDER = $(obj)/Documentation
BOOKS=$(filter-out books/intro, \
$(patsubst $(BOOKS_FOLDER)/%/conf.py,books/%,$(wildcard $(BOOKS_FOLDER)/*/conf.py)) \
)# fine grained targets BOOKS_HTML = $(patsubst %,%.html, $(BOOKS)) BOOKS_CLEAN = $(patsubst %,%.clean, $(BOOKS)) BOOKS_MAN = $(patsubst %,%.man, $(BOOKS)) BOOKS_PDF = $(patsubst %,%.pdf, $(BOOKS))
[1] https://github.com/return42/sphkerneldoc/blob/master/doc/Makefile#L40
In words: A "book" (or sphinx-project) is a folder with a conf.py in and the "folder-name" is the name of the related target ::
Documentation/*/conf.py
And the selective targets are
make books/[media|...].[html|man|pdf|clean|...]
By example, build only the html of media::
make books/media.html
The integration into the main Makefile is generic by adding the wildcard target "books%"
modified Makefile
@@ -478,7 +478,7 @@ version_h := include/generated/uapi/linux/version.h
old_version_h := include/linux/version.h
no-dot-config-targets := clean mrproper distclean \
- cscope gtags TAGS tags help% %docs check% coccicheck \
+ cscope gtags TAGS tags help% %docs books% check% coccicheck \
$(version_h) headers_% archheaders archscripts \
kernelversion %src-pkg
+# more fine grained documentation targets
+books/%:
+ $(Q)$(MAKE) $(build)=Documentation -f Documentation/Makefile.reST $@
+
If you are interested in, I prepare a patch series for the Makefiles and the conf.py. Any suggestions about the prefix "books"? ... I preferred "books" over "sphinx-project" or similar, because it is pregnant and short (less to type).
-- Markus --
Quoted 29 lines
Markus Heiser (1):
doc-rst: support additional Sphinx build config overrideMauro Carvalho Chehab (2):
doc-rst: add an option to build media documentation in nitpick mode
doc-rst: remove a bogus comment fromDocumentation/index.rstDocumentation/Makefile.sphinx | 10 ++++- Documentation/conf.py | 9 ++++ Documentation/index.rst | 7 +-- Documentation/media/conf_nitpick.py | 85 +++++++++++++++++++++++++++++++++++++ Documentation/media/index.rst | 12 ++++++ Documentation/sphinx/load_config.py | 25 +++++++++++ Makefile | 6 +++ 7 files changed, 146 insertions(+), 8 deletions(-)create mode 100644
Documentation/media/conf_nitpick.pycreate mode 100644Documentation/media/index.rstcreate mode 100644Documentation/sphinx/load_config.pySignature · 7 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Em Sun, 7 Aug 2016 11:55:27 +0200
Markus Heiser <[email protected]> escreveu:
Quoted 21 lines
Am 06.08.2016 um 14:00 schrieb Mauro Carvalho Chehab <[email protected]>:
Quoted 10 lines
Being able to build just the media docs is important for us due to several reasons:
1) Media developers community hosts a copy of the media documentation at linuxtv.org with the very latest under development documents;
2) Nitpicking to identify broken references is important to identify documentation gaps that need to be addressed on future releases;
3) As media maintainers check patch per patch if a documentation gap is introduced,
Take into account: the gap is detected by "open references" (from the reST-header files), but Sphinx tries to bind a ":ref:" to any anchor which fits (no matter where it comes from). I mean, if we add more and more content or e.g. interpshinx objects, we did not know which targets are available and the risk to get a *false bind* grows with the content.
Quoted 5 lines
I don't know, may be in some future you will come into trouble, when you want to refer targets outside of the ./media folder and *detect gaps* in the docs.
This need not be a problem, but you should be aware of, that your "test" is only a test on open/closed links.
Yeah, we'll still have some references outside the media system. There are already a few of them at the kABI books, and to get mistakes there, we'll need to use nitpick mode for the entire stuff, with can be a nightmare, specially since right now we have 300+ missing references just inside the media books. We need to address those first, before being able to address the external ones.
Quoted 27 lines
Quoted 19 lines
building
media documentation should be as fast as possible.This patchset adds a media file adding nitpick support and an extra build target that will compile only the media documentation. It also groups all media documentation into one section on the main Kernel document, with is, IMHO, a good thing as we start adding more stuff there.
Jon,
I'd love to see this patch merged early at the -rc cycle, in order to avoid merge conflicts when people start converting other docbooks to Sphinx, as it touches at the main
Makefileand at the Sphinx common stuff. Also, as I'll need to patch my build scripts to check for documentation issues with Sphinx, I need them on my master branch, as otherwise my workflow will be broken until the next Kernel release.So, If you're ok with this patch series, can you submit to Linus on early -rc? Or if you prefer, I can do it myself, with your ack.
Quoted 7 lines
Thanks!
MauroPS.: I would prefer to have a more generic way to add support to build documentation for only one subsystem, but, as we also need to load an extra python module to be able to enable nitpick mode, I opted, for now, on not doing it too generic. We can rework on it later, as other subsystems would need a similar feature.
Quoted 5 lines
Within my POC I called it "books", may it is better to call them "sphinx-projects", but for the first and the concept it should good enough to stay with "books" / see Makefile.reST [1] ::
# Sphinx projects, we call them *books* which is more common to authors.
The nomenclature can be very confusing, specially when we're grouping different documents altogether.
The way I see, at the media subsystem, there are 4 books:
- uAPI - with has internally 5 parts;
- kAPI;
- V4L drivers;
- DVB drivers.
Yet, IMHO, the best is to put one master index.rst pointing to all of them, so we actually have a media "book set", and just one "override" conf.py for all of them. So, for now, I guess it is OK to group them altogether when checking for references, although in reality, at least in the first moment, I'm only interested on fixing bad references at the uAPI and kAPI books. The other two books have lots of legacy stuff that needs to be updated before even looking into any bad references there.
Yet, at the makefile, I don't mind calling the book set as "BOOK".
Quoted 45 lines
BOOKS_FOLDER= $(obj)/DocumentationBOOKS=$(filter-out books/intro, \ $(patsubst $(BOOKS_FOLDER)/%/conf.py,books/%,$(wildcard $(BOOKS_FOLDER)/*/conf.py)) \ )# fine grained targets BOOKS_HTML = $(patsubst %,%.html, $(BOOKS)) BOOKS_CLEAN = $(patsubst %,%.clean, $(BOOKS)) BOOKS_MAN = $(patsubst %,%.man, $(BOOKS)) BOOKS_PDF = $(patsubst %,%.pdf, $(BOOKS))[1] https://github.com/return42/sphkerneldoc/blob/master/doc/Makefile#L40
In words: A "book" (or sphinx-project) is a folder with a
conf.pyin and the "folder-name" is the name of the related target ::
Documentation/*/conf.pyAnd the selective targets are
make books/[media|...].[html|man|pdf|clean|...]
By example, build only the html of media::
make books/media.html
The integration into the main
Makefileis generic by adding the wildcard target "books%"modified
Makefile(quoted diff) +5
-1@@ -478,7 +478,7 @@ version_h := include/generated/uapi/linux/version.h old_version_h := include/linux/version.h no-dot-config-targets := clean mrproper distclean \ - cscope gtags TAGS tags help% %docs check% coccicheck \ + cscope gtags TAGS tags help% %docs books% check% coccicheck \ $(version_h) headers_% archheaders archscripts \ kernelversion %src-pkg +# more fine grained documentation targets +books/%: + $(Q)$(MAKE) $(build)=Documentation -f Documentation/Makefile.reST $@ +
Quoted 2 lines
If you are interested in, I prepare a patch series for the Makefiles and the
conf.py.
Interesting approach. That would work for me. Not sure what the others think about that.
Yet, my understanding is that we should have just one conf.py for the "all-in-one" book (e. g. Documentation/index.rst), plus additional ones to be used where we want to build standalone books with nitpick mode enabled.
So, we should keep having the
make htmldocs
target that would build the all-in-one book, plus some other way to build those books that would have a conf.py that would be adding the extra nitpick options.
I really don't mind if we'll be compiling those with:
make books/media.html
or with something like:
make SPHINXDIRS="./media" htmldocs
Actually, the last syntax is better, IMHO, because people are already familiar with something similar to that.
Provided that it would work and the patch would be simple enough to be added on an early -rc Kernel (or alternatively, if it can be sent via my master devel branch with Jon's ack).
Quoted 35 lines
Any suggestions about the prefix "books"? ... I preferred "books" over "sphinx-project" or similar, because it is pregnant and short (less to type).
-- Markus --
Quoted 29 lines
Markus Heiser (1):
doc-rst: support additional Sphinx build config overrideMauro Carvalho Chehab (2):
doc-rst: add an option to build media documentation in nitpick mode
doc-rst: remove a bogus comment fromDocumentation/index.rstDocumentation/Makefile.sphinx | 10 ++++- Documentation/conf.py | 9 ++++ Documentation/index.rst | 7 +-- Documentation/media/conf_nitpick.py | 85 +++++++++++++++++++++++++++++++++++++ Documentation/media/index.rst | 12 ++++++ Documentation/sphinx/load_config.py | 25 +++++++++++ Makefile | 6 +++ 7 files changed, 146 insertions(+), 8 deletions(-)create mode 100644
Documentation/media/conf_nitpick.pycreate mode 100644Documentation/media/index.rstcreate mode 100644Documentation/sphinx/load_config.pySignature · 7 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks,
Mauro
Am 07.08.2016 um 14:38 schrieb Mauro Carvalho Chehab <[email protected]>:
Quoted 159 lines
Em Sun, 7 Aug 2016 11:55:27 +0200
Markus Heiser <[email protected]> escreveu:Quoted 21 lines
Am 06.08.2016 um 14:00 schrieb Mauro Carvalho Chehab <[email protected]>:
Quoted 10 lines
Being able to build just the media docs is important for us due to several reasons:
1) Media developers community hosts a copy of the media documentation at linuxtv.org with the very latest under development documents;
2) Nitpicking to identify broken references is important to identify documentation gaps that need to be addressed on future releases;
3) As media maintainers check patch per patch if a documentation gap is introduced,
Take into account: the gap is detected by "open references" (from the reST-header files), but Sphinx tries to bind a ":ref:" to any anchor which fits (no matter where it comes from). I mean, if we add more and more content or e.g. interpshinx objects, we did not know which targets are available and the risk to get a *false bind* grows with the content.
Quoted 5 lines
I don't know, may be in some future you will come into trouble, when you want to refer targets outside of the ./media folder and *detect gaps* in the docs.
This need not be a problem, but you should be aware of, that your "test" is only a test on open/closed links.
Yeah, we'll still have some references outside the media system. There are already a few of them at the kABI books, and to get mistakes there, we'll need to use nitpick mode for the entire stuff, with can be a nightmare, specially since right now we have 300+ missing references just inside the media books. We need to address those first, before being able to address the external ones.
Quoted 27 lines
Quoted 19 lines
building
media documentation should be as fast as possible.This patchset adds a media file adding nitpick support and an extra build target that will compile only the media documentation. It also groups all media documentation into one section on the main Kernel document, with is, IMHO, a good thing as we start adding more stuff there.
Jon,
I'd love to see this patch merged early at the -rc cycle, in order to avoid merge conflicts when people start converting other docbooks to Sphinx, as it touches at the main
Makefileand at the Sphinx common stuff. Also, as I'll need to patch my build scripts to check for documentation issues with Sphinx, I need them on my master branch, as otherwise my workflow will be broken until the next Kernel release.So, If you're ok with this patch series, can you submit to Linus on early -rc? Or if you prefer, I can do it myself, with your ack.
Quoted 7 lines
Thanks!
MauroPS.: I would prefer to have a more generic way to add support to build documentation for only one subsystem, but, as we also need to load an extra python module to be able to enable nitpick mode, I opted, for now, on not doing it too generic. We can rework on it later, as other subsystems would need a similar feature.
Quoted 5 lines
Within my POC I called it "books", may it is better to call them "sphinx-projects", but for the first and the concept it should good enough to stay with "books" / see Makefile.reST [1] ::
# Sphinx projects, we call them *books* which is more common to authors.
The nomenclature can be very confusing, specially when we're grouping different documents altogether.
The way I see, at the media subsystem, there are 4 books:
- uAPI - with has internally 5 parts;
- kAPI;
- V4L drivers;
- DVB drivers.Yet, IMHO, the best is to put one master
index.rstpointing to all of them, so we actually have a media "book set", and just one "override"conf.pyfor all of them. So, for now, I guess it is OK to group them altogether when checking for references, although in reality, at least in the first moment, I'm only interested on fixing bad references at the uAPI and kAPI books. The other two books have lots of legacy stuff that needs to be updated before even looking into any bad references there.Yet, at the makefile, I don't mind calling the book set as "BOOK".
Quoted 45 lines
BOOKS_FOLDER= $(obj)/DocumentationBOOKS=$(filter-out books/intro, \ $(patsubst $(BOOKS_FOLDER)/%/conf.py,books/%,$(wildcard $(BOOKS_FOLDER)/*/conf.py)) \ )# fine grained targets BOOKS_HTML = $(patsubst %,%.html, $(BOOKS)) BOOKS_CLEAN = $(patsubst %,%.clean, $(BOOKS)) BOOKS_MAN = $(patsubst %,%.man, $(BOOKS)) BOOKS_PDF = $(patsubst %,%.pdf, $(BOOKS))[1] https://github.com/return42/sphkerneldoc/blob/master/doc/Makefile#L40
In words: A "book" (or sphinx-project) is a folder with a
conf.pyin and the "folder-name" is the name of the related target ::
Documentation/*/conf.pyAnd the selective targets are
make books/[media|...].[html|man|pdf|clean|...]
By example, build only the html of media::
make books/media.html
The integration into the main
Makefileis generic by adding the wildcard target "books%"modified
Makefile(quoted diff) +0
-0@@ -478,7 +478,7 @@ version_h := include/generated/uapi/linux/version.h
old_version_h:=include/linux/version.hno-dot-config-targets := clean mrproper distclean \
(quoted diff) +1
-1- cscope gtags TAGS tags help% %docs check% coccicheck \ + cscope gtags TAGS tags help% %docs books% check% coccicheck \$(version_h) headers_% archheaders archscripts \ kernelversion %src-pkg(quoted diff) +4
-0+# more fine grained documentation targets +books/%: + $(Q)$(MAKE) $(build)=Documentation -f Documentation/Makefile.reST $@ +Quoted 2 lines
If you are interested in, I prepare a patch series for the Makefiles and the
conf.py.Interesting approach. That would work for me. Not sure what the others think about that.
Yet, my understanding is that we should have just one
conf.pyfor the "all-in-one" book (e. g.Documentation/index.rst), plus additional ones to be used where we want to build standalone books with nitpick mode enabled.So, we should keep having the
make htmldocstarget that would build the all-in-one book, plus some other way to build those books that would have a
conf.pythat would be adding the extra nitpick options.I really don't mind if we'll be compiling those with:
make books/media.htmlor with something like:
make SPHINXDIRS="./media" htmldocs
Quoted 6 lines
Actually, the last syntax is better, IMHO, because people are already familiar with something similar to that.
Provided that it would work and the patch would be simple enough to be added on an early -rc Kernel (or alternatively, if it can be sent via my master devel branch with Jon's ack).
Hi Mauro,
I agree with all, nevertheless I think, building a partial product should be a make target. Anyway, I prepare a patch (with SPHINXDIRS="./media") on top of your patch series.
-- Markus --