OSDN Git Service

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