chiark / gitweb /
man: clearify the meaning of timeout=0 for password agents
[elogind.git] / make-directive-index.py
index eaf7019a2b343efdcbb1d86ebc61300a604ac3fd..48d830e96f01ea7123b33cb8896c98ded909962f 100755 (executable)
@@ -40,7 +40,7 @@ TEMPLATE = '''\
 
         <refmeta>
                 <refentrytitle>systemd.directives</refentrytitle>
-                <manvolnum>5</manvolnum>
+                <manvolnum>7</manvolnum>
         </refmeta>
 
         <refnamediv>
@@ -66,6 +66,23 @@ TEMPLATE = '''\
                 <variablelist id='systemd-directives' />
         </refsect1>
 
+        <refsect1>
+                <title>Options on the kernel command line</title>
+
+                <para>Kernel boot options for configuring the behaviour of the
+                systemd process.</para>
+
+                <variablelist id='kernel-commandline-directives' />
+        </refsect1>
+
+        <refsect1>
+                <title>Environment variables</title>
+
+                <para>Environment variables understood by the systemd process.</para>
+
+                <variablelist id='environment-variables' />
+        </refsect1>
+
         <refsect1>
                 <title>UDEV directives</title>
 
@@ -83,9 +100,28 @@ TEMPLATE = '''\
 
                 <variablelist id='journal-directives' />
         </refsect1>
+
+        <refsect1>
+                <title>bootchart.conf directives</title>
+
+                <para>Directives for configuring the behaviour of the
+                systemd-bootchart process.</para>
+
+                <variablelist id='bootchart-directives' />
+        </refsect1>
+
+        <refsect1>
+                <title>Colophon</title>
+                <para id='colophon' />
+        </refsect1>
 </refentry>
 '''
 
+COLOPHON = '''\
+This index contains {count} entries in {sections} sections,
+referring to {pages} individual manual pages.
+'''
+
 def _extract_directives(directive_groups, page):
     t = tree.parse(page)
     section = t.find('./refmeta/manvolnum').text
@@ -97,8 +133,8 @@ def _extract_directives(directive_groups, page):
             text = ''.join(varname.text.partition('=')[:2])
             stor[text].append((pagename, section))
 
-def _make_section(refentry, name, directives):
-    varlist = refentry.find(".//*[@id='{}']".format(name))
+def _make_section(template, name, directives):
+    varlist = template.find(".//*[@id='{}']".format(name))
     for varname, manpages in sorted(directives.items()):
         entry = tree.SubElement(varlist, 'varlistentry')
         a = tree.SubElement(tree.SubElement(entry, 'term'), 'varname')
@@ -116,7 +152,20 @@ def _make_section(refentry, name, directives):
                 d.text = manvolume
         entry.tail = '\n\n'
 
-def _make_page(directive_groups):
+def _make_colophon(template, groups):
+    count = 0
+    pages = set()
+    for group in groups:
+        count += len(group)
+        for pagelist in group.values():
+            pages |= set(pagelist)
+
+    para = template.find(".//para[@id='colophon']")
+    para.text = COLOPHON.format(count=count,
+                                sections=len(groups),
+                                pages=len(pages))
+
+def _make_page(template, directive_groups):
     """Create an XML tree from directive_groups.
 
     directive_groups = {
@@ -125,25 +174,23 @@ def _make_page(directive_groups):
        ...
     }
     """
-    refentry = tree.fromstring(TEMPLATE)
-
     for name, directives in directive_groups.items():
-            _make_section(refentry, name, directives)
+            _make_section(template, name, directives)
+
+    _make_colophon(template, directive_groups.values())
 
-    return refentry
+    return template
 
 def make_page(xml_files):
     "Extract directives from xml_files and return XML index tree."
+    template = tree.fromstring(TEMPLATE)
+    names = [vl.get('id') for vl in template.iterfind('.//variablelist')]
     directive_groups = {name:collections.defaultdict(list)
-                        for name in ['unit-directives',
-                                     'udev-directives',
-                                     'systemd-directives',
-                                     'journal-directives',
-                                     ]}
+                        for name in names}
     for page in xml_files:
         _extract_directives(directive_groups, page)
 
-    return _make_page(directive_groups)
+    return _make_page(template, directive_groups)
 
 if __name__ == '__main__':
     tree.dump(make_page(sys.argv[1:]))