| 1 |
#! /bin/bash |
| 2 |
|
| 3 |
# Update or check out GCC sources for a particular Subversion revision |
| 4 |
# and a particular branch. |
| 5 |
# |
| 6 |
# Copyright (C) 2007-2025 Free Software Foundation, Inc. |
| 7 |
# |
| 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. |
| 12 |
# |
| 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. |
| 17 |
# |
| 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. |
| 21 |
|
| 22 |
#set -ex |
| 23 |
|
| 24 |
if [ $# != 1 ]; then |
| 25 |
echo Usage: $0 id |
| 26 |
exit 1 |
| 27 |
fi |
| 28 |
|
| 29 |
if [ "x${REG_DO_CLEANUPS}" != "x" ]; then |
| 30 |
reg_cleanup |
| 31 |
fi |
| 32 |
|
| 33 |
ID=$1 |
| 34 |
BRANCH="" |
| 35 |
|
| 36 |
######################################################################## |
| 37 |
# Get sources. |
| 38 |
######################################################################## |
| 39 |
|
| 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. |
| 44 |
|
| 45 |
unset LC_ALL |
| 46 |
unset LANG |
| 47 |
|
| 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 |
| 60 |
fi |
| 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 |
| 72 |
fi |
| 73 |
cd gcc |
| 74 |
fi |
| 75 |
|
| 76 |
# Touch generated files. |
| 77 |
contrib/gcc_update --touch >> $LOG |
| 78 |
} |
| 79 |
|
| 80 |
######################################################################## |
| 81 |
# Main program |
| 82 |
######################################################################## |
| 83 |
|
| 84 |
cd ${REG_SRCDIR} |
| 85 |
|
| 86 |
# This is a simple way to stop a long regression search fairly cleanly; |
| 87 |
# just touch a file called STOP. |
| 88 |
|
| 89 |
if [ -f STOP ]; then |
| 90 |
echo "`date` $0 detected STOP file" |
| 91 |
rm -f STOP |
| 92 |
exit 1 |
| 93 |
fi |
| 94 |
|
| 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 |
| 101 |
|
| 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 |
| 107 |
fi |
| 108 |
|
| 109 |
if [ "${BRANCH}" = "trunk" ]; then |
| 110 |
BRANCHPATH=trunk |
| 111 |
else |
| 112 |
BRANCHPATH=branches/${BRANCH} |
| 113 |
fi |
| 114 |
|
| 115 |
svn_get |
| 116 |
|
| 117 |
exit 0 |