comparison maintainer-scripts/update_version_svn @ 0:a06113de4d67

first commit
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2009 14:47:48 +0900
parents
children 77e2b8dfacca
comparison
equal deleted inserted replaced
-1:000000000000 0:a06113de4d67
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 the space separated list in $ADD_BRANCHES.
7
8 SVNROOT=${SVNROOT:-"file:///svn/gcc"}
9 IGNORE_BRANCHES='gcc-(2_95|3_0|3_1|3_2|3_3|3_4|4_0|4_1)-branch'
10 ADD_BRANCHES='HEAD'
11
12 # Run this from /tmp.
13 export SVNROOT
14 /bin/rm -rf /tmp/$$
15 /bin/mkdir /tmp/$$
16 cd /tmp/$$
17
18 # The path to cvs.
19 SVN=${SVN:-/usr/bin/svn}
20
21 # Compute the branches which we should update.
22 BRANCHES=`$SVN ls $SVNROOT/branches \
23 | sed -e 's/\///' \
24 | egrep 'gcc-[0-9]+_[0-9]+-branch$' \
25 | egrep -v $IGNORE_BRANCHES`
26 # Always update the mainline.
27 BRANCHES="${BRANCHES} ${ADD_BRANCHES}"
28
29 # ARGS is passed to 'cvs co'
30 CURR_DATE=`/bin/date +"%Y%m%d"`
31
32 # version is all there is
33 datestamp_FILES="gcc/DATESTAMP"
34
35 FILES="$datestamp_FILES"
36
37 # Assume all will go well.
38 RESULT=0
39 for BRANCH in $BRANCHES; do
40 echo "Working on \"$BRANCH\"."
41 # Check out the files on the branch. HEAD is a special case; if
42 # you check out files with -r HEAD, CVS will not let you check
43 # in changes.
44 if test "$BRANCH" = HEAD; then
45 for i in $FILES; do
46 ${SVN} -q co -N ${SVNROOT}/trunk/`dirname $i` `basename $i`
47 done
48 else
49 for i in $FILES; do
50 ${SVN} -q co -N ${SVNROOT}/branches/${BRANCH}/`dirname $i` `basename $i`
51 done
52 fi
53
54 # There are no files to commit yet.
55 COMMIT_FILES=""
56
57 for file in $datestamp_FILES; do
58 dirname=`basename $file`
59 file=`basename $file`
60 file="$dirname/$file"
61 if test -f $file; then
62 echo ${CURR_DATE} > $file.new
63
64 if /usr/bin/cmp -s $file $file.new; then
65 rm -f $file.new
66 else
67 mv -f $file.new $file
68 COMMIT_FILES="$COMMIT_FILES $file"
69 fi
70 fi
71 done
72
73 if test -n "$COMMIT_FILES"; then
74 for i in $COMMIT_FILES; do
75 echo "Attempting to commit $i"
76 if ! ${SVN} commit -m "Daily bump." $i; then
77 # If we could not commit the files, indicate failure.
78 RESULT=1
79 fi
80 done
81 fi
82
83 # Remove the files.
84 for i in $FILES; do
85 rm -rf /tmp/$$/`basename $i`
86 done
87 done
88
89 /bin/rm -rf /tmp/$$
90 exit $RESULT