- if ! xmllint --nonet --valid --noout $(find doc/ -maxdepth 1 -name '*.xml'); then
- echo >&2 'WARNING: original docbook manpages have errors!'
- elif ! xmllint --nonet --valid --noout $(find doc/ -mindepth 2 -maxdepth 2 -name '*.xml'); then
- echo >&2 'WARNING: translated docbook manpages have errors, but originals are okay!'
+
+ dpkg-checkbuilddeps -d 'libxml2-utils'
+
+ HEADERBLUEPRINT="$(mktemp)"
+ sed -n '1,/^$/p' doc/apt.8.xml > "$HEADERBLUEPRINT"
+ find doc -mindepth 1 -maxdepth 1 -type f -name '*.xml' | while read FILE; do
+ if ! sed -n '1,/^$/p' "$FILE" | cmp "$HEADERBLUEPRINT" - >/dev/null 2>&1; then
+ echo >&2 "WARNING: Manpage $FILE has not the usual header! (see diff below)"
+ sed -n '1,/^$/p' "$FILE" | diff -u "$HEADERBLUEPRINT" - || true
+ fi
+ done
+ sed -n '1,/^$/p' doc/guide.dbk > "$HEADERBLUEPRINT"
+ find doc -mindepth 1 -maxdepth 1 -type f -name '*.dbk' | while read FILE; do
+ if ! sed -n '1,/^$/p' "$FILE" | cmp "$HEADERBLUEPRINT" - >/dev/null 2>&1; then
+ echo >&2 "WARNING: Documentation $FILE has not the usual header (see diff below)!"
+ sed -n '1,/^$/p' "$FILE" | diff -u "$HEADERBLUEPRINT" - || true
+ fi
+ done
+ rm "$HEADERBLUEPRINT"
+
+ # check the manpages with each vendor for vendor-specific errors…
+ find vendor -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do
+ ln -sf ../vendor/${DISTRO}/apt-vendor.ent doc
+ if ! xmllint --nonet --valid --noout $(find doc/ -maxdepth 1 -name '*.xml'); then
+ echo >&2 "WARNING: original docbook manpages have errors with vendor ${DISTRO}!"
+ fi
+ done
+ # lets assume we will always have a german manpage translation
+ if [ -e */doc/de/ -o -e doc/de ]; then
+ # … but check the translations only with one vendor for translation-specific errors
+ if ! xmllint --path /vendor/$(./vendor/getinfo current)/ \
+ --path doc/ \
+ --nonet --valid --noout $(find doc/ */doc/ -mindepth 2 -maxdepth 2 -name '*.xml'); then
+ echo >&2 "WARNING: translated docbook manpages have errors!"
+ fi
+ else
+ echo >&2 "ERROR: translated manpages need to be build before they can be checked!"