home *** CD-ROM | disk | FTP | other *** search
/ Peanuts NeXT Software Archives / Peanuts-Update.iso / NEXTSTEP / unix / developer / cvs.HOWTO.README / cvs.HOWTO / cvswrappers-HOWTO.1.1.rtfd / cvsrepack < prev    next >
Encoding:
Text File  |  1997-05-08  |  2.8 KB  |  111 lines

  1. #!/bin/sh
  2. #
  3. #
  4. # This script takes a NEXTSTEP wrapper directory that has been placed
  5. # under CVS control as a group of individual files, and converts the
  6. # directory to a tar'ed and gzip package
  7. #
  8. # example if the input directory was Foo.nib with the files in Foo.nib
  9. # called data.classes,v and data.nib,v the result will be a file called
  10. # Foo.nib,v with all of the original revisions checked out of the original
  11. # directory and placed into the new package. (tar'ed and gziped)
  12. #
  13. # There is nothing that is NEXTSTEP specific in this shell script
  14. #
  15. # written by Vince DeMarco <vdemarco@bou.shl.com>
  16. # modified by Tom Hageman <tom@basil.icce.rug.nl> 23-Nov-95
  17. #
  18.  
  19. PATH=/usr/local/bin:/bin:/usr/bin:/usr/ucb/bin export PATH
  20.  
  21. prog=`basename $0`
  22.  
  23. if [ $# -eq 0 ] ; then
  24.     echo "Usage:" $prog "[files..]"
  25.     exit 0
  26. fi
  27.  
  28. for INPUT_FILE in "$@" ; do
  29.  
  30.     if [ -d "$INPUT_FILE" ] ; then
  31.         INPUT_FILE=`echo "$INPUT_FILE" | sed 's:\([^/]\)//*$:\1:'` #TRH
  32.         INPUT_BACKUP_FILE="$INPUT_FILE".bak
  33.         MAX_VERSION=0.0
  34.  
  35.         mv -f "$INPUT_FILE" "$INPUT_BACKUP_FILE"
  36.         cd "$INPUT_BACKUP_FILE"
  37.  
  38.         echo "[Checked in by $prog - $INPUT_FILE]" > /tmp/$$.logmsg
  39.  
  40.         for FILE in * ; do
  41.             VERSION=`rlog -b $FILE | sed -n 's/^head: *//p'`
  42.             if expr "$VERSION" ">" "$MAX_VERSION" >/dev/null ; then
  43.                 MAX_VERSION=$VERSION
  44.                 MAX_FILE=$FILE
  45.             fi
  46.         done
  47.         rlog $MAX_FILE | sed -n '/^description:$/,/^----------------------------$/{
  48.             /^description:$/d
  49.             /^----------------------------$/d
  50.             p
  51.         }' >> /tmp/$$.logmsg
  52.  
  53.         echo "Processing" $INPUT_FILE "max version is" $MAX_VERSION
  54.  
  55.         BASE_INPUT_FILE=`basename $INPUT_FILE`
  56.         mkdir ../$BASE_INPUT_FILE
  57.  
  58.         # [TRH] rlog -b fails if there are unmodified imports...
  59.         for VERSION in `rlog $MAX_FILE | \
  60.                 sed -n 's/^revision *//p' | sort -t. -n` ; do
  61.  
  62.             echo "\tversion" $VERSION
  63.  
  64.             rm -rf ../$BASE_INPUT_FILE/*
  65.  
  66.             for FILE in * ; do
  67.                 co -q -r$VERSION $FILE
  68.                 mv `basename $FILE ,v` ../$BASE_INPUT_FILE/
  69.             done
  70.  
  71.             cd ../
  72.             chmod -R u+w $BASE_INPUT_FILE
  73.             rm -rf $$.version
  74.             gnutar Spscf - $BASE_INPUT_FILE | gzip --no-name --best -c > $$.version
  75.             ci     -q \
  76.                 -r$VERSION \
  77.                 -m"[Checked in by $prog file $BASE_INPUT_FILE/$MAX_FILE version $VERSION]
  78. `rlog $INPUT_BACKUP_FILE/$MAX_FILE |sed -n '/^revision '$VERSION'\$/,/^\([-=]\)\1*\$/{
  79. /^revision /d
  80. /^date:/d
  81. /^branches:/d
  82. /^\([-=]\)\1*\$/d
  83. p
  84. }`" \
  85.                 -t/tmp/$$.logmsg $$.version
  86.  
  87.             rcs -q -kb -l $$.version
  88.             cd $INPUT_BACKUP_FILE/
  89.         done
  90.  
  91.         # [TRH] preserve symbolic names (if any)
  92.         symnames=`rlog $MAX_FILE | sed -n '/^symbolic names:$/,/^[^    ]/{
  93.             /^    /s/^    \(.*\): \(.*\)$/-n\1:\2/p
  94.         }'`
  95.         if [ -n "$symnames" ]
  96.         then
  97.             rcs -q $symnames ../$$.version
  98.         fi
  99.         rm -rf ../$BASE_INPUT_FILE
  100.         cd ..
  101.  
  102.         rcs -q -u $$.version
  103.         mv -f $$.version,v $INPUT_FILE,v
  104.         rm -f /tmp/$$.logmsg
  105.     else
  106.         echo $INPUT_FILE "is not a directory or doesn't exist"
  107.     fi
  108. done
  109.  
  110. exit 1
  111.