diff options
author | Štěpán Němec <stepnem@smrk.net> | 2024-11-11 20:10:00 +0100 |
---|---|---|
committer | Štěpán Němec <stepnem@smrk.net> | 2024-11-11 20:31:08 +0100 |
commit | 597c6cc1195a986e8f89921aa89505b0eacf8181 (patch) | |
tree | 050bb5c7ff42d8b918c01b7109449b6912c50e62 /man/systemd.v.xml | |
parent | network: forget IPv4 non-local routes when an interface went down (#35099) (diff) | |
download | systemd-597c6cc1195a986e8f89921aa89505b0eacf8181.tar.xz systemd-597c6cc1195a986e8f89921aa89505b0eacf8181.zip |
man: fix incorrect volume numbers in internal man page references
Some ambiguity (e.g., same-named man pages in multiple volumes)
makes it impossible to fully automate this, but the following
Python snippet (run inside the man/ directory of the systemd repo)
helped to generate the sed command lines (which were subsequently
manually reviewed, run and the false positives reverted):
from pathlib import Path
import lxml
from lxml import etree as ET
man2vol: dict[str, str] = {}
man2citerefs: dict[str, list] = {}
for file in Path(".").glob("*.xml"):
tree = ET.parse(file, lxml.etree.XMLParser(recover=True))
meta = tree.find("refmeta")
if meta is not None:
title = meta.findtext("refentrytitle")
if title is not None:
vol = meta.findtext("manvolnum")
if vol is not None:
man2vol[title] = vol
citerefs = list(tree.iter("citerefentry"))
if citerefs:
man2citerefs[title] = citerefs
for man, refs in man2citerefs.items():
for ref in refs:
title = ref.findtext("refentrytitle")
if title is not None:
has = ref.findtext("manvolnum")
try:
should_have = man2vol[title]
except KeyError: # Non-systemd man page reference? Ignore.
continue
if has != should_have:
print(
f"sed -i '\\|<citerefentry><refentrytitle>{title}"
f"</refentrytitle><manvolnum>{has}</manvolnum>"
f"</citerefentry>|s|<manvolnum>{has}</manvolnum>|"
f"<manvolnum>{should_have}</manvolnum>|' {man}.xml"
)
Diffstat (limited to 'man/systemd.v.xml')
-rw-r--r-- | man/systemd.v.xml | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/man/systemd.v.xml b/man/systemd.v.xml index 43e77bdba2..a340d1e4b7 100644 --- a/man/systemd.v.xml +++ b/man/systemd.v.xml @@ -156,7 +156,7 @@ <member><citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> <member><citerefentry><refentrytitle>systemd-dissect</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> <member><citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>systemd-sysupdate</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> + <member><citerefentry><refentrytitle>systemd-sysupdate</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> </simplelist></para> </refsect1> |