diff options
Diffstat (limited to 'tests/tst-doc-version-policy.sh')
| -rwxr-xr-x | tests/tst-doc-version-policy.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/tst-doc-version-policy.sh b/tests/tst-doc-version-policy.sh new file mode 100755 index 0000000..cd50995 --- /dev/null +++ b/tests/tst-doc-version-policy.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -e + +: "${TEST_SRCDIR:?}" + +TOP_SRCDIR=`cd "${TEST_SRCDIR}/.." && pwd` +README="${TOP_SRCDIR}/README.md" +MAN_DIR="${TOP_SRCDIR}/man" + +fail() +{ + echo "tst-doc-version-policy: $*" >&2 + exit 1 +} + +# README is a current-interface document, not a release changelog. Keep +# package release numbers in NEWS/ChangeLog and obtain the installed version +# from the tools themselves. +if grep -E 'LibMCPU [0-9]+\.[0-9]+\.[0-9]+|libmcpu-[0-9]+\.[0-9]+\.[0-9]+' \ + "${README}" >/dev/null ; then + fail "README.md contains a release-bound LibMCPU version string" +fi + +# Manual pages describe the interface contract. Their .TH source field is +# deliberately version-independent so a release bump cannot leave stale +# numbers behind. +while IFS= read -r page ; do + header=`sed -n '1p' "${page}"` + case "${header}" in + *'"LibMCPU"'*) + ;; + *) + fail "${page}: .TH source field is not version-independent" + ;; + esac + +done < <(find "${MAN_DIR}" -type f \( -name '*.1' -o -name '*.7' \) | sort) + +if grep -ER 'LibMCPU [0-9]+\.[0-9]+\.[0-9]+' "${MAN_DIR}" >/dev/null ; then + fail "manual page contains a release-bound LibMCPU version string" +fi + +exit 0 |
