2010-07-27 Paolo Carlini <paolo.carlini@oracle.com>
[official-gcc/alias-decl.git] / maintainer-scripts / update_version_svn
blob736c990da822f21d13aac430dd8ba7bd11eaaba7
1 #!/bin/sh
3 # Update the current version date in all files in the tree containing
4 # it. Consider all release branches except those matching the regular
5 # expression in $IGNORE_BRANCHES, and also consider those branches listed
6 # in the space separated list in $ADD_BRANCHES.
8 SVNROOT=${SVNROOT:-"file:///svn/gcc"}
9 IGNORE_BRANCHES='gcc-(2_95|3_0|3_1|3_2|3_3|3_4|4_0|4_1|4_2)-branch'
10 ADD_BRANCHES='HEAD'
12 # Run this from /tmp.
13 export SVNROOT
14 /bin/rm -rf /tmp/$$
15 /bin/mkdir /tmp/$$
16 cd /tmp/$$
18 # The path to cvs.
19 SVN=${SVN:-/usr/bin/svn}
21 # Compute the branches which we should update.
22 BRANCHES=`$SVN ls $SVNROOT/branches \
23 | sed -e 's/\///' \
24 | egrep 'gcc-[0-9]+_[0-9]+-branch$' \
25 | egrep -v $IGNORE_BRANCHES`
26 # Always update the mainline.
27 BRANCHES="${BRANCHES} ${ADD_BRANCHES}"
29 # ARGS is passed to 'cvs co'
30 CURR_DATE=`/bin/date +"%Y%m%d"`
32 # version is all there is
33 datestamp_FILES="gcc/DATESTAMP"
35 FILES="$datestamp_FILES"
37 # Assume all will go well.
38 RESULT=0
39 for BRANCH in $BRANCHES; do
40 echo "Working on \"$BRANCH\"."
41 # Check out the files on the branch. HEAD is a special case; if
42 # you check out files with -r HEAD, CVS will not let you check
43 # in changes.
44 if test "$BRANCH" = HEAD; then
45 for i in $FILES; do
46 ${SVN} -q co -N ${SVNROOT}/trunk/`dirname $i` `basename $i`
47 done
48 else
49 for i in $FILES; do
50 ${SVN} -q co -N ${SVNROOT}/branches/${BRANCH}/`dirname $i` `basename $i`
51 done
54 # There are no files to commit yet.
55 COMMIT_FILES=""
57 for file in $datestamp_FILES; do
58 dirname=`basename $file`
59 file=`basename $file`
60 file="$dirname/$file"
61 if test -f $file; then
62 echo ${CURR_DATE} > $file.new
64 if /usr/bin/cmp -s $file $file.new; then
65 rm -f $file.new
66 else
67 mv -f $file.new $file
68 COMMIT_FILES="$COMMIT_FILES $file"
71 done
73 if test -n "$COMMIT_FILES"; then
74 for i in $COMMIT_FILES; do
75 echo "Attempting to commit $i"
76 if ! ${SVN} commit -m "Daily bump." $i; then
77 # If we could not commit the files, indicate failure.
78 RESULT=1
80 done
83 # Remove the files.
84 for i in $FILES; do
85 rm -rf /tmp/$$/`basename $i`
86 done
87 done
89 /bin/rm -rf /tmp/$$
90 exit $RESULT