#!/bin/bash -xv # Call this after all the changes have been checked into trunk. # usage: # switcher-generic [[build-num] 1] # if arg 2 is "1" then we'll try to make a branch. # if no buildnum is specified, we'll use the latest, otherwise use the num specified. source ~/src/svn/tools/trunk/env/setup-lps.sh # get the number of this build cd ~/src/svn/openlaszlo/trunk buildnum=${1:-`svn info -rHEAD | grep Revision | sed -e"s/Revision: //"`} makebranch=$2 echo using $buildnum branch="trunk" project="openlaszlo" buildname="build-openlaszlo-${branch}-${buildnum}" # tag the current build cd ~/src/svn/openlaszlo/${branch} if [ $2 = 1] ; then svn copy http://svn.openlaszlo.org/openlaszlo/trunk http://svn.openlaszlo.org/openlaszlo/builds/${buildname} -m "Automated build branch created by ben's scripts." if [ $? != 0 ] ; then echo "Problem making branch ${buildname}. Exiting." exit 1 fi else echo "Skipped making branch because arg 2 true" fi # Figure out where it's going export LPS_HOME=${HOME}/builds/${buildname} # If we don't already have an always-clean version of that branch, fetch # one now. (This will take ~20 minutes) if [ ! -d ~/src/svn/openlaszlo/trunk-always-clean ] ; then svn co http://svn.openlaszlo.org/openlaszlo/trunk ~/src/svn/openlaszlo/trunk-always-clean fi # Make a local deep copy of the always clean branch cp -r ~/src/svn/openlaszlo/trunk-always-clean ${LPS_HOME} # Update the clean tree to the tag we want cd ~/builds svn switch http://svn.openlaszlo.org/openlaszlo/builds/${buildname} cd ~/builds/${buildname} svn up -r${buildnum} ant dist-one-no-doc | tee ~/logs/${buildname}.log if [ $? != 0 ] ; then echo "BUILD FAILED." exit 1 else echo "BUILD SUCCEEDED." fi # todo: if build succeded, send happy mail and push, else send sad mail ~/src/svn/tools/trunk/build-tools/nightly/push-to-download.sh