Home | History | Annotate | Line # | Download | only in maintainer-scripts
update_version_svn revision 1.1
      1  1.1  mrg #!/bin/sh
      2  1.1  mrg #
      3  1.1  mrg # Update the current version date in all files in the tree containing
      4  1.1  mrg # it.  Consider all release branches except those matching the regular
      5  1.1  mrg # expression in $IGNORE_BRANCHES, and also consider those branches listed
      6  1.1  mrg # in the space separated list in $ADD_BRANCHES.
      7  1.1  mrg 
      8  1.1  mrg SVNROOT=${SVNROOT:-"file:///svn/gcc"}
      9  1.1  mrg IGNORE_BRANCHES='gcc-(2_95|3_0|3_1|3_2|3_3|3_4|4_0|4_1|4_2)-branch'
     10  1.1  mrg ADD_BRANCHES='HEAD'
     11  1.1  mrg 
     12  1.1  mrg # Run this from /tmp.
     13  1.1  mrg export SVNROOT
     14  1.1  mrg /bin/rm -rf /tmp/$$
     15  1.1  mrg /bin/mkdir /tmp/$$
     16  1.1  mrg cd /tmp/$$
     17  1.1  mrg 
     18  1.1  mrg # The path to cvs.
     19  1.1  mrg SVN=${SVN:-/usr/bin/svn}
     20  1.1  mrg 
     21  1.1  mrg # Compute the branches which we should update.
     22  1.1  mrg BRANCHES=`$SVN ls $SVNROOT/branches \
     23  1.1  mrg 	  | sed -e 's/\///' \
     24  1.1  mrg           | egrep 'gcc-[0-9]+_[0-9]+-branch$' \
     25  1.1  mrg           | egrep -v $IGNORE_BRANCHES`
     26  1.1  mrg # Always update the mainline.
     27  1.1  mrg BRANCHES="${BRANCHES} ${ADD_BRANCHES}"
     28  1.1  mrg 
     29  1.1  mrg # ARGS is passed to 'cvs co'
     30  1.1  mrg CURR_DATE=`/bin/date +"%Y%m%d"`
     31  1.1  mrg 
     32  1.1  mrg # version is all there is
     33  1.1  mrg datestamp_FILES="gcc/DATESTAMP"
     34  1.1  mrg 
     35  1.1  mrg FILES="$datestamp_FILES"
     36  1.1  mrg 
     37  1.1  mrg # Assume all will go well.
     38  1.1  mrg RESULT=0
     39  1.1  mrg for BRANCH in $BRANCHES; do
     40  1.1  mrg   echo "Working on \"$BRANCH\"."
     41  1.1  mrg   # Check out the files on the branch.  HEAD is a special case; if
     42  1.1  mrg   # you check out files with -r HEAD, CVS will not let you check 
     43  1.1  mrg   # in changes.
     44  1.1  mrg   if test "$BRANCH" = HEAD; then 
     45  1.1  mrg     for i in $FILES; do
     46  1.1  mrg       ${SVN} -q co -N ${SVNROOT}/trunk/`dirname $i` `basename $i`
     47  1.1  mrg     done
     48  1.1  mrg   else
     49  1.1  mrg     for i in $FILES; do
     50  1.1  mrg       ${SVN} -q co -N ${SVNROOT}/branches/${BRANCH}/`dirname $i` `basename $i`
     51  1.1  mrg     done
     52  1.1  mrg   fi
     53  1.1  mrg 
     54  1.1  mrg   # There are no files to commit yet.
     55  1.1  mrg   COMMIT_FILES=""
     56  1.1  mrg 
     57  1.1  mrg   for file in $datestamp_FILES; do
     58  1.1  mrg     dirname=`basename $file`
     59  1.1  mrg     file=`basename $file`
     60  1.1  mrg     file="$dirname/$file"
     61  1.1  mrg     if test -f $file; then
     62  1.1  mrg       echo ${CURR_DATE} > $file.new
     63  1.1  mrg 
     64  1.1  mrg       if /usr/bin/cmp -s $file $file.new; then
     65  1.1  mrg 	rm -f $file.new
     66  1.1  mrg       else
     67  1.1  mrg 	mv -f $file.new $file
     68  1.1  mrg         COMMIT_FILES="$COMMIT_FILES $file"
     69  1.1  mrg       fi
     70  1.1  mrg     fi
     71  1.1  mrg   done
     72  1.1  mrg 
     73  1.1  mrg   if test -n "$COMMIT_FILES"; then
     74  1.1  mrg     for i in $COMMIT_FILES; do
     75  1.1  mrg     echo "Attempting to commit $i"
     76  1.1  mrg     if ! ${SVN} commit -m "Daily bump." $i; then
     77  1.1  mrg        # If we could not commit the files, indicate failure.
     78  1.1  mrg        RESULT=1
     79  1.1  mrg      fi
     80  1.1  mrg     done
     81  1.1  mrg   fi
     82  1.1  mrg   
     83  1.1  mrg   # Remove the files.
     84  1.1  mrg   for i in $FILES; do
     85  1.1  mrg    rm -rf /tmp/$$/`basename $i`
     86  1.1  mrg   done
     87  1.1  mrg done
     88  1.1  mrg 
     89  1.1  mrg /bin/rm -rf /tmp/$$
     90  1.1  mrg exit $RESULT
     91