summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2022-04-21 12:28:12 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2022-05-07 10:45:44 +0200
commitccc6abd872fdbb443e0378addfd85e420b05a59a (patch)
tree8e76f1ecd42ffb2539a2764a169ac017b149cbd9
parent8fd65748589bb1e0b671d4a291521bfba1664c5c (diff)
Run ./prepare-release post-build checks in Gitlab CI
The checks mostly deal with verifying the syntax of the documentation files and the po4a translations which have no tests otherwise.
-rw-r--r--.gitlab-ci.yml2
-rwxr-xr-xprepare-release29
2 files changed, 22 insertions, 9 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 700f29b0a..d1711d51b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -19,6 +19,8 @@ test as root:
- sudo -u travis mkdir -p build .ccache
- sudo -u travis env -C build cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -G Ninja ..
- sudo -u travis --preserve-env=CCACHE_DIR,CCACHE_BASEDIR ninja -C build
+ - apt-get install --no-install-recommends -qq libxml2-utils
+ - ./prepare-release post-build --report-failure
- CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test
- unbuffer ./test/integration/run-tests -q -j 4
diff --git a/prepare-release b/prepare-release
index 7e417912c..39e2250bc 100755
--- a/prepare-release
+++ b/prepare-release
@@ -7,10 +7,10 @@ if [ -n "${GBP_BUILD_DIR}" ]; then
cd "$GBP_BUILD_DIR"
fi
-VERSION=$(dpkg-parsechangelog | sed -n -e '/^Version:/s/^Version: //p')
-DISTRIBUTION=$(dpkg-parsechangelog | sed -n -e '/^Distribution:/s/^Distribution: //p')
+VERSION=$(dpkg-parsechangelog -S 'Version')
+DISTRIBUTION=$(dpkg-parsechangelog -S 'Distribution')
-LIBAPTPKGVERSION="$(awk -v ORS='.' '/^\#define APT_PKG_M/ {print $3}' apt-pkg/contrib/macros.h | sed 's/\.$//')"
+LIBAPTPKGVERSION="$(awk -v ORS='.' '/^#define APT_PKG_M/ {print $3}' apt-pkg/contrib/macros.h | sed 's/\.$//')"
librarysymbolsfromfile() {
local MISSING="$(grep '^+#MISSING' "$1")"
@@ -81,7 +81,7 @@ elif [ "$1" = 'pre-build' ]; then
echo "You probably want to run »./prepare-release pre-export« to fix this."
exit 1
fi
- NEWSDISTRIBUTION=$(dpkg-parsechangelog -l debian/NEWS | sed -n -e '/^Distribution:/s/^Distribution: //p')
+ NEWSDISTRIBUTION=$(dpkg-parsechangelog -l debian/NEWS -S 'Distribution')
if [ "$NEWSDISTRIBUTION" = 'UNRELEASED' ]; then
echo "changelog (${VERSION}) has a distribution (${DISTRIBUTION}) set, while the NEWS file hasn't!"
echo "You probably want to edit »debian/NEWS« to fix this."
@@ -89,7 +89,12 @@ elif [ "$1" = 'pre-build' ]; then
fi
fi
elif [ "$1" = 'post-build' ]; then
- if [ "$DISTRIBUTION" != "UNRELEASED" ]; then
+ FAILED=false
+ REPORT_FAILURE=false
+
+ if [ "$2" = '--report-failure' ]; then
+ REPORT_FAILURE=true
+ elif [ "$DISTRIBUTION" != "UNRELEASED" ]; then
echo >&2 "REMEMBER: Tag this release with »git tag -s ${VERSION}« if you are satisfied"
else
echo >&2 'REMEMBER: Change to a valid distribution before release'
@@ -103,6 +108,7 @@ elif [ "$1" = 'post-build' ]; then
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
+ FAILED=true
fi
done
sed -n '1,/^$/p' doc/guide.dbk > "$HEADERBLUEPRINT"
@@ -110,30 +116,35 @@ elif [ "$1" = 'post-build' ]; then
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
+ FAILED=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
+ if ! xmllint --path vendor/${DISTRO} --nonet --valid --noout $(find doc/ -maxdepth 1 -name '*.xml'); then
echo >&2 "WARNING: original docbook manpages have errors with vendor ${DISTRO}!"
+ FAILED=true
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)/ \
+ 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!"
+ FAILED=true
fi
else
echo >&2 "ERROR: translated manpages need to be build before they can be checked!"
+ FAILED=true
fi
- rm -f doc/apt-vendor.ent
+ if $REPORT_FAILURE && $FAILED; then
+ exit 1
+ fi
elif [ "$1" = 'library' ]; then
librarysymbols() {
local libname=$(echo "${1}" | cut -c 4-)