OSDN Git Service

* snapshot-README: Refer to .bz2 files instead of .gz files.
[pf3gnuchains/gcc-fork.git] / maintainer-scripts / update_version
1 #!/bin/sh 
2
3 CVSROOT=${CVSROOT:-/cvs/gcc}
4 IGNORE_BRANCHES='gcc-(2_95|3_0|3_1|3_2)-branch'
5 ADD_BRANCHES='HEAD tree-ssa-20020619-branch'
6
7 # Run this from /tmp.
8 export CVSROOT
9 /bin/rm -rf /tmp/$$
10 /bin/mkdir /tmp/$$
11 cd /tmp/$$
12
13 # The path to cvs.
14 CVS=${CVS:-/usr/local/bin/cvs}
15
16 # Compute the branches which we should update.
17 $CVS co gcc/ChangeLog
18 BRANCHES=`$CVS status -v gcc/ChangeLog \
19           | awk '{print $1;}' \
20           | egrep 'gcc-[0-9]+_[0-9]+-branch$' \
21           | egrep -v $IGNORE_BRANCHES`
22 # Always update the mainline.
23 BRANCHES="${BRANCHES} ${ADD_BRANCHES}"
24
25 # ARGS is passed to 'cvs co'
26 CURR_DATE=`/bin/date +"%Y%m%d"`
27
28 # version is contained within a char*
29 textstring_FILES="gcc/gcc/version.c"
30
31 # version is contained within a #define
32 cppdefine_FILES="gcc/libstdc++-v3/include/bits/c++config"
33
34 # Assume all will go well.
35 RESULT=0
36
37 for BRANCH in $BRANCHES; do
38   echo "Working on \"$BRANCH\"."
39   # Check out the files on the branch.  HEAD is a special case; if
40   # you check out files with -r HEAD, CVS will not let you check 
41   # in changes.
42   if test "$BRANCH" = HEAD; then 
43     ${CVS} co $textstring_FILES $cppdefine_FILES
44   else
45     ${CVS} co -r $BRANCH $textstring_FILES $cppdefine_FILES
46   fi
47
48   # There are no files to commit yet.
49   COMMIT_FILES=""
50
51   for file in $textstring_FILES; do
52     if test -f $file; then 
53       /bin/sed  <$file >$file.new -e \
54   "s/\(.*\"[^ ]*\) [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/\1 ${CURR_DATE}/" 
55
56       if /usr/bin/cmp -s $file $file.new; then
57         rm -f $file.new
58       else
59         mv -f $file.new $file
60         COMMIT_FILES="$COMMIT_FILES $file"
61       fi
62     fi
63   done
64
65   for file in $cppdefine_FILES; do
66     if test -f $file; then
67       /bin/sed <$file >$file.new -e \
68   "s/\(#.*\) [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/\1 ${CURR_DATE}/"
69
70       if /usr/bin/cmp -s $file $file.new; then
71         rm -f $file.new
72       else
73         mv -f $file.new $file
74         COMMIT_FILES="$COMMIT_FILES $file"
75       fi
76     fi
77   done
78
79   if test -n "$COMMIT_FILES" \
80      && ! ${CVS} commit -m "Daily bump." $COMMIT_FILES; then
81     # If we could not commit the files, indicate failure.
82     RESULT=1
83   fi
84
85   # Remove the files.
86   rm -rf gcc
87 done
88
89 /bin/rm -rf /tmp/$$
90 exit $RESULT