Skip to content

Instantly share code, notes, and snippets.

@pamaury
Last active December 5, 2016 13:18
Show Gist options
  • Save pamaury/c33702b4306bc18cfe24282975f0a483 to your computer and use it in GitHub Desktop.
Save pamaury/c33702b4306bc18cfe24282975f0a483 to your computer and use it in GitHub Desktop.
#/bin/bash
TMPDIR="./tmp-build-all"
function usage()
{
echo "Usage: $0 <build file>"
echo "Example:"
echo "$0 ../www/buildserver/builds"
exit 1
}
# check number of arguments
if [ $# -le 0 ]; then
usage
fi
# print invocation, for reference
echo "#invocation $0 $*"
# build file
BUILD_FILE="$1"
# check build file
if [ ! -f $BUILD_FILE ]; then
echo "ERROR: build file doesn't exist"
exit 2
fi
# process lines in the build
while read line
do
# ignore wps and manual lines, also sim
if `echo "$line" | grep -E "(wps)|(manual)|(sim)" &> /dev/null`; then
continue
fi
# format of each line: compiler:x:name:title:file:hint:command
NAME=`echo "$line" | awk 'BEGIN { FS=":" } { print $3 }'`
CMD=`echo "$line" | awk 'BEGIN { FS=":" } { print $7 }'`
# remove temporary directory
rm -rf "$TMPDIR"
# create temporary directory and cd into it
mkdir "$TMPDIR"
cd "$TMPDIR"
# the command extract is of the form
# ../tools/configure <options> && make <blabla>
# try to run configure
# it might error if the target compiler is not installed for example
if eval $CMD &>/dev/null; then
echo "$NAME: ok"
else
# print config error
echo "$NAME: <config/build error>"
fi
# cd back to root
cd ..
done < "$BUILD_FILE"
# remove everything
rm -rf "$TMPDIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment