summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/make-directive-index.py89
-rwxr-xr-xtools/make-man-index.py25
-rwxr-xr-xtools/make-man-rules.py98
-rwxr-xr-xtools/meson-check-compilation.sh3
-rwxr-xr-xtools/meson-check-help.sh20
-rwxr-xr-xtools/meson-get-cg-controller.sh18
-rwxr-xr-xtools/meson-git-contrib.sh8
-rw-r--r--tools/meson-link-test.c1
-rwxr-xr-xtools/meson-make-symlink.sh11
-rwxr-xr-xtools/xml_helper.py1
10 files changed, 187 insertions, 87 deletions
diff --git a/tools/make-directive-index.py b/tools/make-directive-index.py
index 193f7416f..2d1ddd13f 100755
--- a/tools/make-directive-index.py
+++ b/tools/make-directive-index.py
@@ -1,34 +1,35 @@
+#!/usr/bin/env python3
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
#
-# This file is part of elogind.
+# This file is part of systemd.
#
# Copyright 2012-2013 Zbigniew Jędrzejewski-Szmek
#
-# elogind is free software; you can redistribute it and/or modify it
+# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
-# elogind is distributed in the hope that it will be useful, but
+# systemd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
-# along with elogind; If not, see <http://www.gnu.org/licenses/>.
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
import sys
import collections
import re
-from xml_helper import *
+from xml_helper import xml_parse, xml_print, tree
from copy import deepcopy
TEMPLATE = '''\
<refentry id="elogind.directives" conditional="HAVE_PYTHON">
<refentryinfo>
- <title>elogind.directives</title>
- <productname>elogind</productname>
+ <title>systemd.directives</title>
+ <productname>systemd</productname>
<authorgroup>
<author>
@@ -41,25 +42,70 @@ TEMPLATE = '''\
</refentryinfo>
<refmeta>
- <refentrytitle>elogind.directives</refentrytitle>
+ <refentrytitle>systemd.directives</refentrytitle>
<manvolnum>7</manvolnum>
</refmeta>
<refnamediv>
- <refname>elogind.directives</refname>
+ <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>
+
+ <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-options' />
+ </refsect1>
+
+ <refsect1>
<title>Environment variables</title>
- <para>Environment variables understood by the elogind
+ <para>Environment variables understood by the systemd
manager and other programs.</para>
<variablelist id='environment-variables' />
</refsect1>
<refsect1>
+ <title>UDEV directives</title>
+
+ <para>Directives for configuring systemd units through the
+ udev database.</para>
+
+ <variablelist id='udev-directives' />
+ </refsect1>
+
+ <refsect1>
+ <title>Network directives</title>
+
+ <para>Directives for configuring network links through the
+ net-setup-link udev builtin and networks through
+ systemd-networkd.</para>
+
+ <variablelist id='network-directives' />
+ </refsect1>
+
+ <refsect1>
+ <title>Journal fields</title>
+
+ <para>Fields in the journal events with a well known meaning.</para>
+
+ <variablelist id='journal-directives' />
+ </refsect1>
+
+ <refsect1>
<title>PAM configuration directives</title>
<para>Directives for configuring PAM behaviour.</para>
@@ -68,10 +114,29 @@ TEMPLATE = '''\
</refsect1>
<refsect1>
+ <title><filename>/etc/crypttab</filename> and
+ <filename>/etc/fstab</filename> options</title>
+
+ <para>Options which influence mounted filesystems and
+ encrypted volumes.</para>
+
+ <variablelist id='fstab-options' />
+ </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>command line options</title>
<para>Command-line options accepted by programs in the
- elogind suite.</para>
+ systemd suite.</para>
<variablelist id='options' />
</refsect1>
@@ -79,7 +144,7 @@ TEMPLATE = '''\
<refsect1>
<title>Constants</title>
- <para>Various constant used and/or defined by elogind.</para>
+ <para>Various constant used and/or defined by systemd.</para>
<variablelist id='constants' />
</refsect1>
diff --git a/tools/make-man-index.py b/tools/make-man-index.py
index 396188212..0618e2e67 100755
--- a/tools/make-man-index.py
+++ b/tools/make-man-index.py
@@ -1,36 +1,37 @@
+#!/usr/bin/env python3
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
#
-# This file is part of elogind.
+# This file is part of systemd.
#
# Copyright 2012 Lennart Poettering
# Copyright 2013 Zbigniew Jędrzejewski-Szmek
#
-# elogind is free software; you can redistribute it and/or modify it
+# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
-# elogind is distributed in the hope that it will be useful, but
+# systemd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
-# along with elogind; If not, see <http://www.gnu.org/licenses/>.
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
import collections
import sys
import re
-from xml_helper import *
+from xml_helper import xml_parse, xml_print, tree
MDASH = ' — ' if sys.version_info.major >= 3 else ' -- '
TEMPLATE = '''\
-<refentry id="elogind.index" conditional="HAVE_PYTHON">
+<refentry id="systemd.index" conditional="HAVE_PYTHON">
<refentryinfo>
- <title>elogind.index</title>
- <productname>elogind</productname>
+ <title>systemd.index</title>
+ <productname>systemd</productname>
<authorgroup>
<author>
@@ -43,13 +44,13 @@ TEMPLATE = '''\
</refentryinfo>
<refmeta>
- <refentrytitle>elogind.index</refentrytitle>
+ <refentrytitle>systemd.index</refentrytitle>
<manvolnum>7</manvolnum>
</refmeta>
<refnamediv>
- <refname>elogind.index</refname>
- <refpurpose>List all manpages from the elogind project</refpurpose>
+ <refname>systemd.index</refname>
+ <refpurpose>List all manpages from the systemd project</refpurpose>
</refnamediv>
</refentry>
'''
@@ -58,7 +59,7 @@ SUMMARY = '''\
<refsect1>
<title>See Also</title>
<para>
- <citerefentry><refentrytitle>elogind.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
</para>
<para id='counts' />
diff --git a/tools/make-man-rules.py b/tools/make-man-rules.py
index 5e61917d6..e0f18d6fb 100755
--- a/tools/make-man-rules.py
+++ b/tools/make-man-rules.py
@@ -1,8 +1,9 @@
+#!/usr/bin/env python3
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
#
# This file is part of systemd.
#
-# Copyright 2013 Zbigniew Jędrzejewski-Szmek
+# Copyright 2013, 2017 Zbigniew Jędrzejewski-Szmek
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
@@ -21,55 +22,14 @@ from __future__ import print_function
import collections
import sys
import os.path
-from xml_helper import *
-
-SECTION = '''\
-MANPAGES += \\
- {manpages}
-MANPAGES_ALIAS += \\
- {aliases}
-{rules}
-{htmlrules}
-'''
-
-CONDITIONAL = '''\
-if {conditional}
-''' \
-+ SECTION + \
-'''\
-endif
-'''
-
-HEADER = '''\
-# Do not edit. Generated by make-man-rules.py.
-# To regenerate:
-# 1. Create, update, or remove source .xml files in man/
-# 2. Run 'make update-man-list'
-# 3. Run 'make man' to generate manpages
-#
-# To make a man page conditional on a configure switch add
-# attribute conditional="ENABLE_WHAT" or conditional="WITH_WHAT"
-# to <refentry> element.
-'''
-
-HTML_ALIAS_RULE = '''\
-{}.html: {}.html
- $(html-alias)
-'''
-
-FOOTER = '''\
-
-# Really, do not edit this file.
-
-EXTRA_DIST += \\
- {dist_files}
-'''
+import pprint
+from xml_helper import xml_parse
def man(page, number):
- return 'man/{}.{}'.format(page, number)
+ return '{}.{}'.format(page, number)
def xml(file):
- return 'man/{}'.format(os.path.basename(file))
+ return os.path.basename(file)
def add_rules(rules, name):
xml = xml_parse(name)
@@ -106,24 +66,36 @@ def create_rules(xml_files):
def mjoin(files):
return ' \\\n\t'.join(sorted(files) or '#')
-def make_makefile(rules, dist_files):
- return HEADER + '\n'.join(
- (CONDITIONAL if conditional else SECTION).format(
- manpages=mjoin(set(rulegroup.values())),
- aliases=mjoin(k for k,v in rulegroup.items() if k != v),
- rules='\n'.join('{}: {}'.format(k,v)
- for k,v in sorted(rulegroup.items())
- if k != v),
- htmlrules='\n'.join(HTML_ALIAS_RULE.format(k[:-2],v[:-2])
- for k,v in sorted(rulegroup.items())
- if k != v),
- conditional=conditional)
- for conditional,rulegroup in sorted(rules.items())
- ) + FOOTER.format(dist_files=mjoin(sorted(dist_files)))
+MESON_HEADER = '''\
+# Do not edit. Generated by make-man-rules.py.
+manpages = ['''
+
+MESON_FOOTER = '''\
+]
+# Really, do not edit.'''
+
+def make_mesonfile(rules, dist_files):
+ # reformat rules as
+ # grouped = [ [name, section, [alias...], condition], ...]
+ #
+ # but first create a dictionary like
+ # lists = { (name, condition) => [alias...]
+ grouped = collections.defaultdict(list)
+ for condition, items in rules.items():
+ for alias, name in items.items():
+ group = grouped[(name, condition)]
+ if name != alias:
+ group.append(alias)
+
+ lines = [ [p[0][:-2], p[0][-1], sorted(a[:-2] for a in aliases), p[1]]
+ for p, aliases in sorted(grouped.items()) ]
+ return '\n'.join((MESON_HEADER, pprint.pformat(lines)[1:-1], MESON_FOOTER))
if __name__ == '__main__':
- rules = create_rules(sys.argv[1:])
- dist_files = (xml(file) for file in sys.argv[1:]
+ pages = sys.argv[1:]
+
+ rules = create_rules(pages)
+ dist_files = (xml(file) for file in pages
if not file.endswith(".directives.xml") and
not file.endswith(".index.xml"))
- print(make_makefile(rules, dist_files), end='')
+ print(make_mesonfile(rules, dist_files))
diff --git a/tools/meson-check-compilation.sh b/tools/meson-check-compilation.sh
new file mode 100755
index 000000000..d3b2a312f
--- /dev/null
+++ b/tools/meson-check-compilation.sh
@@ -0,0 +1,3 @@
+#!/bin/sh -eu
+
+"$@" '-' -o/dev/null </dev/null
diff --git a/tools/meson-check-help.sh b/tools/meson-check-help.sh
new file mode 100755
index 000000000..47a5099a0
--- /dev/null
+++ b/tools/meson-check-help.sh
@@ -0,0 +1,20 @@
+#!/bin/sh -eu
+
+# output width
+if "$1" --help | grep -v 'default:' | grep -E -q '.{80}.'; then
+ echo "$(basename "$1") --help output is too wide:"
+ "$1" --help | awk 'length > 80' | grep -E --color=yes '.{80}'
+ exit 1
+fi
+
+# no --help output to stdout
+if "$1" --help 2>&1 1>/dev/null | grep .; then
+ echo "$(basename "$1") --help prints to stderr"
+ exit 2
+fi
+
+# error output to stderr
+if ! "$1" --no-such-parameter 2>&1 1>/dev/null | grep -q .; then
+ echo "$(basename "$1") with an unknown parameter does not print to stderr"
+ exit 3
+fi
diff --git a/tools/meson-get-cg-controller.sh b/tools/meson-get-cg-controller.sh
new file mode 100755
index 000000000..98ba37a7f
--- /dev/null
+++ b/tools/meson-get-cg-controller.sh
@@ -0,0 +1,18 @@
+#!/bin/sh -eu
+
+if test -f /proc/self/cgroup; then
+ # If the init system is a cgroup controler, it will be position 1.
+ # Secondary controllers, like cgmanager, do not work.
+ with_cgroupctrl=$(grep "^1:name=" /proc/self/cgroup | \
+ sed -n 's/.*=//p' | sed -e 's/:.*$//')
+ if test -z "$with_cgroupctrl"; then
+ # Try to be our own cgroup controller
+ with_cgroupctrl="elogind"
+ fi
+else
+ # 'auto' but no cgroup fs is a problem.
+ with_cgroupctrl=""
+fi
+
+echo "$with_cgroupctrl"
+exit 0
diff --git a/tools/meson-git-contrib.sh b/tools/meson-git-contrib.sh
new file mode 100755
index 000000000..c543b3a5f
--- /dev/null
+++ b/tools/meson-git-contrib.sh
@@ -0,0 +1,8 @@
+#!/bin/sh -eu
+
+git shortlog -s `git describe --abbrev=0`.. | \
+ cut -c8- | \
+ sed 's/ / /g' | \
+ awk '{ print $$0 "," }' | \
+ sed -e 's/ / /g' | \
+ sort -u
diff --git a/tools/meson-link-test.c b/tools/meson-link-test.c
new file mode 100644
index 000000000..825bbff05
--- /dev/null
+++ b/tools/meson-link-test.c
@@ -0,0 +1 @@
+int main(void) {return 0;}
diff --git a/tools/meson-make-symlink.sh b/tools/meson-make-symlink.sh
new file mode 100755
index 000000000..47a5e70ae
--- /dev/null
+++ b/tools/meson-make-symlink.sh
@@ -0,0 +1,11 @@
+#!/bin/sh -eu
+
+# this is needed mostly because $DESTDIR is provided as a variable,
+# and we need to create the target directory...
+
+mkdir -vp "$(dirname "${DESTDIR:-}$2")"
+if [ "$(dirname $1)" = . ]; then
+ ln -vfs -T "$1" "${DESTDIR:-}$2"
+else
+ ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2"
+fi
diff --git a/tools/xml_helper.py b/tools/xml_helper.py
index e87126f2f..0088be5bd 100755
--- a/tools/xml_helper.py
+++ b/tools/xml_helper.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python3
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
#
# This file is part of systemd.