[systemd-commits] 4 commits - make-directive-index.py Makefile.am man/systemd.conf.xml man/systemd.device.xml man/systemd.journal-fields.xml

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Mon Sep 17 03:53:05 PDT 2012


 Makefile.am                    |   31 +++++++++
 make-directive-index.py        |  131 +++++++++++++++++++++++++++++++++++++++++
 man/systemd.conf.xml           |    2 
 man/systemd.device.xml         |    2 
 man/systemd.journal-fields.xml |   68 ++++++++++-----------
 5 files changed, 197 insertions(+), 37 deletions(-)

New commits:
commit f6c2e28b07a0d24c68f7780fc986ac3619fdcbdb
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Fri Aug 10 19:35:43 2012 +0200

    directive-index: journal directives

diff --git a/Makefile.am b/Makefile.am
index 32f08ed..8f42100 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -704,7 +704,8 @@ XML_DIRECTIVE_FILES = \
 	man/systemd.exec.xml \
 	man/systemd.kill.xml \
 	man/systemd.device.xml \
-	man/systemd.conf.xml
+	man/systemd.conf.xml \
+	man/systemd.journal-fields.xml
 
 man/systemd.directives.xml: make-directive-index.py $(XML_DIRECTIVE_FILES)
 	$(AM_V_at)$(MKDIR_P) $(dir $@)
diff --git a/make-directive-index.py b/make-directive-index.py
index 468ea58..af2d948 100644
--- a/make-directive-index.py
+++ b/make-directive-index.py
@@ -56,6 +56,15 @@ TEMPLATE = '''\
 
                 <variablelist id='udev-directives' />
         </refsect1>
+
+        <refsect1>
+                <title>Journal directives</title>
+
+                <para>Directives for configuring the behaviour of the
+                journald process.</para>
+
+                <variablelist id='journal-directives' />
+        </refsect1>
 </refentry>
 '''
 
@@ -111,6 +120,7 @@ def make_page(xml_files):
                         for name in ['unit-directives',
                                      'udev-directives',
                                      'systemd-directives',
+                                     'journal-directives',
                                      ]}
     for page in xml_files:
         _extract_directives(directive_groups, page)
diff --git a/man/systemd.journal-fields.xml b/man/systemd.journal-fields.xml
index b555c0e..d1cb40b 100644
--- a/man/systemd.journal-fields.xml
+++ b/man/systemd.journal-fields.xml
@@ -68,9 +68,9 @@
                 <para>User fields are fields that are directly passed
                 from clients and stored in the journal.</para>
 
-                <variablelist>
+                <variablelist class='journal-directives'>
                         <varlistentry>
-                                <term>MESSAGE=</term>
+                                <term><varname>MESSAGE=</varname></term>
                                 <listitem>
                                         <para>The human readable
                                         message string for this
@@ -85,7 +85,7 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>MESSAGE_ID=</term>
+                                <term><varname>MESSAGE_ID=</varname></term>
                                 <listitem>
                                         <para>A 128bit message
                                         identifier ID for recognizing
@@ -107,7 +107,7 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>PRIORITY=</term>
+                                <term><varname>PRIORITY=</varname></term>
                                 <listitem>
                                         <para>A priority value between
                                         0 (<literal>emerg</literal>)
@@ -121,9 +121,9 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>CODE_FILE=</term>
-                                <term>CODE_LINE=</term>
-                                <term>CODE_FUNC=</term>
+                                <term><varname>CODE_FILE=</varname></term>
+                                <term><varname>CODE_LINE=</varname></term>
+                                <term><varname>CODE_FUNC=</varname></term>
                                 <listitem>
                                         <para>The code location
                                         generating this message, if
@@ -134,7 +134,7 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>ERRNO=</term>
+                                <term><varname>ERRNO=</varname></term>
                                 <listitem>
                                         <para>The low-level Unix error
                                         number causing this entry, if
@@ -147,9 +147,9 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>SYSLOG_FACILITY=</term>
-                                <term>SYSLOG_IDENTIFIER=</term>
-                                <term>SYSLOG_PID=</term>
+                                <term><varname>SYSLOG_FACILITY=</varname></term>
+                                <term><varname>SYSLOG_IDENTIFIER=</varname></term>
+                                <term><varname>SYSLOG_PID=</varname></term>
                                 <listitem>
                                         <para>Syslog compatibility
                                         fields containing the facility
@@ -170,11 +170,11 @@
                 fields, i.e. fields that are implicitly added by the
                 journal and cannot be altered by client code.</para>
 
-                <variablelist>
+                <variablelist class='journal-directives'>
                         <varlistentry>
-                                <term>_PID=</term>
-                                <term>_UID=</term>
-                                <term>_GID=</term>
+                                <term><varname>_PID=</varname></term>
+                                <term><varname>_UID=</varname></term>
+                                <term><varname>_GID=</varname></term>
                                 <listitem>
                                         <para>The process, user and
                                         group ID of the process the
@@ -185,9 +185,9 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>_COMM=</term>
-                                <term>_EXE=</term>
-                                <term>_CMDLINE=</term>
+                                <term><varname>_COMM=</varname></term>
+                                <term><varname>_EXE=</varname></term>
+                                <term><varname>_CMDLINE=</varname></term>
                                 <listitem>
                                         <para>The name, the executable
                                         path and the command line of
@@ -197,8 +197,8 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>_AUDIT_SESSION=</term>
-                                <term>_AUDIT_LOGINUID=</term>
+                                <term><varname>_AUDIT_SESSION=</varname></term>
+                                <term><varname>_AUDIT_LOGINUID=</varname></term>
                                 <listitem>
                                         <para>The session and login
                                         UID of the process the journal
@@ -209,10 +209,10 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>_SYSTEMD_CGROUP=</term>
-                                <term>_SYSTEMD_SESSION=</term>
-                                <term>_SYSTEMD_UNIT=</term>
-                                <term>_SYSTEMD_OWNER_UID=</term>
+                                <term><varname>_SYSTEMD_CGROUP=</varname></term>
+                                <term><varname>_SYSTEMD_SESSION=</varname></term>
+                                <term><varname>_SYSTEMD_UNIT=</varname></term>
+                                <term><varname>_SYSTEMD_OWNER_UID=</varname></term>
 
                                 <listitem>
                                         <para>The contol group path in
@@ -227,7 +227,7 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>_SELINUX_CONTEXT=</term>
+                                <term><varname>_SELINUX_CONTEXT=</varname></term>
                                 <listitem>
                                         <para>The SELinux security
                                         context of the process the
@@ -237,7 +237,7 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>_SOURCE_REALTIME_TIMESTAMP=</term>
+                                <term><varname>_SOURCE_REALTIME_TIMESTAMP=</varname></term>
                                 <listitem>
                                         <para>The earliest trusted
                                         timestamp of the message, if
@@ -251,7 +251,7 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>_BOOT_ID=</term>
+                                <term><varname>_BOOT_ID=</varname></term>
                                 <listitem>
                                         <para>The kernel boot ID for
                                         the boot the message was
@@ -262,7 +262,7 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>_MACHINE_ID=</term>
+                                <term><varname>_MACHINE_ID=</varname></term>
                                 <listitem>
                                         <para>The machine ID of the
                                         originating host, as available
@@ -272,7 +272,7 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>_HOSTNAME=</term>
+                                <term><varname>_HOSTNAME=</varname></term>
                                 <listitem>
                                         <para>The name of the
                                         originating host.</para>
@@ -280,7 +280,7 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>_TRANSPORT=</term>
+                                <term><varname>_TRANSPORT=</varname></term>
                                 <listitem>
                                         <para>How the entry was
                                         received by the journal
@@ -383,9 +383,9 @@
                 may also not be used as matches for
                 <citerefentry><refentrytitle>sd_journal_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry></para>
 
-                <variablelist>
+                <variablelist class='journal-directives'>
                         <varlistentry>
-                                <term>__CURSOR=</term>
+                                <term><varname>__CURSOR=</varname></term>
                                 <listitem>
                                         <para>The cursor for the
                                         entry. A cursor is an opaque
@@ -399,7 +399,7 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>__REALTIME_TIMESTAMP=</term>
+                                <term><varname>__REALTIME_TIMESTAMP=</varname></term>
                                 <listitem>
                                         <para>The wallclock time
                                         (CLOCK_REALTIME) at the point
@@ -416,7 +416,7 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term>__MONOTONIC_TIMESTAMP=</term>
+                                <term><varname>__MONOTONIC_TIMESTAMP=</varname></term>
                                 <listitem>
                                         <para>The monotonic time
                                         (CLOCK_MONOTONIC) at the point

commit ffafe91b5ae019c699c009c3128ddfe4320a750b
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Fri Aug 10 19:14:30 2012 +0200

    directive-index: system manager directives

diff --git a/Makefile.am b/Makefile.am
index 5a133da..32f08ed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -702,7 +702,9 @@ XML_DIRECTIVE_FILES = \
 	man/systemd.timer.xml \
 	man/systemd.snapshot.xml \
 	man/systemd.exec.xml \
-	man/systemd.device.xml
+	man/systemd.kill.xml \
+	man/systemd.device.xml \
+	man/systemd.conf.xml
 
 man/systemd.directives.xml: make-directive-index.py $(XML_DIRECTIVE_FILES)
 	$(AM_V_at)$(MKDIR_P) $(dir $@)
diff --git a/make-directive-index.py b/make-directive-index.py
index 49d1028..468ea58 100644
--- a/make-directive-index.py
+++ b/make-directive-index.py
@@ -40,6 +40,15 @@ TEMPLATE = '''\
         </refsect1>
 
         <refsect1>
+                <title>System manager directives</title>
+
+                <para>Directives for configuring the behaviour of the
+                systemd process.</para>
+
+                <variablelist id='systemd-directives' />
+        </refsect1>
+
+        <refsect1>
                 <title>UDEV directives</title>
 
                 <para>Directives for configuring systemd units through the
@@ -101,6 +110,7 @@ def make_page(xml_files):
     directive_groups = {name:collections.defaultdict(list)
                         for name in ['unit-directives',
                                      'udev-directives',
+                                     'systemd-directives',
                                      ]}
     for page in xml_files:
         _extract_directives(directive_groups, page)
diff --git a/man/systemd.conf.xml b/man/systemd.conf.xml
index a550c2c..7776c8f 100644
--- a/man/systemd.conf.xml
+++ b/man/systemd.conf.xml
@@ -69,7 +69,7 @@
                 <para>All options are configured in the
                 <literal>[Manager]</literal> section:</para>
 
-                <variablelist>
+                <variablelist class='systemd-directives'>
 
                         <varlistentry>
                                 <term><varname>LogLevel=</varname></term>

commit e1abd3efabb95a30d0702ed1c7c33c57bf898297
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sun Sep 16 11:11:34 2012 +0200

    directive-index: add UDEV fields

diff --git a/Makefile.am b/Makefile.am
index b0649e4..5a133da 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -701,7 +701,8 @@ XML_DIRECTIVE_FILES = \
 	man/systemd.path.xml \
 	man/systemd.timer.xml \
 	man/systemd.snapshot.xml \
-	man/systemd.exec.xml
+	man/systemd.exec.xml \
+	man/systemd.device.xml
 
 man/systemd.directives.xml: make-directive-index.py $(XML_DIRECTIVE_FILES)
 	$(AM_V_at)$(MKDIR_P) $(dir $@)
diff --git a/make-directive-index.py b/make-directive-index.py
index 0c3b67a..49d1028 100644
--- a/make-directive-index.py
+++ b/make-directive-index.py
@@ -38,6 +38,15 @@ TEMPLATE = '''\
 
                 <variablelist id='unit-directives' />
         </refsect1>
+
+        <refsect1>
+                <title>UDEV directives</title>
+
+                <para>Directives for configuring systemd units through the
+                udev database.</para>
+
+                <variablelist id='udev-directives' />
+        </refsect1>
 </refentry>
 '''
 
@@ -91,6 +100,7 @@ def make_page(xml_files):
     "Extract directives from xml_files and return XML index tree."
     directive_groups = {name:collections.defaultdict(list)
                         for name in ['unit-directives',
+                                     'udev-directives',
                                      ]}
     for page in xml_files:
         _extract_directives(directive_groups, page)
diff --git a/man/systemd.device.xml b/man/systemd.device.xml
index c360319..141d72e 100644
--- a/man/systemd.device.xml
+++ b/man/systemd.device.xml
@@ -96,7 +96,7 @@
                 database (which is recommended). The following udev
                 properties are understood by systemd:</para>
 
-                <variablelist>
+                <variablelist class='udev-directives'>
                         <varlistentry>
                                 <term><varname>SYSTEMD_WANTS=</varname></term>
                                 <listitem><para>Adds dependencies of

commit d9cfd69403d18438d7bafd172d6a0686940c2e30
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Aug 9 18:08:14 2012 +0200

    man: generate an index of directives
    
    Systemd has a large (and growing) number of manpages. Sometimes it's
    not immediately obvious, where to look for a directive. Especially,
    when something is described in more than one place. Making sense of
    all the settings should be easier with an index.

diff --git a/Makefile.am b/Makefile.am
index 12c2d2e..b0649e4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -684,8 +684,32 @@ man/index.html: make-man-index.py $(XML_FILES)
 	$(AM_V_at)$(MKDIR_P) $(dir $@)
 	$(AM_V_GEN)$(PYTHON) $^ > $@
 
+MANPAGES += \
+	man/systemd.directives.5
+
 EXTRA_DIST += \
 	man/index.html
+
+XML_DIRECTIVE_FILES = \
+	man/systemd.unit.xml \
+	man/systemd.service.xml \
+	man/systemd.socket.xml \
+	man/systemd.mount.xml \
+	man/systemd.automount.xml \
+	man/systemd.swap.xml \
+	man/systemd.target.xml \
+	man/systemd.path.xml \
+	man/systemd.timer.xml \
+	man/systemd.snapshot.xml \
+	man/systemd.exec.xml
+
+man/systemd.directives.xml: make-directive-index.py $(XML_DIRECTIVE_FILES)
+	$(AM_V_at)$(MKDIR_P) $(dir $@)
+	$(AM_V_GEN)$(PYTHON) $^ > $@
+
+EXTRA_DIST += \
+	man/systemd.directives.xml
+
 endif
 
 endif
@@ -695,7 +719,8 @@ EXTRA_DIST += \
 	${XML_FILES:.xml=.html} \
 	$(MANPAGES) \
 	$(MANPAGES_ALIAS) \
-	make-man-index.py
+	make-man-index.py \
+	make-directive-index.py
 
 # ------------------------------------------------------------------------------
 noinst_LTLIBRARIES += \
diff --git a/make-directive-index.py b/make-directive-index.py
new file mode 100644
index 0000000..0c3b67a
--- /dev/null
+++ b/make-directive-index.py
@@ -0,0 +1,101 @@
+# -*- coding: utf-8 -*-
+import sys
+import collections
+import xml.etree.ElementTree as tree
+
+TEMPLATE = '''\
+<refentry id="systemd.directives">
+
+        <refentryinfo>
+                <title>systemd.directives</title>
+                <productname>systemd</productname>
+
+                <authorgroup>
+                        <author>
+                                <contrib>Developer</contrib>
+                                <firstname>Zbigniew</firstname>
+                                <surname>Jędrzejewski-Szmek</surname>
+                                <email>zbyszek at in.waw.pl</email>
+                        </author>
+                </authorgroup>
+        </refentryinfo>
+
+        <refmeta>
+                <refentrytitle>systemd.directives</refentrytitle>
+                <manvolnum>5</manvolnum>
+        </refmeta>
+
+        <refnamediv>
+                <refname>systemd.directives</refname>
+                <refpurpose>Index of configuration directives</refpurpose>
+        </refnamediv>
+
+        <refsect1>
+                <title>Unit directives</title>
+
+                <para>Directives for configuring units, used in unit
+                files.</para>
+
+                <variablelist id='unit-directives' />
+        </refsect1>
+</refentry>
+'''
+
+def _extract_directives(directive_groups, page):
+    t = tree.parse(page)
+    section = t.find('./refmeta/manvolnum').text
+    pagename = t.find('./refmeta/refentrytitle').text
+    for variablelist in t.iterfind('.//variablelist'):
+        klass = variablelist.attrib.get('class') or 'unit-directives'
+        stor = directive_groups[klass]
+        for varname in variablelist.iterfind('./varlistentry/term/varname'):
+            text = ''.join(varname.text.partition('=')[:2])
+            stor[text].append((pagename, section))
+
+def _make_section(refentry, name, directives):
+    varlist = refentry.find(".//*[@id='{}']".format(name))
+    for varname, manpages in sorted(directives.items()):
+        entry = tree.SubElement(varlist, 'varlistentry')
+        a = tree.SubElement(tree.SubElement(entry, 'term'), 'varname')
+        a.text = varname
+        para = tree.SubElement(tree.SubElement(entry, 'listitem'), 'para')
+
+        b = None
+        for manpage, manvolume in sorted(manpages):
+                if b is not None:
+                        b.tail = ', '
+                b = tree.SubElement(para, 'citerefentry')
+                c = tree.SubElement(b, 'refentrytitle')
+                c.text = manpage
+                d = tree.SubElement(b, 'manvolnum')
+                d.text = manvolume
+        entry.tail = '\n\n'
+
+def _make_page(directive_groups):
+    """Create an XML tree from directive_groups.
+
+    directive_groups = {
+       'class': {'variable': [('manpage', 'manvolume'), ...],
+                 'variable2': ...},
+       ...
+    }
+    """
+    refentry = tree.fromstring(TEMPLATE)
+
+    for name, directives in directive_groups.items():
+            _make_section(refentry, name, directives)
+
+    return refentry
+
+def make_page(xml_files):
+    "Extract directives from xml_files and return XML index tree."
+    directive_groups = {name:collections.defaultdict(list)
+                        for name in ['unit-directives',
+                                     ]}
+    for page in xml_files:
+        _extract_directives(directive_groups, page)
+
+    return _make_page(directive_groups)
+
+if __name__ == '__main__':
+    tree.dump(make_page(sys.argv[1:]))



More information about the systemd-commits mailing list