1 #! /bin/bash 2 3 #set -ex 4 5 # Update an SVN tree for a particular date. 6 7 if [ $# != 1 ]; then 8 echo Usage: $0 id 9 exit 1 10 fi 11 12 if [ "x${REG_DO_CLEANUPS}" != "x" ]; then 13 reg_cleanup 14 fi 15 16 ID=$1 17 BRANCH="" 18 19 ######################################################################## 20 # Get sources. 21 ######################################################################## 22 23 svn_get() { 24 # In case there are problems with updates (there were with CVS), 25 # creating a file called REMOVE in the REG_SRCDIR directory causes us 26 # to start with a clean tree each time. 27 28 unset LC_ALL 29 unset LANG 30 31 cd ${REG_SRCDIR} 32 if [ -d gcc ]; then 33 # There's already a tree; do an update with the new revision. 34 cd gcc 35 echo "`date` svn update begun for id ${ID}, rev ${REV} (fix)" 36 echo svn update --non-interactive --revision ${REV} >> $LOG 37 svn update --non-interactive --revision ${REV} >> $LOG 38 if [ $? -eq 0 ]; then 39 echo "`date` svn update done" 40 else 41 echo "`date` svn update failed" 42 exit 1 43 fi 44 else 45 echo "`date` svn checkout begun for id ${ID}, rev ${REV}" 46 echo svn checkout --non-interactive --revision ${REV} \ 47 ${REG_SVN_REPO}/${BRANCHPATH} gcc >> $LOG 48 svn checkout --non-interactive --revision ${REV} \ 49 ${REG_SVN_REPO}/${BRANCHPATH} gcc >> $LOG 50 if [ $? -eq 0 ]; then 51 echo "`date` svn checkout done" 52 else 53 echo "`date` svn checkout failed" 54 exit 1 55 fi 56 cd gcc 57 fi 58 59 # Touch generated files. 60 contrib/gcc_update --touch >> $LOG 61 } 62 63 ######################################################################## 64 # Main program 65 ######################################################################## 66 67 cd ${REG_SRCDIR} 68 69 # This is a simple way to stop a long regression search fairly cleanly; 70 # just touch a file called STOP. 71 72 if [ -f STOP ]; then 73 echo "`date` $0 detected STOP file" 74 rm -f STOP 75 exit 1 76 fi 77 78 # Set up the log file. 79 REV=`${REG_IDS} -f index -t rev ${ID}` 80 LOG=${REG_SRCDIR}/logs/${BUGID}/${REV}.log 81 mkdir -p ${REG_SRCDIR}/logs/${BUGID} 82 rm -f $LOG 83 touch $LOG 84 85 # Get the branch for this patch. 86 BRANCH=`${REG_IDS} -f index -t branch ${ID}` 87 if [ "${BRANCH}" = "error" ]; then 88 echo "`date` $0: cannot determine the SVN branch for id ${ID}" 89 exit 1 90 fi 91 92 if [ "${BRANCH}" = "trunk" ]; then 93 BRANCHPATH=trunk 94 else 95 BRANCHPATH=branches/${BRANCH} 96 fi 97 98 svn_get 99 100 # Look for a patch that's needed for this revision to build. 101 FIX=${REG_PATCHES}/${REV}.fix 102 echo "`date` looking for $FIX" 103 if [ -f $FIX ]; then 104 echo "`date` fix needed; checking whether it is already applied" 105 cd ${REG_SRCDIR}/gcc 106 patch --dry-run -s -p0 -i $FIX < /dev/null > /dev/null 2>&1 107 if [ $? -eq 0 ]; then 108 echo "`date` applying fix" 109 patch -s -p0 -i $FIX 110 fi 111 fi 112 113 exit 0 114