From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Donald Hunter <donald.hunter@gmail.com>
Cc: Linux Doc Mailing List <linux-doc@vger.kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Akira Yokosawa" <akiyks@gmail.com>,
"Breno Leitao" <leitao@debian.org>,
"David S. Miller" <davem@davemloft.net>,
"Ignacio Encinas Rubio" <ignacio@iencinas.com>,
"Marco Elver" <elver@google.com>,
"Shuah Khan" <skhan@linuxfoundation.org>,
Eric Dumazet <edumazet@google.com>,
Jan Stancek <jstancek@redhat.com>,
Paolo Abeni <pabeni@redhat.com>,
Ruben Wauters <rubenru09@aol.com>,
joel@joelfernandes.org, linux-kernel-mentees@lists.linux.dev,
linux-kernel@vger.kernel.org, lkmm@lists.linux.dev,
netdev@vger.kernel.org, peterz@infradead.org,
stern@rowland.harvard.edu
Subject: Re: [PATCH 4/4] docs: netlink: store generated .rst files at Documentation/output
Date: Wed, 11 Jun 2025 18:10:56 +0200 [thread overview]
Message-ID: <20250611181056.6543e71e@sal.lan> (raw)
In-Reply-To: <m24iwmpl0m.fsf@gmail.com>
Em Wed, 11 Jun 2025 12:36:57 +0100
Donald Hunter <donald.hunter@gmail.com> escreveu:
> Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes:
>
> > It is not a good practice to store build-generated files
> > inside $(srctree), as one may be using O=<BUILDDIR> and even
> > have the Kernel on a read-only directory.
> >
> > Change the YAML generation for netlink files to be inside
> > the documentation output directory.
> >
> > This solution is not perfect, though, as sphinx-build only produces
> > html files only for files inside the source tree. As it is desired
> > to have one netlink file per family, it means that one template
> > file is required for every file inside Documentation/netlink/specs.
> > Such template files are simple enough. All they need is:
> >
> > # Template for Documentation/netlink/specs/<foo>.yaml
> > .. kernel-include:: $BUILDDIR/networking/netlink_spec/<foo>.rst
>
> I am not a fan of this approach because it pollutes the
> Documentation/output dir with source files and the kernel-include
> directive is a bit of a hacky workaround.
>
> > A better long term solution is to have an extension at
> > Documentation/sphinx that parses *.yaml files for netlink files,
> > which could internally be calling ynl_gen_rst.py. Yet, some care
> > needs to be taken, as yaml extensions are also used inside device
> > tree.
>
> The extension does seem like a better approach, but as mentioned by
> Jakub, we'd want to add stub creation to the YNL regen.
>
> The only other approach I can think of to avoid generating files in the
> source tree or polluting the Documentation/output dir is to stage all of
> the Documentation/ tree into BUILDDIR before adding generated files
> there, then running:
>
> sphinx-build BUILDDIR/Documentation BUILDDIR/Documentation/output
I did some tests here adding yaml to conf.py:
-source_suffix = '.rst'
+source_suffix = ['.rst', '.yaml']
Such change made the extension to automatically generate one file per
each existing yaml without the need of adding any template. I tested on
a brand new tree with just Sphinx + netlink files + Breno's original
extension (untouched). Such empty tree was generated with
sphinx-quickstart (sent a reply to Breno with a patch with all inside
it).
When applying it to the Kernel, we can do this change at
Documentation/conf.py, together with:
-exclude_patterns = ['output']
+exclude_patterns = ['output', 'devicetree/bindings/**.yaml']
(glob pattern not tested)
As we don't want DT yaml files to be processed as netlink families.
After such tests, it sounds to me that the Sphinx extension approach
may work without requiring templates. Tested here with Sphinx 8.1.3.
Regards,
Mauro
prev parent reply other threads:[~2025-06-11 16:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-10 10:46 [PATCH 0/4] Don't generate netlink .rst files inside $(srctree) Mauro Carvalho Chehab
2025-06-10 10:46 ` [PATCH 1/4] tools: ynl_gen_rst.py: create a top-level reference Mauro Carvalho Chehab
2025-06-10 10:46 ` [PATCH 2/4] docs: netlink: netlink-raw.rst: use :ref: instead of :doc: Mauro Carvalho Chehab
2025-06-10 10:46 ` [PATCH 3/4] docs: netlink: don't ignore generated rst files Mauro Carvalho Chehab
2025-06-11 10:44 ` Donald Hunter
2025-06-10 10:46 ` [PATCH 4/4] docs: netlink: store generated .rst files at Documentation/output Mauro Carvalho Chehab
2025-06-10 15:43 ` Breno Leitao
2025-06-10 20:59 ` Mauro Carvalho Chehab
2025-06-10 21:07 ` Jakub Kicinski
2025-06-12 14:39 ` Mauro Carvalho Chehab
2025-06-11 15:45 ` Mauro Carvalho Chehab
2025-06-11 15:55 ` Breno Leitao
2025-06-12 10:22 ` Mauro Carvalho Chehab
2025-06-11 11:36 ` Donald Hunter
2025-06-11 16:10 ` Mauro Carvalho Chehab [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250611181056.6543e71e@sal.lan \
--to=mchehab+huawei@kernel.org \
--cc=akiyks@gmail.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=elver@google.com \
--cc=ignacio@iencinas.com \
--cc=joel@joelfernandes.org \
--cc=jstancek@redhat.com \
--cc=leitao@debian.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=lkmm@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peterz@infradead.org \
--cc=rubenru09@aol.com \
--cc=skhan@linuxfoundation.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).