* ChangeLog: Follow spelling conventions.
[official-gcc.git] / maintainer-scripts / update_version
blobbb94944710a34599ae83fdc50a21dc8692690e01
1 #!/bin/sh
3 # Run this from /tmp.
4 CVSROOT=${CVSROOT:-/cvs/gcc}
5 export CVSROOT
6 /bin/rm -rf /tmp/$$
7 /bin/mkdir /tmp/$$
8 cd /tmp/$$
10 # The path to cvs.
11 CVS=${CVS:-/usr/local/bin/cvs}
13 # Compute the branches which we should update.
14 $CVS co gcc/ChangeLog
15 BRANCHES=`$CVS status -v gcc/ChangeLog \
16 | awk '{print $1;}' \
17 | egrep 'gcc-[0-9]+_[0-9]+-branch$'`
18 # Always update the mainline.
19 BRANCHES="${BRANCHES} HEAD"
21 # ARGS is passed to 'cvs co'
22 CURR_DATE=`/bin/date +"%Y%m%d"`
24 # version is contained within a char*
25 textstring_FILES="gcc/gcc/version.c gcc/gcc/ada/gnatvsn.ads gcc/gcc/f/version.c gcc/libf2c/libF77/Version.c gcc/libf2c/libI77/Version.c gcc/libf2c/libU77/Version.c"
27 # version is contained within a #define
28 cppdefine_FILES="gcc/libstdc++-v3/include/bits/c++config"
30 # Assume all will go well.
31 RESULT=0
33 for BRANCH in $BRANCHES; do
34 # Check out the files on the branch. HEAD is a special case; if
35 # you check out files with -r HEAD, CVS will not let you check
36 # in changes.
37 if test "$BRANCH" = HEAD; then
38 ${CVS} co $textstring_FILES $cppdefine_FILES
39 else
40 ${CVS} co -r $BRANCH $textstring_FILES $cppdefine_FILES
43 # There are no files to commit yet.
44 COMMIT_FILES=""
46 for file in $textstring_FILES; do
47 if test -f $file; then
48 OLD_VERSION=`/bin/cat $file`
49 /bin/sed -e "s/\(.*\"[^ ]*\) [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/\1 ${CURR_DATE}/" >${file} <<HERE
50 $OLD_VERSION
51 HERE
53 COMMIT_FILES="$COMMIT_FILES $file"
55 done
57 for file in $cppdefine_FILES; do
58 if test -f $file; then
59 OLD_VERSION=`/bin/cat $file`
60 /bin/sed -e "s/\(#.*\) [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/\1 ${CURR_DATE}/" >${file} <<HERE
61 $OLD_VERSION
62 HERE
64 COMMIT_FILES="$COMMIT_FILES $file"
66 done
68 if test -n "$COMMIT_FILES" \
69 && ! ${CVS} commit -m "Daily bump." $COMMIT_FILES; then
70 # If we could not commit the files, indicate failure.
71 RESULT=1
74 # Remove the files.
75 rm -rf gcc
76 done
78 /bin/rm -rf /tmp/$$
79 exit $RESULT