summaryrefslogtreecommitdiffstats
path: root/tools/check_help_urls.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
commite4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch)
tree68cb5ef9081156392f1dd62a00c6ccc1451b93df /tools/check_help_urls.py
parentInitial commit. (diff)
downloadwireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz
wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/check_help_urls.py')
-rwxr-xr-xtools/check_help_urls.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/check_help_urls.py b/tools/check_help_urls.py
new file mode 100755
index 0000000..ddf3673
--- /dev/null
+++ b/tools/check_help_urls.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+# Wireshark - Network traffic analyzer
+# By Gerald Combs <gerald@wireshark.org>
+# Copyright 1998 Gerald Combs
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+'''
+Go through all user guide help URLs listed in the program
+and confirm these are present in the User's Guide source files.
+'''
+
+from re import search
+from glob import glob
+from sys import exit
+
+found = {}
+
+with open("ui/help_url.c") as f:
+ for line in f:
+ if url := search(r"user_guide_url\(\"(.*).html\"\);", line):
+ chapter = url.group(1)
+ found[chapter] = False
+
+adoc_files = glob("docbook/wsug_src/*.adoc")
+
+for adoc_file in adoc_files:
+ with open(adoc_file) as f:
+ for line in f:
+ # Fail on legacy block anchor syntax (double square brackets)
+ if tag := search(r"^\[\#(.*)]", line):
+ chapter = tag.group(1)
+ if chapter in found:
+ found[chapter] = True
+
+missing = False
+
+for chapter in found:
+ if not found[chapter]:
+ if not missing:
+ print("The following chapters are missing in the User's Guide:")
+ missing = True
+ print(chapter)
+
+if missing:
+ exit(-1)