1193323Sed#! /bin/bash 2193323Sed 3193323Sed# Update or check out GCC sources for a particular Subversion revision 4193323Sed# and a particular branch. 5193323Sed# 6193323Sed# Copyright (C) 2007 Free Software Foundation. 7193323Sed# 8193323Sed# This file is free software; you can redistribute it and/or modify 9193323Sed# it under the terms of the GNU General Public License as published by 10193323Sed# the Free Software Foundation; either version 3 of the License, or 11193323Sed# (at your option) any later version. 12193323Sed# 13193323Sed# This program is distributed in the hope that it will be useful, 14193323Sed# but WITHOUT ANY WARRANTY; without even the implied warranty of 15198090Srdivacky# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16193323Sed# GNU General Public License for more details. 17193323Sed# 18218893Sdim# For a copy of the GNU General Public License, write the the 19193323Sed# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20198090Srdivacky# Boston, MA 02111-1301, USA. 21198090Srdivacky 22193323Sed#set -ex 23193323Sed 24205407Srdivackyif [ $# != 1 ]; then 25198090Srdivacky echo Usage: $0 id 26198090Srdivacky exit 1 27221345Sdimfi 28198090Srdivacky 29198090Srdivackyif [ "x${REG_DO_CLEANUPS}" != "x" ]; then 30193323Sed reg_cleanup 31193323Sedfi 32193323Sed 33218893SdimID=$1 34218893SdimBRANCH="" 35218893Sdim 36218893Sdim######################################################################## 37218893Sdim# Get sources. 38218893Sdim######################################################################## 39218893Sdim 40221345Sdimsvn_get() { 41218893Sdim # In case there are problems with updates (there were with CVS), 42221345Sdim # creating a file called REMOVE in the REG_SRCDIR directory causes us 43221345Sdim # to start with a clean tree each time. 44218893Sdim 45218893Sdim unset LC_ALL 46198090Srdivacky unset LANG 47198090Srdivacky 48198090Srdivacky cd ${REG_SRCDIR} 49198090Srdivacky if [ -d gcc ]; then 50193323Sed # There's already a tree; do an update with the new revision. 51198090Srdivacky cd gcc 52198090Srdivacky echo "`date` svn update begun for id ${ID}, rev ${REV}" 53218893Sdim echo svn update --non-interactive --revision ${REV} >> $LOG 54218893Sdim svn update --non-interactive --revision ${REV} >> $LOG 55218893Sdim if [ $? -eq 0 ]; then 56218893Sdim echo "`date` svn update done" 57218893Sdim else 58218893Sdim echo "`date` svn update failed" 59218893Sdim exit 1 60218893Sdim fi 61218893Sdim else 62218893Sdim echo "`date` svn checkout begun for id ${ID}, rev ${REV}" 63218893Sdim echo svn checkout --non-interactive --revision ${REV} \ 64218893Sdim ${REG_SVN_REPO}/${BRANCHPATH} gcc >> $LOG 65218893Sdim svn checkout --non-interactive --revision ${REV} \ 66193323Sed ${REG_SVN_REPO}/${BRANCHPATH} gcc >> $LOG 67193323Sed if [ $? -eq 0 ]; then 68193323Sed echo "`date` svn checkout done" 69198090Srdivacky else 70198090Srdivacky echo "`date` svn checkout failed" 71198090Srdivacky exit 1 72198090Srdivacky fi 73193323Sed cd gcc 74218893Sdim fi 75208599Srdivacky 76203954Srdivacky # Touch generated files. 77193323Sed contrib/gcc_update --touch >> $LOG 78193323Sed} 79193323Sed 80193323Sed######################################################################## 81193323Sed# Main program 82193323Sed######################################################################## 83193323Sed 84193323Sedcd ${REG_SRCDIR} 85193323Sed 86193323Sed# This is a simple way to stop a long regression search fairly cleanly; 87193323Sed# just touch a file called STOP. 88193323Sed 89193323Sedif [ -f STOP ]; then 90198090Srdivacky echo "`date` $0 detected STOP file" 91198090Srdivacky rm -f STOP 92198090Srdivacky exit 1 93193323Sedfi 94193323Sed 95193323Sed# Set up the log file. 96198090SrdivackyREV=`${REG_IDS} -f index -t rev ${ID}` 97198090SrdivackyLOG=${REG_SRCDIR}/logs/${BUGID}/${REV}.log 98198090Srdivackymkdir -p ${REG_SRCDIR}/logs/${BUGID} 99193323Sedrm -f $LOG 100193323Sedtouch $LOG 101193323Sed 102193323Sed# Get the branch for this patch. 103193323SedBRANCH=`${REG_IDS} -f index -t branch ${ID}` 104193323Sedif [ "${BRANCH}" = "error" ]; then 105193323Sed echo "`date` $0: cannot determine the SVN branch for id ${ID}" 106193323Sed exit 1 107193323Sedfi 108193323Sed 109193323Sedif [ "${BRANCH}" = "trunk" ]; then 110193323Sed BRANCHPATH=trunk 111193323Sedelse 112193323Sed BRANCHPATH=branches/${BRANCH} 113193323Sedfi 114193323Sed 115193323Sedsvn_get 116193323Sed 117193323Sedexit 0 118193323Sed