From: Zbigniew Jędrzejewski-Szmek Date: Thu, 7 May 2020 12:31:13 +0000 (+0200) Subject: tools: move directive index template to separate file X-Git-Tag: v246-rc1~414^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=282230882cd0fc49b5377349f2aee22a1c9dd159;p=thirdparty%2Fsystemd.git tools: move directive index template to separate file In the beginning, it was rather short, and reasonable to include inline. Now it is long and unwieldy, let's split it out. While at it, let's reindent and wrap using our current standards. --- diff --git a/man/directives-template.xml b/man/directives-template.xml new file mode 100644 index 00000000000..3583db3ef07 --- /dev/null +++ b/man/directives-template.xml @@ -0,0 +1,182 @@ + + + + + systemd.directives + systemd + + + + systemd.directives + 7 + + + + systemd.directives + Index of configuration directives + + + + Unit directives + + Directives for configuring units, used in unit files. + + + + + + Options on the kernel command line + + Kernel boot options for configuring the behaviour of the systemd process. + + + + + + Environment variables + + Environment variables understood by the systemd manager and other programs and environment + variable-compatible settings. + + + + + + EFI variables + + EFI variables understood by + systemd-boot7 + and other programs. + + + + + + UDEV directives + + Directives for configuring systemd units through the udev database. + + + + + + Network directives + + Directives for configuring network links through the net-setup-link udev builtin and networks + through systemd-networkd. + + + + + + Journal fields + + Fields in the journal events with a well known meaning. + + + + + + PAM configuration directives + + Directives for configuring PAM behaviour. + + + + + + <filename>/etc/crypttab</filename> and + <filename>/etc/fstab</filename> options + + Options which influence mounted filesystems and encrypted volumes. + + + + + + <citerefentry><refentrytitle>systemd.nspawn</refentrytitle><manvolnum>5</manvolnum></citerefentry> + directives + + Directives for configuring systemd-nspawn containers. + + + + + + Program configuration options + + Directives for configuring the behaviour of the systemd process and other tools through + configuration files. + + + + + + Command line options + + Command-line options accepted by programs in the systemd suite. + + + + + + Constants + + Various constant used and/or defined by systemd. + + + + + + Miscellaneous options and directives + + Other configuration elements which don't fit in any of the above groups. + + + + + + Files and directories + + Paths and file names referred to in the documentation. + + + + + + D-Bus interfaces + + Interfaces exposed over D-Bus. + + + + + + D-Bus methods + + Methods exposed in the D-Bus interface. + + + + + + D-Bus properties + + Properties exposed in the D-Bus interface. + + + + + + D-Bus signals + + Signals emitted in the D-Bus interface. + + + + + + Colophon + + + diff --git a/man/meson.build b/man/meson.build index 215b8eeb37c..3a7143a4b6a 100644 --- a/man/meson.build +++ b/man/meson.build @@ -110,9 +110,9 @@ endif systemd_directives_xml = custom_target( 'systemd.directives.xml', - input : source_xml_files, + input : ['directives-template.xml', source_xml_files], output : 'systemd.directives.xml', - command : [make_directive_index_py, '@OUTPUT@'] + source_xml_files) + command : [make_directive_index_py, '@OUTPUT@', '@INPUT@']) nonindex_xml_files = source_xml_files + [systemd_directives_xml] systemd_index_xml = custom_target( diff --git a/tools/make-directive-index.py b/tools/make-directive-index.py index ae00c8cab28..26561a24563 100755 --- a/tools/make-directive-index.py +++ b/tools/make-directive-index.py @@ -7,198 +7,6 @@ import re from xml_helper import xml_parse, xml_print, tree from copy import deepcopy -TEMPLATE = '''\ - - - - systemd.directives - systemd - - - - systemd.directives - 7 - - - - systemd.directives - Index of configuration directives - - - - Unit directives - - Directives for configuring units, used in unit - files. - - - - - - Options on the kernel command line - - Kernel boot options for configuring the behaviour of the - systemd process. - - - - - - Environment variables - - Environment variables understood by the systemd manager - and other programs and environment variable-compatible settings. - - - - - - EFI variables - - EFI variables understood by - systemd-boot7 - and other programs. - - - - - - UDEV directives - - Directives for configuring systemd units through the - udev database. - - - - - - Network directives - - Directives for configuring network links through the - net-setup-link udev builtin and networks through - systemd-networkd. - - - - - - Journal fields - - Fields in the journal events with a well known meaning. - - - - - - PAM configuration directives - - Directives for configuring PAM behaviour. - - - - - - <filename>/etc/crypttab</filename> and - <filename>/etc/fstab</filename> options - - Options which influence mounted filesystems and - encrypted volumes. - - - - - - <citerefentry><refentrytitle>systemd.nspawn</refentrytitle><manvolnum>5</manvolnum></citerefentry> - directives - - Directives for configuring systemd-nspawn containers. - - - - - - Program configuration options - - Directives for configuring the behaviour of the - systemd process and other tools through configuration files. - - - - - - Command line options - - Command-line options accepted by programs in the - systemd suite. - - - - - - Constants - - Various constant used and/or defined by systemd. - - - - - - Miscellaneous options and directives - - Other configuration elements which don't fit in - any of the above groups. - - - - - - Files and directories - - Paths and file names referred to in the - documentation. - - - - - - D-Bus interfaces - - Interfaces exposed over D-Bus. - - - - - - D-Bus methods - - Methods exposed in the D-Bus interface. - - - - - - D-Bus properties - - Properties exposed in the D-Bus interface. - - - - - - D-Bus signals - - Signals emitted in the D-Bus interface. - - - - - - Colophon - - - -''' - COLOPHON = '''\ This index contains {count} entries in {sections} sections, referring to {pages} individual manual pages. @@ -330,9 +138,9 @@ def _make_page(template, directive_groups, formatting): return template -def make_page(*xml_files): +def make_page(template_path, xml_files): "Extract directives from xml_files and return XML index tree." - template = tree.fromstring(TEMPLATE) + template = xml_parse(template_path) names = [vl.get('id') for vl in template.iterfind('.//variablelist')] directive_groups = {name:collections.defaultdict(list) for name in names} @@ -347,4 +155,7 @@ def make_page(*xml_files): if __name__ == '__main__': with open(sys.argv[1], 'wb') as f: - f.write(xml_print(make_page(*sys.argv[2:]))) + template_path = sys.argv[2] + xml_files = sys.argv[3:] + xml = make_page(template_path, xml_files) + f.write(xml_print(xml))