home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- #
- # This script takes a NEXTSTEP wrapper directory that has been placed
- # under CVS control as a group of individual files, and converts the
- # directory to a tar'ed and gzip package
- #
- # example if the input directory was Foo.nib with the files in Foo.nib
- # called data.classes,v and data.nib,v the result will be a file called
- # Foo.nib,v with all of the original revisions checked out of the original
- # directory and placed into the new package. (tar'ed and gziped)
- #
- # There is nothing that is NEXTSTEP specific in this shell script
- #
- # written by Vince DeMarco <vdemarco@bou.shl.com>
- # modified by Tom Hageman <tom@basil.icce.rug.nl> 23-Nov-95
- #
-
- PATH=/usr/local/bin:/bin:/usr/bin:/usr/ucb/bin export PATH
-
- prog=`basename $0`
-
- if [ $# -eq 0 ] ; then
- echo "Usage:" $prog "[files..]"
- exit 0
- fi
-
- for INPUT_FILE in "$@" ; do
-
- if [ -d "$INPUT_FILE" ] ; then
- INPUT_FILE=`echo "$INPUT_FILE" | sed 's:\([^/]\)//*$:\1:'` #TRH
- INPUT_BACKUP_FILE="$INPUT_FILE".bak
- MAX_VERSION=0.0
-
- mv -f "$INPUT_FILE" "$INPUT_BACKUP_FILE"
- cd "$INPUT_BACKUP_FILE"
-
- echo "[Checked in by $prog - $INPUT_FILE]" > /tmp/$$.logmsg
-
- for FILE in * ; do
- VERSION=`rlog -b $FILE | sed -n 's/^head: *//p'`
- if expr "$VERSION" ">" "$MAX_VERSION" >/dev/null ; then
- MAX_VERSION=$VERSION
- MAX_FILE=$FILE
- fi
- done
- rlog $MAX_FILE | sed -n '/^description:$/,/^----------------------------$/{
- /^description:$/d
- /^----------------------------$/d
- p
- }' >> /tmp/$$.logmsg
-
- echo "Processing" $INPUT_FILE "max version is" $MAX_VERSION
-
- BASE_INPUT_FILE=`basename $INPUT_FILE`
- mkdir ../$BASE_INPUT_FILE
-
- # [TRH] rlog -b fails if there are unmodified imports...
- for VERSION in `rlog $MAX_FILE | \
- sed -n 's/^revision *//p' | sort -t. -n` ; do
-
- echo "\tversion" $VERSION
-
- rm -rf ../$BASE_INPUT_FILE/*
-
- for FILE in * ; do
- co -q -r$VERSION $FILE
- mv `basename $FILE ,v` ../$BASE_INPUT_FILE/
- done
-
- cd ../
- chmod -R u+w $BASE_INPUT_FILE
- rm -rf $$.version
- gnutar Spscf - $BASE_INPUT_FILE | gzip --no-name --best -c > $$.version
- ci -q \
- -r$VERSION \
- -m"[Checked in by $prog file $BASE_INPUT_FILE/$MAX_FILE version $VERSION]
- `rlog $INPUT_BACKUP_FILE/$MAX_FILE |sed -n '/^revision '$VERSION'\$/,/^\([-=]\)\1*\$/{
- /^revision /d
- /^date:/d
- /^branches:/d
- /^\([-=]\)\1*\$/d
- p
- }`" \
- -t/tmp/$$.logmsg $$.version
-
- rcs -q -kb -l $$.version
- cd $INPUT_BACKUP_FILE/
- done
-
- # [TRH] preserve symbolic names (if any)
- symnames=`rlog $MAX_FILE | sed -n '/^symbolic names:$/,/^[^ ]/{
- /^ /s/^ \(.*\): \(.*\)$/-n\1:\2/p
- }'`
- if [ -n "$symnames" ]
- then
- rcs -q $symnames ../$$.version
- fi
- rm -rf ../$BASE_INPUT_FILE
- cd ..
-
- rcs -q -u $$.version
- mv -f $$.version,v $INPUT_FILE,v
- rm -f /tmp/$$.logmsg
- else
- echo $INPUT_FILE "is not a directory or doesn't exist"
- fi
- done
-
- exit 1
-