How to make a CVS mirror of an rsync repository
powerbook


[back]

How to create your own CVS mirror of linuxppc-2.5-benh tree

Useful if you don't want to use/learn BK, and if you hack some stuff in your kernel tree.
(hacking stuff in an rsynced tree is painful as rsync will overwrite your modifications, and you'll have to re-patch things).

This is not necessary to have a cvs server, you can use it locally :
	mkdir /home/cvsroot
	export CVSROOT=/home/cvsroot
	cvs init

I advise you not to work as root, so you'll have to set up write permissions for your compiling user for the following directories:
	/home/cvsroot (if you don't use a remote cvs server) 
	/usr/src/bk
	/usr/src/linuxppc

Do the initial import to CVS:
	#create the directory and get the source
	mkdirhier /usr/src/bk/linuxppc
	rsync -avzq rsync.theorie.physik.uni-muenchen.de::linuxppc-2.5-benh \
		/usr/src/bk/linuxppc/
	#do the initial CVS import
	cd /usr/src/bk/linuxppc/
	cvs import -ko -m 'initial import' linuxppc vtag rtag
	cd ..
	#replace the rsynced tree with the CVS one
	rm -rf linuxppc
	cvs checkout linuxppc

Then, use this shell script (which I named 'bksynccvs') to update CVS from rsync mirror
	#!/bin/bash
	#get new stuff from the rsync mirror - don't use --delete or
	#it'll remove the CVS directories
	rsync -avzq rsync.theorie.physik.uni-muenchen.de::linuxppc-2.5-benh \
		/usr/src/bk/linuxppc/
	cd /usr/src/bk/linuxppc/
	#add new directories and their files to CVS
	for i in `find . -type d|grep -v CVS`; do
        	if [ -d $i/CVS ]; then
                	echo ok >/dev/null;
		else
			cvs add -ko $i $i/*
		fi;
	done;
	#add new files to CVS
	(for i in `find . -type f|grep -v "/CVS/"`; do cvs status $i 2>&1 1>/dev/null \
		| grep "cvs add" | sed "s/^.* //"; done;) \
		| xargs cvs add -ko -m "added at `date`"
	#commit the new stuff
	cvs commit -m "automerge `date`"

You have then to create a working directory from CVS:
	cd /usr/src
	cvs checkout linuxppc

Patch your new working directory with whichever patches you want to add...

Then, use this to update your working directory:
	cd /usr/src/linuxppc
	cvs update -d 2>&1 | grep ^[CM]
	make oldconfig
	make

I then added a crontab entry to automatically update the CVS repository from rsync every night (by calling bksynccvs). You can do it by hand if you prefer :)

[back]
Colin Leroy - this article is under the Free documentation licence.