diff --git a/docs/HACKING.md b/docs/HACKING.md index 990f78c9eb..7ec3dde95b 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -99,6 +99,13 @@ And after that, head over to your repo on GitHub and click "Compare & pull reque Happy hacking! +## Developer and release modes + +In the default meson configuration (`-Dmode=developer`), certain checks are +enabled that are suitable when hacking on systemd (such as internal +documentation consistency checks). Those are not useful when compiling for code +for distribution and can be disabled by setting `-Dmode=release`. + ## Fuzzers systemd includes fuzzers in `src/fuzz/` that use libFuzzer and are automatically diff --git a/man/org.freedesktop.systemd1.xml b/man/org.freedesktop.systemd1.xml index 20dcf029bb..8e326617bf 100644 --- a/man/org.freedesktop.systemd1.xml +++ b/man/org.freedesktop.systemd1.xml @@ -2655,6 +2655,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly i SystemCallErrorNumber = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") + readonly (bas) SystemCallLog = ...; + @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly s Personality = '...'; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly b LockPersonality = ...; @@ -3156,6 +3158,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { + + @@ -3714,6 +3718,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { + + @@ -4356,6 +4362,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket { @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly i SystemCallErrorNumber = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") + readonly (bas) SystemCallLog = ...; + @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly s Personality = '...'; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly b LockPersonality = ...; @@ -4883,6 +4891,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket { + + @@ -5441,6 +5451,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket { + + @@ -6009,6 +6021,8 @@ node /org/freedesktop/systemd1/unit/home_2emount { @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly i SystemCallErrorNumber = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") + readonly (bas) SystemCallLog = ...; + @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly s Personality = '...'; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly b LockPersonality = ...; @@ -6466,6 +6480,8 @@ node /org/freedesktop/systemd1/unit/home_2emount { + + @@ -6944,6 +6960,8 @@ node /org/freedesktop/systemd1/unit/home_2emount { + + @@ -7627,6 +7645,8 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap { @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly i SystemCallErrorNumber = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") + readonly (bas) SystemCallLog = ...; + @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly s Personality = '...'; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly b LockPersonality = ...; @@ -8070,6 +8090,8 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap { + + @@ -8534,6 +8556,8 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap { + + diff --git a/meson.build b/meson.build index 3607035bd2..36314f7157 100644 --- a/meson.build +++ b/meson.build @@ -3513,6 +3513,7 @@ watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog status = [ '@0@ @1@'.format(meson.project_name(), meson.project_version()), + 'build mode: @0@'.format(get_option('mode')), 'split /usr: @0@'.format(split_usr), 'split bin-sbin: @0@'.format(split_bin), 'prefix directory: @0@'.format(prefixdir), diff --git a/meson_options.txt b/meson_options.txt index 1ad0969a1a..fc9e4379f3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -4,7 +4,7 @@ option('version-tag', type : 'string', description : 'override the git version string') -option('mode', type : 'combo', choices : ['default', 'developer'], +option('mode', type : 'combo', choices : ['developer', 'release'], description : 'enable additional checks suitable for systemd development') option('split-usr', type : 'combo', choices : ['auto', 'true', 'false'], diff --git a/tools/update-dbus-docs.py b/tools/update-dbus-docs.py index 3500d9ce5e..14ae30f33c 100755 --- a/tools/update-dbus-docs.py +++ b/tools/update-dbus-docs.py @@ -5,15 +5,18 @@ import argparse import collections import sys import os -import shlex import subprocess import io -from lxml import etree -PARSER = etree.XMLParser(no_network=True, - remove_comments=False, - strip_cdata=False, - resolve_entities=False) +try: + from lxml import etree +except ModuleNotFoundError as e: + etree = e + +try: + from shlex import join as shlex_join +except ImportError as e: + shlex_join = e class NoCommand(Exception): pass @@ -24,6 +27,12 @@ BORING_INTERFACES = [ 'org.freedesktop.DBus.Properties', ] +def xml_parser(): + return etree.XMLParser(no_network=True, + remove_comments=False, + strip_cdata=False, + resolve_entities=False) + def print_method(declarations, elem, *, prefix, file, is_signal=False): name = elem.get('name') klass = 'signal' if is_signal else 'method' @@ -178,7 +187,7 @@ def subst_output(document, programlisting, stats): interface = programlisting.get('interface') argv = [f'{opts.build_dir}/{executable}', f'--bus-introspect={interface}'] - print(f'COMMAND: {shlex.join(argv)}') + print(f'COMMAND: {shlex_join(argv)}') try: out = subprocess.check_output(argv, text=True) @@ -186,7 +195,7 @@ def subst_output(document, programlisting, stats): print(f'{executable} not found, ignoring', file=sys.stderr) return - xml = etree.fromstring(out, parser=PARSER) + xml = etree.fromstring(out, parser=xml_parser()) new_text, declarations, interfaces = xml_to_text(node, xml, only_interface=interface) programlisting.text = '\n' + new_text + ' ' @@ -250,7 +259,7 @@ def subst_output(document, programlisting, stats): def process(page): src = open(page).read() - xml = etree.fromstring(src, parser=PARSER) + xml = etree.fromstring(src, parser=xml_parser()) # print('parsing {}'.format(name), file=sys.stderr) if xml.tag != 'refentry': @@ -288,6 +297,11 @@ def parse_args(): if __name__ == '__main__': opts = parse_args() + for item in (etree, shlex_join): + if isinstance(item, Exception): + print(item, file=sys.stderr) + exit(77 if opts.test else 1) + if not os.path.exists(f'{opts.build_dir}/systemd'): exit(f"{opts.build_dir}/systemd doesn't exist. Use --build-dir=.")