mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 13:08:10 +02:00
docs: rework check-docs test script
Try to make check-docs.sh script more readable. Also, previously the script would check that one side was a subset of the other side. Tighten this check up, now both sides of the comparison must agree and yield the same lines.
This commit is contained in:
parent
e11ee4582a
commit
7a59cd2744
1 changed files with 40 additions and 14 deletions
|
|
@ -1,22 +1,48 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
SOURCEDIR=$1
|
set -e
|
||||||
|
|
||||||
|
die() {
|
||||||
|
printf '%s\n' "$@" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
word_regex() {
|
||||||
|
tr '\n|<>\\' ' ' \
|
||||||
|
| sed -e 's, *$,\\>,' \
|
||||||
|
-e 's,^ *,\\<,' \
|
||||||
|
-e 's, \+,\\>\\|\\<,g'
|
||||||
|
}
|
||||||
|
|
||||||
|
same_lines() {
|
||||||
|
diff <(printf "%s\n" "$1" | sed '/^$/d' | sort) \
|
||||||
|
<(printf "%s\n%s\n" "$2" "$3" | sed '/^$/d' | sort) >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
SOURCEDIR="$1"
|
||||||
[ -n "$SOURCEDIR" ] && SOURCEDIR="$SOURCEDIR/"
|
[ -n "$SOURCEDIR" ] && SOURCEDIR="$SOURCEDIR/"
|
||||||
|
|
||||||
# Check that the D-Bus API docs contain all known interfaces
|
# Check that the D-Bus API docs contain all known interfaces
|
||||||
if (sed -n 's/.*<xi:include href="dbus-\(.*\.xml\)".*/\1\n\1/p' $SOURCEDIR''docs/api/network-manager-docs.xml;
|
F1="$(sed -n 's,^ <xi:include href="dbus-\([^"]*\.xml\)"/>$,\1,p' "$SOURCEDIR"docs/api/network-manager-docs.xml)"
|
||||||
cd $SOURCEDIR''introspection; ls *.xml) |sort |uniq -u| grep . >&2; then
|
F2="$(cd "$SOURCEDIR"introspection; ls -1 *.xml)"
|
||||||
echo "*** Error: D-Bus interfaces not included in docs/api/network-manager-docs.xml ***" >&2
|
if ! same_lines "$F1" "$F2" ; then
|
||||||
exit 1
|
die "*** Error: D-Bus interfaces not included in docs/api/network-manager-docs.xml ***"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check that files that define types that are in public libnm API are included in libnm documentation.
|
# Check that files that define types that are in public libnm API are included in libnm documentation.
|
||||||
# Don't complain about readability or I'll rewrite this in Perl.
|
F1="$(sed -n 's/.*<xi:include href="xml\/\([^"]*\)\.xml".*/\1/p' "$SOURCEDIR"docs/libnm/libnm-docs.xml)"
|
||||||
if (sed -n 's/.*<xi:include href="\(xml\/.*\.xml\)".*/\1\n\1/p' $SOURCEDIR''docs/libnm/libnm-docs.xml;
|
F2="$(grep -l "$(sed -n 's/^[\t ]*\(.*_get_type\);/\1/p' "$SOURCEDIR"libnm/libnm.ver | word_regex)" \
|
||||||
grep -lE "$(sed -n 's/^[\t ]*\(.*_get_type\);/\1/p' $SOURCEDIR''libnm/libnm.ver |xargs echo |sed 's/ /|/g')" $SOURCEDIR''libnm/*.h $SOURCEDIR''libnm-core/*.h |
|
"$SOURCEDIR"libnm/*.h \
|
||||||
sed 's,.*/,xml/,;s/\.h$/.xml/') |sort |uniq -u| grep . >&2; then
|
"$SOURCEDIR"libnm-core/*.h \
|
||||||
echo "*** Error: libnm classes not included in docs/libnm/libnm-docs.xml ***" >&2
|
| sed 's,.*/\([^/]\+\)\.h$,\1,')"
|
||||||
exit 1
|
F2_EXTRA="
|
||||||
|
annotation-glossary
|
||||||
|
api-index-full
|
||||||
|
nm-dbus-interface
|
||||||
|
nm-errors
|
||||||
|
nm-utils
|
||||||
|
nm-version
|
||||||
|
"
|
||||||
|
if ! same_lines "$F1" "$F2" "$F2_EXTRA"; then
|
||||||
|
die "*** Error: libnm classes not included in docs/libnm/libnm-docs.xml ***"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue