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