]>
git.saurik.com Git - wxWidgets.git/blob - build/buildbot/tools/validate.sh
2 #############################################################################
4 # Purpose: Reports errors in wxWidgets buildbot configuration files
5 # Author: Mike Wetherell
7 # Copyright: (c) 2007 Mike Wetherell
8 # Licence: wxWidgets licence
9 #############################################################################
11 if [ $# -eq 0 -o ! -f "$1" ]; then
12 echo "Usage: $0 FILE..."
13 echo "Reports errors in wxWidgets buildbot configuration files"
18 WORKDIR
="${TMPDIR:-/tmp}/wx.$$"
19 mkdir "$WORKDIR" || exit
20 trap 'rm -rf "$WORKDIR"' EXIT
21 WORKPAT
=`echo "$WORKDIR" | sed 's|[^A-Za-z0-9/]|.|g'`
23 # Change the names of the temporary files in an error message to something
24 # to something more informative
30 sed "s|file ${WORKPAT}|${WORKPAT}|g;\
31 s|${WORKPAT}/XSLT|generated XSLT (from $NAME)|g;\
32 s|${WORKPAT}/prep|$NAME (preprocessed)|g"
36 # This is pretty ugly, sorry. It tries not to print the same error more than
37 # once, and it tries to send success message to stdout and errors to stderr.
38 # It still doesn't return a meaningful exit code.
43 NAME
="`echo \"$INPUT\" | sed 's/[|\]/\\\&/g'`"
45 OUTPUT
="$WORKDIR/prep"
47 if STDERR
=`xsltproc --xinclude -o "$XSLT" $DIR/embedded.xsl "$INPUT" 2>&1`
49 STDERR
=`xsltproc --xinclude -o "$OUTPUT" "$XSLT" "$INPUT" 2>&1` \
50 && OK
=true
|| OK
=false
54 STDERR
=`xmllint --noout --schema $DIR/bot.xsd "$OUTPUT" 2>&1` \
56 error
"$STDERR" >&$OUT
62 rm -f "$XSLT" "$OUTPUT"