Subject: Re: CVS question
To: Simon Burge <simonb@telstra.com.au>
From: Curt Sampson <cjs@portal.ca>
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.
cjs
Curt Sampson cjs@portal.ca Info at http://www.portal.ca/
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
#
cvsroot=/cvsroot
repository=netbsd
branch=NetBSD
# version is set below
confdir=/usr1/netbsd
logdir=/usr1/netbsd/logs/
import_tree=/usr1/netbsd/co/current
local_tree=/usr1/netbsd/co/head
#import_tree=/home/cjs/tmp/4/current
#local_tree=/home/cjs/tmp/4/netbsd
dirs="doc othersrc src toolchain"
# find version (no longer used in tag)
#versionfile=$import_tree/src/sys/conf/newvers.sh
#version=`sed -n -e 's/^osr="\(.*\)"$/\1/p' $versionfile | sed -e 's/\./_/g`
# remove ./ from line beginnning, and all CVS dirs/files
sedstrip='s#^./##;\|^CVS$|d;\|/CVS$|d;\|^CVS/|d;\|/CVS/|d'
# get currrent date, etc.
#
startdate=`date`
date=$(date +%Y%m%d)
#tag=$branch-$version-$date # no longer used
tag=netbsd-$date
# log under subdirectory by date
logdir=$logdir/$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
#done
# 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 $?;
#fi
# 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;
#fi
echo cvs -q rtag pre-$tag $repository
if ! cvs -q rtag pre-$tag $repository; then
echo "Error occured; aborting."
exit $?;
fi
# 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 \
>$logdir/delete
if [ -s $logdir/delete ]; then
echo; echo "Deleting files:"
for f in `cat $logdir/delete`; do
echo $f
rm $f
cvs -q rm $f
done
cvs -q commit -m "Pre-import deletions for $tag."
else
echo "No files to delete."
fi
# 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 \
>$logdir/import
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!"