1 1.1 mrg #! /bin/bash 2 1.1 mrg 3 1.1 mrg # Update or check out GCC sources for a particular Subversion revision 4 1.1 mrg # and a particular branch. 5 1.1 mrg # 6 1.1 mrg # Copyright (C) 2007 Free Software Foundation. 7 1.1 mrg # 8 1.1 mrg # This file is free software; you can redistribute it and/or modify 9 1.1 mrg # it under the terms of the GNU General Public License as published by 10 1.1 mrg # the Free Software Foundation; either version 3 of the License, or 11 1.1 mrg # (at your option) any later version. 12 1.1 mrg # 13 1.1 mrg # This program is distributed in the hope that it will be useful, 14 1.1 mrg # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 1.1 mrg # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 1.1 mrg # GNU General Public License for more details. 17 1.1 mrg # 18 1.1 mrg # For a copy of the GNU General Public License, write the the 19 1.1 mrg # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 1.1 mrg # Boston, MA 02111-1301, USA. 21 1.1 mrg 22 1.1 mrg #set -ex 23 1.1 mrg 24 1.1 mrg if [ $# != 1 ]; then 25 1.1 mrg echo Usage: $0 id 26 1.1 mrg exit 1 27 1.1 mrg fi 28 1.1 mrg 29 1.1 mrg if [ "x${REG_DO_CLEANUPS}" != "x" ]; then 30 1.1 mrg reg_cleanup 31 1.1 mrg fi 32 1.1 mrg 33 1.1 mrg ID=$1 34 1.1 mrg BRANCH="" 35 1.1 mrg 36 1.1 mrg ######################################################################## 37 1.1 mrg # Get sources. 38 1.1 mrg ######################################################################## 39 1.1 mrg 40 1.1 mrg svn_get() { 41 1.1 mrg # In case there are problems with updates (there were with CVS), 42 1.1 mrg # creating a file called REMOVE in the REG_SRCDIR directory causes us 43 1.1 mrg # to start with a clean tree each time. 44 1.1 mrg 45 1.1 mrg unset LC_ALL 46 1.1 mrg unset LANG 47 1.1 mrg 48 1.1 mrg cd ${REG_SRCDIR} 49 1.1 mrg if [ -d gcc ]; then 50 1.1 mrg # There's already a tree; do an update with the new revision. 51 1.1 mrg cd gcc 52 1.1 mrg echo "`date` svn update begun for id ${ID}, rev ${REV}" 53 1.1 mrg echo svn update --non-interactive --revision ${REV} >> $LOG 54 1.1 mrg svn update --non-interactive --revision ${REV} >> $LOG 55 1.1 mrg if [ $? -eq 0 ]; then 56 1.1 mrg echo "`date` svn update done" 57 1.1 mrg else 58 1.1 mrg echo "`date` svn update failed" 59 1.1 mrg exit 1 60 1.1 mrg fi 61 1.1 mrg else 62 1.1 mrg echo "`date` svn checkout begun for id ${ID}, rev ${REV}" 63 1.1 mrg echo svn checkout --non-interactive --revision ${REV} \ 64 1.1 mrg ${REG_SVN_REPO}/${BRANCHPATH} gcc >> $LOG 65 1.1 mrg svn checkout --non-interactive --revision ${REV} \ 66 1.1 mrg ${REG_SVN_REPO}/${BRANCHPATH} gcc >> $LOG 67 1.1 mrg if [ $? -eq 0 ]; then 68 1.1 mrg echo "`date` svn checkout done" 69 1.1 mrg else 70 1.1 mrg echo "`date` svn checkout failed" 71 1.1 mrg exit 1 72 1.1 mrg fi 73 1.1 mrg cd gcc 74 1.1 mrg fi 75 1.1 mrg 76 1.1 mrg # Touch generated files. 77 1.1 mrg contrib/gcc_update --touch >> $LOG 78 1.1 mrg } 79 1.1 mrg 80 1.1 mrg ######################################################################## 81 1.1 mrg # Main program 82 1.1 mrg ######################################################################## 83 1.1 mrg 84 1.1 mrg cd ${REG_SRCDIR} 85 1.1 mrg 86 1.1 mrg # This is a simple way to stop a long regression search fairly cleanly; 87 1.1 mrg # just touch a file called STOP. 88 1.1 mrg 89 1.1 mrg if [ -f STOP ]; then 90 1.1 mrg echo "`date` $0 detected STOP file" 91 1.1 mrg rm -f STOP 92 1.1 mrg exit 1 93 1.1 mrg fi 94 1.1 mrg 95 1.1 mrg # Set up the log file. 96 1.1 mrg REV=`${REG_IDS} -f index -t rev ${ID}` 97 1.1 mrg LOG=${REG_SRCDIR}/logs/${BUGID}/${REV}.log 98 1.1 mrg mkdir -p ${REG_SRCDIR}/logs/${BUGID} 99 1.1 mrg rm -f $LOG 100 1.1 mrg touch $LOG 101 1.1 mrg 102 1.1 mrg # Get the branch for this patch. 103 1.1 mrg BRANCH=`${REG_IDS} -f index -t branch ${ID}` 104 1.1 mrg if [ "${BRANCH}" = "error" ]; then 105 1.1 mrg echo "`date` $0: cannot determine the SVN branch for id ${ID}" 106 1.1 mrg exit 1 107 1.1 mrg fi 108 1.1 mrg 109 1.1 mrg if [ "${BRANCH}" = "trunk" ]; then 110 1.1 mrg BRANCHPATH=trunk 111 1.1 mrg else 112 1.1 mrg BRANCHPATH=branches/${BRANCH} 113 1.1 mrg fi 114 1.1 mrg 115 1.1 mrg svn_get 116 1.1 mrg 117 1.1 mrg exit 0 118