summaryrefslogtreecommitdiffstats
path: root/tools/check-api-docs.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:49:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:49:52 +0000
commit55944e5e40b1be2afc4855d8d2baf4b73d1876b5 (patch)
tree33f869f55a1b149e9b7c2b7e201867ca5dd52992 /tools/check-api-docs.sh
parentInitial commit. (diff)
downloadsystemd-55944e5e40b1be2afc4855d8d2baf4b73d1876b5.tar.xz
systemd-55944e5e40b1be2afc4855d8d2baf4b73d1876b5.zip
Adding upstream version 255.4.upstream/255.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/check-api-docs.sh')
-rwxr-xr-xtools/check-api-docs.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/check-api-docs.sh b/tools/check-api-docs.sh
new file mode 100755
index 0000000..2e973a0
--- /dev/null
+++ b/tools/check-api-docs.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -eu
+set -o pipefail
+
+sd_good=0
+sd_total=0
+udev_good=0
+udev_total=0
+
+deprecated=(
+ -e sd_bus_try_close
+ -e sd_bus_process_priority
+ -e sd_bus_message_get_priority
+ -e sd_bus_message_set_priority
+ -e sd_seat_can_multi_session
+ -e sd_journal_open_container
+)
+
+for symbol in $(nm -g --defined-only "$@" | grep " T " | cut -d" " -f3 | grep -wv "${deprecated[@]}" | sort -u); do
+ if test -f "${MESON_BUILD_ROOT:?}/man/$symbol.3"; then
+ echo "✓ Symbol $symbol() is documented."
+ good=1
+ else
+ echo -e " \x1b[1;31mSymbol $symbol() lacks documentation.\x1b[0m"
+ good=0
+ fi
+
+ case "$symbol" in
+ sd_*)
+ ((sd_good+=good))
+ ((sd_total+=1))
+ ;;
+ udev_*)
+ ((udev_good+=good))
+ ((udev_total+=1))
+ ;;
+ *)
+ echo 'unknown symbol prefix'
+ exit 1
+ esac
+done
+
+echo "libsystemd: $sd_good/$sd_total libudev: $udev_good/$udev_total"