X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fa5a0e70640118cc7f9fac0ccc95da7579c57bd1..ee3de647ffd5891138864d032bc0f2bd5a130ef0:/build/buildbot/tools/check.sh diff --git a/build/buildbot/tools/check.sh b/build/buildbot/tools/check.sh index 874bf7bf10..32ce7ebaa5 100755 --- a/build/buildbot/tools/check.sh +++ b/build/buildbot/tools/check.sh @@ -1,16 +1,15 @@ #!/bin/sh ############################################################################# # Name: check.sh -# Purpose: Check embedded xslt +# Purpose: Offline checker for the buildbot configuration files # Author: Mike Wetherell -# RCS-ID: $Id$ # Copyright: (c) 2007 Mike Wetherell -# Licence: wxWidgets licence +# Licence: wxWindows licence ############################################################################# usage() { echo "Usage: $0 [options] FILE..." - echo "Check embedded xslt" + echo "Offline checker for the buildbot configuration files" echo echo "Options:" echo " -g generate xslt" @@ -26,6 +25,14 @@ badopt() { exit 1 } +progcheck() { + prog="$1" + $prog --version >/dev/null 2>&1 || { + echo "$0: requires $prog, not found" >&2 + exit 1 + } +} + GENERATE=1 PREPROCESS=2 VALIDATE=3 @@ -52,6 +59,12 @@ if [ $# -eq 0 ]; then usage fi +XSLTPROC=xsltproc +XMLLINT=xmllint + +progcheck $XSLTPROC +progcheck $XMLLINT + DIR="`dirname $0`" WORKDIR="${TMPDIR:-/tmp}/wx.$$" mkdir "$WORKDIR" || exit @@ -102,7 +115,7 @@ generate() { INPUT="$1" - if xsltproc --xinclude -o "$XSLT" $DIR/embedded.xsl "$INPUT" 2>"$STDERR" && + if $XSLTPROC --xinclude -o "$XSLT" $DIR/embedded.xsl "$INPUT" 2>"$STDERR" && test \! -s "$STDERR" then if [ $MODE -eq $GENERATE ]; then @@ -121,7 +134,7 @@ preprocess() return 0 fi - if xsltproc --xinclude -o "$PREP" "$XSLT" "$INPUT" 2>"$STDERR" && + if $XSLTPROC --xinclude -o "$PREP" "$XSLT" "$INPUT" 2>"$STDERR" && test \! -s "$STDERR" then if [ $MODE -eq $PREPROCESS ]; then @@ -131,7 +144,7 @@ preprocess() return 1 fi } - + validate() { NAME="$1" @@ -140,7 +153,7 @@ validate() return 0 fi - if xmllint --noout --schema $DIR/bot.xsd "$PREP" 2>"$STDERR" + if $XMLLINT --noout --schema $DIR/bot.xsd "$PREP" 2>"$STDERR" then errout "$NAME" else @@ -160,7 +173,7 @@ while [ $# -gt 0 ]; do errout "$NAME" >&2 ERR=1 } - + rm -f "$XSLT" "$PREP" "$STDERR" shift