cvsup

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Sat Jan 19 05:29:56 PST 2008


Vincent Stemen wrote:
Also, if nobody has written one or is working on one, I am considering writing
a script to provide basic cvsup like features/functionality for repository
updates via rsync.
I'm not sure what you mean with that.  Isn't calling rsync enough?  Maybe 
people could be interested in my script to download + update various 
repos.  See attached.  Maybe you can figure out the file formats yourself :)

cheers
  simon
--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \
#!/bin/sh -e

args=`getopt c:CIs:uv $*`
if [ $? -ne 0 ]
then
	printf "usage: updatecvs -cCIsuv\n" >&2
	exit 1
fi

set -- $args

unset VERBOSE SKIPSUP RECVS

PREFIX=`head -n 1 $HOME/.updatecvsrc`
INDEX=-f
CVSDIR=$PREFIX/cvs
SRCDIR=$PREFIX/src

for i
do
	case $i in
	-c)
		CVSDIR=$2; shift
		shift
		;;
	-C)
		RECVS=yes
		shift
		;;
	-I)
		INDEX=
		shift
		;;
	-s)
		SRCDIR=$2; shift
		shift
		;;
	-u)
		SKIPSUP=yes
		shift
		;;
	-v)
		VERBOSE=yes
		shift
		;;
	--)
		shift
		break
		;;
	esac
done

if [ -n "$VERBOSE" ]
then
	verbose_cvsup="-L 2"
	verbose_cvsync=-v
	verbose_cvs=""
	verbose_glimpse="/dev/stdout"
	verbose_rsync="-v --progress"
else
	verbose_cvsup="-L 0"
	verbose_cvsync=
	verbose_cvs="-Q"
	verbose_glimpse="/dev/null"
	verbose_rsync=
fi

if [ $# -eq 0 ]
then
	repos=`cut -f 1 "$CVSDIR/.cvsrepos"`
	set -- $repos
fi

cat "$CVSDIR/.cvsrepos" | while read name mode file
do
	case "$name" in
	"#"*|"")
		continue
		;;
	esac

	dorepo=0
	for checkrepo
	do
		if [ "$checkrepo" = "$name" ]
		then
			dorepo=1
			break
		fi
	done

	if [ $dorepo -eq 0 ]
	then
		continue
	fi

	docvs=0

	cd "$SRCDIR/$name"
	case "$mode" in
	none|"")
		;;
	cvsync)
		[ -n "$SKIPSUP" ] || cvsync $verbose_cvsync "$file"
		docvs=1
		;;
	cvsup)
		[ -n "$SKIPSUP" ] || cvsup $verbose_cvsup "$file"
		docvs=1
		;;
	rsync)
		if [ -z "$SKIPSUP" ]
		then
			for loc in $file
			do
				rsync -a --delete -z $verbose_rsync "$loc" "$CVSDIR/$name/"
			done
		fi
		docvs=1
		;;
	esac

	if [ $docvs -ne 0 ]
	then
		[ -n "$RECVS" ] && rm -rf "$SRCDIR/$name/"*
		cat .cvsinfo | while read module dir tag _rem
		do
			cvs $verbose_cvs -r -R -d "$CVSDIR/$name" \
				co -d $dir -PA -r "$tag" $module || true
		done
	fi

	[ -e .glimpse_exclude ] || echo "CVS/" > .glimpse_exclude
	glimpseindex -o -n -B -E -f -M 20 -t ${INDEX} -H "$SRCDIR/$name" `cut -f 2 .cvsinfo` > $verbose_glimpse
done




More information about the Users mailing list