Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- REPONAME="xxx"
- REPOUSER="xxx"
- REPOPASS="xxx"
- REPOS="$1"
- REV="$2"
- SVNBUILDREPO="svn://localhost/$REPONAME/build"
- PHINGBUILDPATH="/var/phing/builds/$REPONAME.build"
- LOG="/tmp/hook.log"
- modified=$(svnlook dirs-changed "$REPOS" --revision "$REV")
- dotrunk=$(echo "$modified"|grep -E '^trunk/')
- dotesting=$(echo "$modified"|grep -E '^branches/testing')
- dostagingsherborne=$(echo "$modified"|grep -E '^branches/staging.sherborne')
- dostagingqatar=$(echo "$modified"|grep -E '^branches/staging.qatar')
- dolive=$(echo "$modified"|grep -E '^branches/live')
- build=$(echo "$modified"|grep -E '^build/')
- echo "====================================" >> $LOG 2>&1
- echo "Commited branches: " >> $LOG 2>&1
- echo "====================================" >> $LOG 2>&1
- if [ -n "$dotrunk" ]
- then
- echo "TRUNK" >> $LOG 2>&1
- fi
- if [ -n "$dotesting" ]
- then
- echo "TESTING" >> $LOG 2>&1
- fi
- if [ -n "$dostagingsherborne" ]
- then
- echo "staging sherborne" >> $LOG 2>&1
- fi
- if [ -n "$dostagingqatar" ]
- then
- echo "staging qatar" >> $LOG 2>&1
- fi
- if [ -n "$dolive" ]
- then
- echo "LIVE" >> $LOG 2>&1
- fi
- if [ -n "$build" ]
- then
- echo "BUILD" >> $LOG 2>&1
- echo "Exporting build" >> $LOG 2>&1
- if [ -d "$PHINGBUILDPATH" ]
- then
- rm -rf "$PHINGBUILDPATH" >> $LOG 2>&1
- fi
- svn export "$SVNBUILDREPO" "$PHINGBUILDPATH" >> $LOG 2>&1
- fi
- echo "====================================" >> $LOG 2>&1
- echo "PROCESSING BUILDS" >> $LOG 2>&1
- echo "====================================" >> $LOG 2>&1
- PD=$PWD;
- if [ ! -d $PHINGBUILDPATH ]
- then
- svn export "$SVNBUILDREPO" "$PHINGBUILDPATH" --username "$REPOUSER" --password "$REPOPASS" >> $LOG 2>&1
- fi
- if [ ! -d $PHINGBUILDPATH ]
- then
- echo "ERROR COULD NOT CREATE BUILD" >> $LOG 2>&1
- exit 1
- fi
- cd "$PHINGBUILDPATH" || exit 1
- targets=$(phing -l|grep -E '^ (staging|testing|live|trunk)')
- trunkbuildavailable=$(echo $targets|grep trunk)
- sherbornestagingbuildavailable=$(echo $targets|grep staging.sherborne)
- qatarstagingbuildavailable=$(echo $targets|grep staging.qatar)
- testingbuildavailable=$(echo $targets|grep testing)
- livebuildavailable=$(echo "$targets"|grep live)
- if [ -n "$trunkbuildavailable" ] && [ -n "$dotrunk" ]
- then
- echo "Building TRUNK"
- phing testing >> $LOG 2>&1
- fi
- if [ -n "$testingbuildavailable" ] && [ -n "$dotesting" ]
- then
- echo "Building TESTING"
- phing testing >> $LOG 2>&1
- fi
- if [ -n "$sherbornestagingbuildavailable" ] && [ -n "$dostagingsherborne" ]
- then
- echo "Building STAGING.SHERBORNE"
- phing staging.sherborne >> $LOG 2>&1
- fi
- if [ -n "$qatarstagingbuildavailable" ] && [ -n "$dostagingqatar" ]
- then
- echo "Building STAGING.QATAR"
- phing staging.qatar >> $LOG 2>&1
- fi
- if [ -n "$livebuildavailable" ] && [ -n "$dolive" ]
- then
- echo "Building LIVE"
- phing live >> $LOG 2>&1
- fi
- cd $PD
Add Comment
Please, Sign In to add comment