* gnatvsn.ads: Bump copyright year.
[official-gcc.git] / contrib / reghunt / bin / gcc-svn-update-fix
blob9775055022aae53a9d353abbfce0ac6b2188bf7e
1 #! /bin/bash
3 #set -ex
5 # Update an SVN tree for a particular date.
7 if [ $# != 1 ]; then
8 echo Usage: $0 id
9 exit 1
12 if [ "x${REG_DO_CLEANUPS}" != "x" ]; then
13 reg_cleanup
16 ID=$1
17 BRANCH=""
19 ########################################################################
20 # Get sources.
21 ########################################################################
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.
28 unset LC_ALL
29 unset LANG
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
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
56 cd gcc
59 # Touch generated files.
60 contrib/gcc_update --touch >> $LOG
63 ########################################################################
64 # Main program
65 ########################################################################
67 cd ${REG_SRCDIR}
69 # This is a simple way to stop a long regression search fairly cleanly;
70 # just touch a file called STOP.
72 if [ -f STOP ]; then
73 echo "`date` $0 detected STOP file"
74 rm -f STOP
75 exit 1
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
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
92 if [ "${BRANCH}" = "trunk" ]; then
93 BRANCHPATH=trunk
94 else
95 BRANCHPATH=branches/${BRANCH}
98 svn_get
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
113 exit 0