* builtins.def: Fix typos.
[official-gcc.git] / maintainer-scripts / update_version
blobb8e8a1e7a5e0b748b63af4b004894f1633635bb7
1 #!/bin/sh
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'
7 # Run this from /tmp.
8 export CVSROOT
9 /bin/rm -rf /tmp/$$
10 /bin/mkdir /tmp/$$
11 cd /tmp/$$
13 # The path to cvs.
14 CVS=${CVS:-/usr/local/bin/cvs}
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}"
25 # ARGS is passed to 'cvs co'
26 CURR_DATE=`/bin/date +"%Y%m%d"`
28 # version is contained within a char*
29 textstring_FILES="gcc/gcc/version.c"
31 # version is contained within a #define
32 cppdefine_FILES="gcc/libstdc++-v3/include/bits/c++config"
34 # Assume all will go well.
35 RESULT=0
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
48 # There are no files to commit yet.
49 COMMIT_FILES=""
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}/"
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"
63 done
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}/"
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"
77 done
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
85 # Remove the files.
86 rm -rf gcc
87 done
89 /bin/rm -rf /tmp/$$
90 exit $RESULT