oolite/tools/mknightly

89 lines
1.9 KiB
Bash
Executable File

#!/bin/sh
# This shell script is used to make a nightly GNUstep/SDL build from
# cron. It is intended to update an rsync repository.
#
# Arguments:
# tools/mknightly <destination>
#
# where destination is the rsync repository. The destination must already
# exist.
#
# The script should be run from the root of the svn working copy.
#
# Dylan Smith, 2006-03-10
#
OS=`uname`
CPU=`uname -m`
VERSION=`grep SoftwareVersion installers/autopackage/default.x86.apspec|cut -d ' ' -f 2`
DESTINATION=$1
TREEROOT=`pwd`
if [ "$DESTINATION" == "" ]
then
echo "Usage: tools/mknightly <destination>"
exit 255
fi
if [ "$VERSION" == "" ]
then
echo "I can't find the apspec file. This script needs to be run from"
echo "the repository top level directory to find all it needs."
exit 255
fi
svn up >/dev/null
if [ $? != 0 ]
then
echo "Nightly build could not svn up"
exit 255
fi
# check whether we should even bother building
LASTBUILD=`cat LASTBUILD`
THISBUILD=`svn info . | grep Revision | cut -d ' ' -f 2`
if [ $? != 0 ]
then
echo "Could not get build revision"
exit 255
fi
if [ "$LASTBUILD" == "$THISBUILD" ]
then
echo "Nightly build up to date - lastbuild=$LASTBUILD thisbuild=$THISBUILD"
exit 0
fi
if [ "$CPU" == 'i686' ]
then
CPU="x86"
fi
DEPSDIR="$TREEROOT/deps/$OS-$CPU-deps"
if [ ! -d $DEPSDIR ]
then
echo "Dependencies directory $DEPSDIR not found"
exit 255
fi
make > make.out 2> make.error
if [ $? != 0 ]
then
echo "Oolite mknightly died."
exit $?
fi
echo $THISBUILD > LASTBUILD
svn log > $DESTINATION/changelog.txt
cp -rf oolite.app $DESTINATION
cd $DEPSDIR
cp -rf oolite-deps $DESTINATION
find $DESTINATION -name .svn -exec rm -rf {} \; 2>/dev/null
cd $DESTINATION
echo $VERSION-$THISBUILD > release.txt
echo "Oolite-$OS $CPU (`whoami`@`uname -n`) SVN revision $THISBUILD" \
> buildinfo.txt
echo "Build date: `date`" >> buildinfo.txt
echo "Nightly build complete for Oolite-$OS version $VERSION-$THISBUILD"