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