linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/12] Don't generate netlink .rst files inside $(srctree)
@ 2025-06-12 10:31 Mauro Carvalho Chehab
  2025-06-12 10:31 ` [PATCH v2 01/12] tools: ynl_gen_rst.py: create a top-level reference Mauro Carvalho Chehab
                   ` (12 more replies)
  0 siblings, 13 replies; 32+ messages in thread
From: Mauro Carvalho Chehab @ 2025-06-12 10:31 UTC (permalink / raw)
  To: Linux Doc Mailing List, Jonathan Corbet
  Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, linux-kernel,
	Akira Yokosawa, David S. Miller, Ignacio Encinas Rubio,
	Marco Elver, Shuah Khan, Donald Hunter, Eric Dumazet, Jan Stancek,
	Paolo Abeni, Ruben Wauters, joel, linux-kernel-mentees, lkmm,
	netdev, peterz, stern, Breno Leitao, Jakub Kicinski, Simon Horman

As discussed at:
   https://lore.kernel.org/all/20250610101331.62ba466f@foz.lan/

changeset f061c9f7d058 ("Documentation: Document each netlink family")
added a logic which generates *.rst files inside $(srctree). This is bad when
O=<BUILDDIR> is used.

A recent change renamed the yaml files used by Netlink, revealing a bad
side effect: as "make cleandocs" don't clean the produced files, symbols 
appear duplicated for people that don't build the kernel from scratch.

There are some possible solutions for that. The simplest one, which is what
this series address, places the build files inside Documentation/output. 
The changes to do that are simple enough, but has one drawback,
as it requires a (simple) template file for every netlink family file from
netlink/specs. The template is simple enough:

        .. kernel-include:: $BUILDDIR/networking/netlink_spec/<family>.rst

Part of the issue is that sphinx-build only produces html files for sources
inside the source tree (Documentation/). 

To address that, add an yaml parser extension to Sphinx.

It should be noticed that this version has one drawback: it increases the
documentation build time. I suspect that the culprit is inside Sphinx
glob logic and the way it handles exclude_patterns. What happens is that
sphinx/project.py uses glob, which, on my own experiences, it is slow
(due to that, I ended implementing my own glob logic for kernel-doc).

On the plus side, the extension is flexible enough to handle other types
of yaml files, as the actual yaml conversion logic is outside the extension.

With this version, there's no need to add any template file per netlink/spec
file. Yet, the Documentation/netlink/spec.index.rst require updates as
spec files are added/renamed/removed. The already-existing script can
handle it automatically by running:

            tools/net/ynl/pyynl/ynl_gen_rst.py -x  -v -o Documentation/netlink/specs/index.rst

---

v2:
- Use a Sphinx extension to handle netlink files.

v1:
- Statically add template files to as networking/netlink_spec/<family>.rst

Mauro Carvalho Chehab (12):
  tools: ynl_gen_rst.py: create a top-level reference
  docs: netlink: netlink-raw.rst: use :ref: instead of :doc:
  docs: netlink: don't ignore generated rst files
  tools: ynl_gen_rst.py: make the index parser more generic
  tools: ynl_gen_rst.py: Split library from command line tool
  scripts: lib: netlink_yml_parser.py: use classes
  tools: ynl_gen_rst.py: do some coding style cleanups
  scripts: netlink_yml_parser.py: improve index.rst generation
  docs: sphinx: add a parser template for yaml files
  docs: sphinx: parser_yaml.py: add Netlink specs parser
  docs: use parser_yaml extension to handle Netlink specs
  docs: conf.py: don't handle yaml files outside Netlink specs

 .pylintrc                                     |   2 +-
 Documentation/Makefile                        |  17 -
 Documentation/conf.py                         |  17 +-
 Documentation/netlink/specs/index.rst         |  38 ++
 Documentation/networking/index.rst            |   2 +-
 .../networking/netlink_spec/.gitignore        |   1 -
 .../networking/netlink_spec/readme.txt        |   4 -
 Documentation/sphinx/parser_yaml.py           |  80 ++++
 .../userspace-api/netlink/netlink-raw.rst     |   6 +-
 scripts/lib/netlink_yml_parser.py             | 394 ++++++++++++++++++
 tools/net/ynl/pyynl/ynl_gen_rst.py            | 378 +----------------
 11 files changed, 544 insertions(+), 395 deletions(-)
 create mode 100644 Documentation/netlink/specs/index.rst
 delete mode 100644 Documentation/networking/netlink_spec/.gitignore
 delete mode 100644 Documentation/networking/netlink_spec/readme.txt
 create mode 100755 Documentation/sphinx/parser_yaml.py
 create mode 100755 scripts/lib/netlink_yml_parser.py

-- 
2.49.0



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

end of thread, other threads:[~2025-06-14 15:01 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12 10:31 [PATCH v2 00/12] Don't generate netlink .rst files inside $(srctree) Mauro Carvalho Chehab
2025-06-12 10:31 ` [PATCH v2 01/12] tools: ynl_gen_rst.py: create a top-level reference Mauro Carvalho Chehab
2025-06-12 10:31 ` [PATCH v2 02/12] docs: netlink: netlink-raw.rst: use :ref: instead of :doc: Mauro Carvalho Chehab
2025-06-12 10:31 ` [PATCH v2 03/12] docs: netlink: don't ignore generated rst files Mauro Carvalho Chehab
2025-06-12 10:31 ` [PATCH v2 04/12] tools: ynl_gen_rst.py: make the index parser more generic Mauro Carvalho Chehab
2025-06-12 10:31 ` [PATCH v2 05/12] tools: ynl_gen_rst.py: Split library from command line tool Mauro Carvalho Chehab
2025-06-13 11:13   ` Donald Hunter
2025-06-13 12:17     ` Mauro Carvalho Chehab
2025-06-14 13:34       ` Donald Hunter
2025-06-14 15:01         ` Mauro Carvalho Chehab
2025-06-12 10:31 ` [PATCH v2 06/12] scripts: lib: netlink_yml_parser.py: use classes Mauro Carvalho Chehab
2025-06-13 11:20   ` Donald Hunter
2025-06-13 12:40     ` Mauro Carvalho Chehab
2025-06-13 12:53       ` Donald Hunter
2025-06-12 10:31 ` [PATCH v2 07/12] tools: ynl_gen_rst.py: do some coding style cleanups Mauro Carvalho Chehab
2025-06-12 10:32 ` [PATCH v2 08/12] scripts: netlink_yml_parser.py: improve index.rst generation Mauro Carvalho Chehab
2025-06-12 10:32 ` [PATCH v2 09/12] docs: sphinx: add a parser template for yaml files Mauro Carvalho Chehab
2025-06-13 11:29   ` Donald Hunter
2025-06-13 12:26     ` Mauro Carvalho Chehab
2025-06-13 15:42       ` Mauro Carvalho Chehab
2025-06-12 10:32 ` [PATCH v2 10/12] docs: sphinx: parser_yaml.py: add Netlink specs parser Mauro Carvalho Chehab
2025-06-13 11:45   ` Donald Hunter
2025-06-13 12:27     ` Mauro Carvalho Chehab
2025-06-12 10:32 ` [PATCH v2 11/12] docs: use parser_yaml extension to handle Netlink specs Mauro Carvalho Chehab
2025-06-13 11:50   ` Donald Hunter
2025-06-13 12:29     ` Mauro Carvalho Chehab
2025-06-12 10:32 ` [PATCH v2 12/12] docs: conf.py: don't handle yaml files outside " Mauro Carvalho Chehab
2025-06-13 11:52   ` Donald Hunter
2025-06-13 12:30     ` Mauro Carvalho Chehab
2025-06-13 11:05 ` [PATCH v2 00/12] Don't generate netlink .rst files inside $(srctree) Donald Hunter
2025-06-13 12:13   ` Mauro Carvalho Chehab
2025-06-14 13:29     ` Donald Hunter

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).