]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
update-dbus-docs: don't consider mentions in the History 29150/head
authorAbderrahim Kitouni <abderrahim.kitouni@codethink.co.uk>
Sun, 10 Sep 2023 22:41:35 +0000 (23:41 +0100)
committerAbderrahim Kitouni <abderrahim.kitouni@codethink.co.uk>
Tue, 19 Sep 2023 13:33:34 +0000 (14:33 +0100)
Being mentioned in the History section as added in a specific version isn't
enough to consider a member documented.

tools/update-dbus-docs.py

index d6438a5daf9253eb407749a139e281c76e5abced..b3466bc11086b871aa46ea78b1a9546f60fa1427 100755 (executable)
@@ -141,10 +141,16 @@ def print_interface(iface, *, prefix, file, print_boring, only_interface, declar
         print(f'''{prefix}}};''', file=file)
 
 def document_has_elem_with_text(document, elem, item_repr):
-    predicate = f".//{elem}" # [text() = 'foo'] doesn't seem supported :(
+    predicate = f".//{elem}[. = '{item_repr}']"
+
+    # Ignore mentions in the History section
+    history = document.find(".//refsect1[title = 'History']")
+    history_mentions = history.findall(predicate) if history else []
+
     for loc in document.findall(predicate):
-        if loc.text == item_repr:
-            return True
+        if loc in history_mentions:
+            continue
+        return True
     return False
 
 def check_documented(document, declarations, stats):