Subject: Re: CVS question
To: Simon Burge <>
From: Curt Sampson <>
List: current-users
Date: 09/30/1997 13:42:20
On Tue, 30 Sep 1997, Simon Burge wrote:

> I've been meaning to ask for a while about how people actually track
> -current.  It seems easy to say "with CVS and sup", but obviously
> there's a little more to it than that.  Are the scripts you were given
> available?

I've appended the one I use. I import from a CVS checkout, so I
need need to ignore that stuff, but that, and the paths, are about
the only tweaks you should have to make.

Note that this requires a fair amount of disk space; I use compare
a -current against a clean checkout of the head of my private tree
in order to determine which files in my private tree I need to
delete after an import.


Curt Sampson	   Info at
Internet Portal Services, Inc.	   Through infinite myst, software reverberates
Vancouver, BC  (604) 257-9400	   In code possess'd of invisible folly.

# Procedures for Imports
# $Id$

# configuration
# version is set below

dirs="doc othersrc src toolchain"

# find version (no longer used in tag)
#version=`sed -n -e 's/^osr="\(.*\)"$/\1/p' $versionfile | sed -e 's/\./_/g`

# remove ./ from line beginnning, and all CVS dirs/files

# get currrent date, etc.
date=$(date +%Y%m%d)
#tag=$branch-$version-$date	# no longer used

# log under subdirectory by date
mkdir $logdir

echo "NetBSD import script importing $tag."

# update our source tree
#echo; echo "Updating source tree:"
#cd $import_tree
#for dir in $dirs; do
#    if ! test -d $dir ; then
#	echo "Can't cd to $dir! Aborting."
#	exit 1
#    else
#	cd $dir
#	cvs -q update -dP -A | tee -a $logdir/update.$dir
#	if test $? -ne 0 ; then
#	    echo "Error $? occured updating $import_tree/$dir; aborting."
#	    exit $?;
#	fi
#	cd ..
#    fi

# update our local tree
echo; echo "Updating and tagging local tree:"
#cd $local_tree
#if ! cvs -q update -dP -A; then
#    echo "Error occured; aborting."
#    exit $?;
# confirm local tree has no uncommited changes
#if [ -n "`cvs -q update -dP -A | grep -v '^? '`" ]; then
#    echo "Error: checkout of local tree has uncommitted changes";
#    exit 2;
echo cvs -q rtag pre-$tag $repository
if ! cvs -q rtag pre-$tag $repository; then
    echo "Error occured; aborting."
    exit $?;

# find files to delete
echo; echo "Finding files to delete:"
cd $import_tree
find . -print | sed -e $sedstrip | sort >$logdir/filelist.import
cd $local_tree
# convert Keepfiles to a sed script
egrep -v '^#|^[ 	]*$' Keepfiles |\
    sed -e 's/^/\\|^/' -e 's/$/$|d/' >/tmp/Import.$$
find . -print | sed -e $sedstrip -f /tmp/Import.$$ |\
    sort >$logdir/filelist.local
rm /tmp/Import.$$
comm -13 $logdir/filelist.import $logdir/filelist.local \

if [ -s $logdir/delete ]; then
    echo; echo "Deleting files:"
    for f in `cat $logdir/delete`; do
	echo $f
	rm $f
	cvs -q rm $f
    cvs -q commit -m "Pre-import deletions for $tag."
    echo "No files to delete."

# do the import
echo; echo "Importing new source tree:"
cd $import_tree
cvs -q -d $cvsroot import \
    -I ! -I CVS \
    -m "$tag import." \
    $repository $branch $tag \
sed -n -e '/^C /p;/^$/,$p' $logdir/import

echo; echo "Updating and merging local tree:"
cd $local_tree; cd ..
echo cvs -q co -d `basename $local_tree` -P "-j$branch:$startdate" -j$branch $repository 
cvs -q co -P -d `basename $local_tree` \
    "-j$branch:$startdate" -j$branch $repository 2>&1  |\
    tee $logdir/update

echo; echo "Remember to commit this merge!"