docs: sphinx/kernel_abi: parse ABI files only once

Right now, the logic parses ABI files on 4 steps, one for each
directory. While this is fine in principle, by doing that, not
all symbol cross-references will be created.

Change the logic to do the parsing only once in order to get
a global dictionary to be used when creating ABI cross-references.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/5205c53838b6ea25f4cdd4cc1e3d17c0141e75a6.1739182025.git.mchehab+huawei@kernel.org
This commit is contained in:
Mauro Carvalho Chehab
2025-02-10 11:18:09 +01:00
committed by Jonathan Corbet
parent 98a4324a8b
commit 5d7871d77f
6 changed files with 76 additions and 59 deletions

View File

@@ -266,12 +266,20 @@ class AbiParser:
def parse_readme(self, nametag, fname):
"""Parse ABI README file"""
nametag["what"] = ["ABI file contents"]
nametag["path"] = "README"
with open(fname, "r", encoding="utf8", errors="backslashreplace") as fp:
nametag["description"] = "```\n"
for line in fp:
nametag["description"] += " " + line
match = self.re_tag.match(line)
if match:
new = match.group(1).lower()
nametag["description"] += "```\n"
match = self.re_valid.search(new)
if match:
nametag["description"] += "\n:" + line
continue
nametag["description"] += line
def parse_file(self, fname, path, basename):
"""Parse a single file"""
@@ -459,12 +467,8 @@ class AbiParser:
continue
if filter_path:
if filter_path == "README":
if not names[0].endswith("README"):
continue
else:
if v.get("path") != filter_path:
continue
if v.get("path") != filter_path:
continue
msg = ""