Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | # SPDX-License-Identifier: LGPL-2.1+ |
| 3 | |
Zbigniew Jędrzejewski-Szmek | 0f5cea0 | 2020-08-27 19:27:18 +0200 | [diff] [blame] | 4 | import argparse |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 5 | import collections |
| 6 | import sys |
Zbigniew Jędrzejewski-Szmek | c351d56 | 2020-04-24 12:09:07 +0200 | [diff] [blame] | 7 | import os |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 8 | import shlex |
| 9 | import subprocess |
| 10 | import io |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 11 | |
Zbigniew Jędrzejewski-Szmek | 8aaf611 | 2020-09-18 18:51:42 +0200 | [diff] [blame^] | 12 | try: |
| 13 | from lxml import etree |
| 14 | except ModuleNotFoundError as e: |
| 15 | etree = e |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 16 | |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 17 | class NoCommand(Exception): |
| 18 | pass |
| 19 | |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 20 | BORING_INTERFACES = [ |
| 21 | 'org.freedesktop.DBus.Peer', |
| 22 | 'org.freedesktop.DBus.Introspectable', |
| 23 | 'org.freedesktop.DBus.Properties', |
| 24 | ] |
| 25 | |
Zbigniew Jędrzejewski-Szmek | 8aaf611 | 2020-09-18 18:51:42 +0200 | [diff] [blame^] | 26 | def xml_parser(): |
| 27 | return etree.XMLParser(no_network=True, |
| 28 | remove_comments=False, |
| 29 | strip_cdata=False, |
| 30 | resolve_entities=False) |
| 31 | |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 32 | def print_method(declarations, elem, *, prefix, file, is_signal=False): |
| 33 | name = elem.get('name') |
| 34 | klass = 'signal' if is_signal else 'method' |
| 35 | declarations[klass].append(name) |
| 36 | |
| 37 | print(f'''{prefix}{name}(''', file=file, end='') |
| 38 | lead = ',\n' + prefix + ' ' * len(name) + ' ' |
| 39 | |
| 40 | for num, arg in enumerate(elem.findall('./arg')): |
| 41 | argname = arg.get('name') |
| 42 | |
| 43 | if argname is None: |
Zbigniew Jędrzejewski-Szmek | 04aa6fa | 2020-08-27 20:15:30 +0200 | [diff] [blame] | 44 | if opts.print_errors: |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 45 | print(f'method {name}: argument {num+1} has no name', file=sys.stderr) |
| 46 | argname = 'UNNAMED' |
| 47 | |
| 48 | type = arg.get('type') |
| 49 | if not is_signal: |
| 50 | direction = arg.get('direction') |
| 51 | print(f'''{lead if num > 0 else ''}{direction:3} {type} {argname}''', file=file, end='') |
| 52 | else: |
| 53 | print(f'''{lead if num > 0 else ''}{type} {argname}''', file=file, end='') |
| 54 | |
| 55 | print(f');', file=file) |
| 56 | |
| 57 | ACCESS_MAP = { |
| 58 | 'read' : 'readonly', |
| 59 | 'write' : 'readwrite', |
| 60 | } |
| 61 | |
| 62 | def value_ellipsis(type): |
| 63 | if type == 's': |
| 64 | return "'...'"; |
| 65 | if type[0] == 'a': |
| 66 | inner = value_ellipsis(type[1:]) |
| 67 | return f"[{inner}{', ...' if inner != '...' else ''}]"; |
| 68 | return '...' |
| 69 | |
| 70 | def print_property(declarations, elem, *, prefix, file): |
| 71 | name = elem.get('name') |
| 72 | type = elem.get('type') |
| 73 | access = elem.get('access') |
| 74 | |
| 75 | declarations['property'].append(name) |
| 76 | |
| 77 | # @org.freedesktop.DBus.Property.EmitsChangedSignal("false") |
| 78 | # @org.freedesktop.systemd1.Privileged("true") |
| 79 | # readwrite b EnableWallMessages = false; |
| 80 | |
| 81 | for anno in elem.findall('./annotation'): |
| 82 | anno_name = anno.get('name') |
| 83 | anno_value = anno.get('value') |
| 84 | print(f'''{prefix}@{anno_name}("{anno_value}")''', file=file) |
| 85 | |
| 86 | access = ACCESS_MAP.get(access, access) |
| 87 | print(f'''{prefix}{access} {type} {name} = {value_ellipsis(type)};''', file=file) |
| 88 | |
Zbigniew Jędrzejewski-Szmek | 08fe1b6 | 2020-04-10 14:46:44 +0200 | [diff] [blame] | 89 | def print_interface(iface, *, prefix, file, print_boring, only_interface, declarations): |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 90 | name = iface.get('name') |
| 91 | |
Zbigniew Jędrzejewski-Szmek | 08fe1b6 | 2020-04-10 14:46:44 +0200 | [diff] [blame] | 92 | is_boring = (name in BORING_INTERFACES or |
| 93 | only_interface is not None and name != only_interface) |
| 94 | |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 95 | if is_boring and print_boring: |
| 96 | print(f'''{prefix}interface {name} {{ ... }};''', file=file) |
Zbigniew Jędrzejewski-Szmek | 08fe1b6 | 2020-04-10 14:46:44 +0200 | [diff] [blame] | 97 | |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 98 | elif not is_boring and not print_boring: |
| 99 | print(f'''{prefix}interface {name} {{''', file=file) |
| 100 | prefix2 = prefix + ' ' |
| 101 | |
| 102 | for num, elem in enumerate(iface.findall('./method')): |
| 103 | if num == 0: |
| 104 | print(f'''{prefix2}methods:''', file=file) |
| 105 | print_method(declarations, elem, prefix=prefix2 + ' ', file=file) |
| 106 | |
| 107 | for num, elem in enumerate(iface.findall('./signal')): |
| 108 | if num == 0: |
| 109 | print(f'''{prefix2}signals:''', file=file) |
| 110 | print_method(declarations, elem, prefix=prefix2 + ' ', file=file, is_signal=True) |
| 111 | |
| 112 | for num, elem in enumerate(iface.findall('./property')): |
| 113 | if num == 0: |
| 114 | print(f'''{prefix2}properties:''', file=file) |
| 115 | print_property(declarations, elem, prefix=prefix2 + ' ', file=file) |
| 116 | |
| 117 | print(f'''{prefix}}};''', file=file) |
| 118 | |
| 119 | def document_has_elem_with_text(document, elem, item_repr): |
| 120 | predicate = f".//{elem}" # [text() = 'foo'] doesn't seem supported :( |
| 121 | for loc in document.findall(predicate): |
| 122 | if loc.text == item_repr: |
| 123 | return True |
| 124 | else: |
| 125 | return False |
| 126 | |
Zbigniew Jędrzejewski-Szmek | af4c7dc | 2020-08-27 19:21:21 +0200 | [diff] [blame] | 127 | def check_documented(document, declarations, stats): |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 128 | missing = [] |
| 129 | for klass, items in declarations.items(): |
Zbigniew Jędrzejewski-Szmek | af4c7dc | 2020-08-27 19:21:21 +0200 | [diff] [blame] | 130 | stats['total'] += len(items) |
| 131 | |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 132 | for item in items: |
| 133 | if klass == 'method': |
| 134 | elem = 'function' |
| 135 | item_repr = f'{item}()' |
| 136 | elif klass == 'signal': |
| 137 | elem = 'function' |
| 138 | item_repr = item |
| 139 | elif klass == 'property': |
| 140 | elem = 'varname' |
| 141 | item_repr = item |
| 142 | else: |
| 143 | assert False, (klass, item) |
| 144 | |
| 145 | if not document_has_elem_with_text(document, elem, item_repr): |
Zbigniew Jędrzejewski-Szmek | 04aa6fa | 2020-08-27 20:15:30 +0200 | [diff] [blame] | 146 | if opts.print_errors: |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 147 | print(f'{klass} {item} is not documented :(') |
| 148 | missing.append((klass, item)) |
| 149 | |
Zbigniew Jędrzejewski-Szmek | af4c7dc | 2020-08-27 19:21:21 +0200 | [diff] [blame] | 150 | stats['missing'] += len(missing) |
| 151 | |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 152 | return missing |
| 153 | |
Zbigniew Jędrzejewski-Szmek | 08fe1b6 | 2020-04-10 14:46:44 +0200 | [diff] [blame] | 154 | def xml_to_text(destination, xml, *, only_interface=None): |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 155 | file = io.StringIO() |
| 156 | |
| 157 | declarations = collections.defaultdict(list) |
Jérémy Rosen | f92c8d1 | 2020-04-18 20:19:50 +0200 | [diff] [blame] | 158 | interfaces = [] |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 159 | |
| 160 | print(f'''node {destination} {{''', file=file) |
| 161 | |
| 162 | for print_boring in [False, True]: |
| 163 | for iface in xml.findall('./interface'): |
| 164 | print_interface(iface, prefix=' ', file=file, |
| 165 | print_boring=print_boring, |
Zbigniew Jędrzejewski-Szmek | 08fe1b6 | 2020-04-10 14:46:44 +0200 | [diff] [blame] | 166 | only_interface=only_interface, |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 167 | declarations=declarations) |
Jérémy Rosen | f92c8d1 | 2020-04-18 20:19:50 +0200 | [diff] [blame] | 168 | name = iface.get('name') |
| 169 | if not name in BORING_INTERFACES: |
| 170 | interfaces.append(name) |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 171 | |
| 172 | print(f'''}};''', file=file) |
| 173 | |
Jérémy Rosen | f92c8d1 | 2020-04-18 20:19:50 +0200 | [diff] [blame] | 174 | return file.getvalue(), declarations, interfaces |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 175 | |
Zbigniew Jędrzejewski-Szmek | af4c7dc | 2020-08-27 19:21:21 +0200 | [diff] [blame] | 176 | def subst_output(document, programlisting, stats): |
Zbigniew Jędrzejewski-Szmek | c351d56 | 2020-04-24 12:09:07 +0200 | [diff] [blame] | 177 | executable = programlisting.get('executable', None) |
| 178 | if executable is None: |
| 179 | # Not our thing |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 180 | return |
Zbigniew Jędrzejewski-Szmek | c351d56 | 2020-04-24 12:09:07 +0200 | [diff] [blame] | 181 | executable = programlisting.get('executable') |
| 182 | node = programlisting.get('node') |
| 183 | interface = programlisting.get('interface') |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 184 | |
Zbigniew Jędrzejewski-Szmek | 0f5cea0 | 2020-08-27 19:27:18 +0200 | [diff] [blame] | 185 | argv = [f'{opts.build_dir}/{executable}', f'--bus-introspect={interface}'] |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 186 | print(f'COMMAND: {shlex.join(argv)}') |
| 187 | |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 188 | try: |
| 189 | out = subprocess.check_output(argv, text=True) |
Zbigniew Jędrzejewski-Szmek | c351d56 | 2020-04-24 12:09:07 +0200 | [diff] [blame] | 190 | except FileNotFoundError: |
| 191 | print(f'{executable} not found, ignoring', file=sys.stderr) |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 192 | return |
| 193 | |
Zbigniew Jędrzejewski-Szmek | 8aaf611 | 2020-09-18 18:51:42 +0200 | [diff] [blame^] | 194 | xml = etree.fromstring(out, parser=xml_parser()) |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 195 | |
Zbigniew Jędrzejewski-Szmek | c351d56 | 2020-04-24 12:09:07 +0200 | [diff] [blame] | 196 | new_text, declarations, interfaces = xml_to_text(node, xml, only_interface=interface) |
| 197 | programlisting.text = '\n' + new_text + ' ' |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 198 | |
| 199 | if declarations: |
Zbigniew Jędrzejewski-Szmek | af4c7dc | 2020-08-27 19:21:21 +0200 | [diff] [blame] | 200 | missing = check_documented(document, declarations, stats) |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 201 | parent = programlisting.getparent() |
| 202 | |
| 203 | # delete old comments |
| 204 | for child in parent: |
| 205 | if (child.tag == etree.Comment |
Jérémy Rosen | f92c8d1 | 2020-04-18 20:19:50 +0200 | [diff] [blame] | 206 | and 'Autogenerated' in child.text): |
| 207 | parent.remove(child) |
| 208 | if (child.tag == etree.Comment |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 209 | and 'not documented' in child.text): |
| 210 | parent.remove(child) |
Jérémy Rosen | f92c8d1 | 2020-04-18 20:19:50 +0200 | [diff] [blame] | 211 | if (child.tag == "variablelist" |
| 212 | and child.attrib.get("generated",False) == "True"): |
| 213 | parent.remove(child) |
| 214 | |
| 215 | # insert pointer for systemd-directives generation |
| 216 | the_tail = programlisting.tail #tail is erased by addnext, so save it here. |
| 217 | prev_element = etree.Comment("Autogenerated cross-references for systemd.directives, do not edit") |
| 218 | programlisting.addnext(prev_element) |
| 219 | programlisting.tail = the_tail |
| 220 | |
| 221 | for interface in interfaces: |
| 222 | variablelist = etree.Element("variablelist") |
| 223 | variablelist.attrib['class'] = 'dbus-interface' |
| 224 | variablelist.attrib['generated'] = 'True' |
| 225 | variablelist.attrib['extra-ref'] = interface |
| 226 | |
| 227 | prev_element.addnext(variablelist) |
| 228 | prev_element.tail = the_tail |
| 229 | prev_element = variablelist |
| 230 | |
| 231 | for decl_type,decl_list in declarations.items(): |
| 232 | for declaration in decl_list: |
| 233 | variablelist = etree.Element("variablelist") |
| 234 | variablelist.attrib['class'] = 'dbus-'+decl_type |
| 235 | variablelist.attrib['generated'] = 'True' |
| 236 | if decl_type == 'method' : |
| 237 | variablelist.attrib['extra-ref'] = declaration + '()' |
| 238 | else: |
| 239 | variablelist.attrib['extra-ref'] = declaration |
| 240 | |
| 241 | prev_element.addnext(variablelist) |
| 242 | prev_element.tail = the_tail |
| 243 | prev_element = variablelist |
| 244 | |
| 245 | last_element = etree.Comment("End of Autogenerated section") |
| 246 | prev_element.addnext(last_element) |
| 247 | prev_element.tail = the_tail |
| 248 | last_element.tail = the_tail |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 249 | |
| 250 | # insert comments for undocumented items |
| 251 | for item in reversed(missing): |
| 252 | comment = etree.Comment(f'{item[0]} {item[1]} is not documented!') |
| 253 | comment.tail = programlisting.tail |
| 254 | parent.insert(parent.index(programlisting) + 1, comment) |
| 255 | |
| 256 | def process(page): |
| 257 | src = open(page).read() |
Zbigniew Jędrzejewski-Szmek | 8aaf611 | 2020-09-18 18:51:42 +0200 | [diff] [blame^] | 258 | xml = etree.fromstring(src, parser=xml_parser()) |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 259 | |
| 260 | # print('parsing {}'.format(name), file=sys.stderr) |
| 261 | if xml.tag != 'refentry': |
| 262 | return |
| 263 | |
Zbigniew Jędrzejewski-Szmek | af4c7dc | 2020-08-27 19:21:21 +0200 | [diff] [blame] | 264 | stats = collections.Counter() |
| 265 | |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 266 | pls = xml.findall('.//programlisting') |
| 267 | for pl in pls: |
Zbigniew Jędrzejewski-Szmek | af4c7dc | 2020-08-27 19:21:21 +0200 | [diff] [blame] | 268 | subst_output(xml, pl, stats) |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 269 | |
| 270 | out_text = etree.tostring(xml, encoding='unicode') |
Frantisek Sumsal | 86b52a3 | 2020-04-21 20:46:53 +0200 | [diff] [blame] | 271 | # massage format to avoid some lxml whitespace handling idiosyncrasies |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 272 | # https://bugs.launchpad.net/lxml/+bug/526799 |
| 273 | out_text = (src[:src.find('<refentryinfo')] + |
| 274 | out_text[out_text.find('<refentryinfo'):] + |
| 275 | '\n') |
| 276 | |
Zbigniew Jędrzejewski-Szmek | 1b584f3 | 2020-08-27 19:55:55 +0200 | [diff] [blame] | 277 | if not opts.test: |
| 278 | with open(page, 'w') as out: |
| 279 | out.write(out_text) |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 280 | |
Zbigniew Jędrzejewski-Szmek | 1b584f3 | 2020-08-27 19:55:55 +0200 | [diff] [blame] | 281 | return dict(stats=stats, outdated=(out_text != src)) |
Zbigniew Jędrzejewski-Szmek | af4c7dc | 2020-08-27 19:21:21 +0200 | [diff] [blame] | 282 | |
Zbigniew Jędrzejewski-Szmek | 0f5cea0 | 2020-08-27 19:27:18 +0200 | [diff] [blame] | 283 | def parse_args(): |
| 284 | p = argparse.ArgumentParser() |
Zbigniew Jędrzejewski-Szmek | 1b584f3 | 2020-08-27 19:55:55 +0200 | [diff] [blame] | 285 | p.add_argument('--test', action='store_true', |
| 286 | help='only verify that everything is up2date') |
Zbigniew Jędrzejewski-Szmek | 0f5cea0 | 2020-08-27 19:27:18 +0200 | [diff] [blame] | 287 | p.add_argument('--build-dir', default='build') |
| 288 | p.add_argument('pages', nargs='+') |
Zbigniew Jędrzejewski-Szmek | 04aa6fa | 2020-08-27 20:15:30 +0200 | [diff] [blame] | 289 | opts = p.parse_args() |
| 290 | opts.print_errors = not opts.test |
| 291 | return opts |
Zbigniew Jędrzejewski-Szmek | 0f5cea0 | 2020-08-27 19:27:18 +0200 | [diff] [blame] | 292 | |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 293 | if __name__ == '__main__': |
Zbigniew Jędrzejewski-Szmek | 0f5cea0 | 2020-08-27 19:27:18 +0200 | [diff] [blame] | 294 | opts = parse_args() |
Zbigniew Jędrzejewski-Szmek | e5dd26c | 2020-04-07 16:58:58 +0200 | [diff] [blame] | 295 | |
Zbigniew Jędrzejewski-Szmek | 8aaf611 | 2020-09-18 18:51:42 +0200 | [diff] [blame^] | 296 | if isinstance(etree, Exception): |
| 297 | print(etree, file=sys.stderr) |
| 298 | exit(77 if opts.test else 1) |
| 299 | |
Zbigniew Jędrzejewski-Szmek | 0f5cea0 | 2020-08-27 19:27:18 +0200 | [diff] [blame] | 300 | if not os.path.exists(f'{opts.build_dir}/systemd'): |
| 301 | exit(f"{opts.build_dir}/systemd doesn't exist. Use --build-dir=.") |
Zbigniew Jędrzejewski-Szmek | c351d56 | 2020-04-24 12:09:07 +0200 | [diff] [blame] | 302 | |
Zbigniew Jędrzejewski-Szmek | 0f5cea0 | 2020-08-27 19:27:18 +0200 | [diff] [blame] | 303 | stats = {page.split('/')[-1] : process(page) for page in opts.pages} |
Zbigniew Jędrzejewski-Szmek | af4c7dc | 2020-08-27 19:21:21 +0200 | [diff] [blame] | 304 | |
| 305 | # Let's print all statistics at the end |
| 306 | mlen = max(len(page) for page in stats) |
Zbigniew Jędrzejewski-Szmek | 1b584f3 | 2020-08-27 19:55:55 +0200 | [diff] [blame] | 307 | total = sum((item['stats'] for item in stats.values()), start=collections.Counter()) |
| 308 | total = 'total', dict(stats=total, outdated=False) |
| 309 | outdated = [] |
| 310 | for page, info in sorted(stats.items()) + [total]: |
| 311 | m = info['stats']['missing'] |
| 312 | t = info['stats']['total'] |
Zbigniew Jędrzejewski-Szmek | af4c7dc | 2020-08-27 19:21:21 +0200 | [diff] [blame] | 313 | p = page + ':' |
Zbigniew Jędrzejewski-Szmek | 1b584f3 | 2020-08-27 19:55:55 +0200 | [diff] [blame] | 314 | c = 'OUTDATED' if info['outdated'] else '' |
| 315 | if c: |
| 316 | outdated.append(page) |
| 317 | print(f'{p:{mlen + 1}} {t - m}/{t} {c}') |
| 318 | |
| 319 | if opts.test and outdated: |
Zbigniew Jędrzejewski-Szmek | c91e311 | 2020-08-27 20:18:05 +0200 | [diff] [blame] | 320 | exit(f'Outdated pages: {", ".join(outdated)}\n' |
| 321 | f'Hint: ninja -C {opts.build_dir} man/update-dbus-docs') |