OSDN Git Service

Moved to subversion
[pf3gnuchains/gcc-fork.git] / maintainer-scripts / update_version_svn
1 #!/bin/sh
2 #
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 $ADD_BRANCHES.
7
8 SVNROOT=${SVNROOT:-"file:///svn/gcc"}
9 IGNORE_BRANCHES='gcc-(2_95|3_0|3_1|3_2|3_3)-branch'
10 ADD_BRANCHES='HEAD autovect-branch dfp-branch'
11
12 # Run this from /tmp.
13 export SVNROOT
14 /bin/rm -rf /tmp/$$
15 /bin/mkdir /tmp/$$
16 cd /tmp/$$
17
18 # The path to cvs.
19 SVN=${SVN:-/usr/bin/svn}
20
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
27 # Always update the mainline.
28 BRANCHES="${BRANCHES} ${ADD_BRANCHES}"
29 BRANCHES="HEAD"
30 # ARGS is passed to 'cvs co'
31 CURR_DATE=`/bin/date +"%Y%m%d"`
32
33 # version is contained within a char*
34 textstring_FILES="gcc/version.c"
35
36 # version is contained within a #define
37 cppdefine_FILES="libstdc++-v3/include/bits/c++config"
38
39 # version is all there is
40 datestamp_FILES="gcc/DATESTAMP"
41
42 FILES="$textstring_FILES $cppdefine_FILES $datestamp_FILES"
43 DIRS="$textstring_DIRS $cppdefine_DIRS $datestamp_DIRS"
44
45 # Assume all will go well.
46 RESULT=0
47 for BRANCH in $BRANCHES; do
48   echo "Working on \"$BRANCH\"."
49   # Check out the files on the branch.  HEAD is a special case; if
50   # you check out files with -r HEAD, CVS will not let you check 
51   # in changes.
52   if test "$BRANCH" = HEAD; then 
53     for i in $FILES; do
54       ${SVN} co -N ${SVNROOT}/trunk/`dirname $i` `basename $i`
55     done
56   else
57     for i in $FILES; do
58       ${SVN} co -N ${SVNROOT}/branches/${BRANCH}/`dirname $i` `basename $i`
59     done
60   fi
61
62   # There are no files to commit yet.
63   COMMIT_FILES=""
64    
65   for file in $textstring_FILES; do
66     dirname=`basename $file`
67     file=`basename $file`
68     file="$dirname/$file"
69     echo "$file"
70     exit 0;
71     if test -f $file; then 
72       /bin/sed  <$file >$file.new -e \
73   "s/\(.*\"[^ ]*\) [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/\1 ${CURR_DATE}/" 
74
75       if /usr/bin/cmp -s $file $file.new; then
76         rm -f $file.new
77       else
78         mv -f $file.new $file
79         COMMIT_FILES="$COMMIT_FILES $file"
80       fi
81     fi
82   done
83   for file in $cppdefine_FILES; do
84     dirname=`basename $file`
85     file=`basename $file`
86     file="$dirname/$file"
87     if test -f $file; then
88       /bin/sed <$file >$file.new -e \
89   "s/\(#.*\) [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/\1 ${CURR_DATE}/"
90
91       if /usr/bin/cmp -s $file $file.new; then
92         rm -f $file.new
93       else
94         mv -f $file.new $file
95         COMMIT_FILES="$COMMIT_FILES $file"
96       fi
97     fi
98   done
99
100   for file in $datestamp_FILES; do
101     dirname=`basename $file`
102     file=`basename $file`
103     file="$dirname/$file"
104     if test -f $file; then
105       echo ${CURR_DATE} > $file.new
106
107       if /usr/bin/cmp -s $file $file.new; then
108         rm -f $file.new
109       else
110         mv -f $file.new $file
111         COMMIT_FILES="$COMMIT_FILES $file"
112       fi
113     fi
114   done
115   echo "$COMMIT_FILES"  
116   if test -n "$COMMIT_FILES"; then
117     for i in $COMMIT_FILES; do
118     echo "Attempting to commit $i"
119     if ! ${SVN} commit -m "Daily bump." $i; then
120        # If we could not commit the files, indicate failure.
121        RESULT=1
122      fi
123     done
124   fi
125   
126   # Remove the files.
127   for i in $FILES; do
128    rm -rf /tmp/$$/`basename $i`
129   done
130 done
131
132 /bin/rm -rf /tmp/$$
133 exit $RESULT