#/bin/sh

# BASEDIR (will) contain the cvs repository (frysk-cvs),
# tailor config file (frysk-cvs-hg.tailor), tailor state file
# (tailor.state) for incremental updates and the mercurial repo (frysk-hg)
BASEDIR=/home/mark/frysk-repo

# Update cvs repository (incremental)
rsync --archive --delete --checksum --compress --stats \
	rsync://sourceware.org/frysk-cvs \
	$BASEDIR/frysk-cvs

cd $BASEDIR/frysk-cvs

# Create module "tree" under frysk using symlinks.
rmdir frysk
ln -s frysk-top frysk
for i in frysk-core  frysk-gtk  frysk-gui  frysk-imports  frysk-sys; do \
	ln -s ../frysk-common $i/common; ln -s ../$i frysk/$i; done
ln -s ../frysk-common frysk/common
ln -s ../htdocs frysk/htdocs

# Fixup modules (the above makes everything available under frysk/)
# And the LockDir (or you need to have a /sourceware/cvs-lockdir/ dir)
mv CVSROOT/modules CVSROOT/modules.orig
head -30 CVSROOT/modules.orig > CVSROOT/modules
mv CVSROOT/config CVSROOT/config.orig
sed -e "s/^LockDir/\#LockDir/" CVSROOT/config.orig > CVSROOT/config

# Convert the repo with tailor (will do incremental updates).
cd $BASEDIR
tailor -v -c frysk-cvs-hg.tailor

# Note that the first time you will have to fix the following 4 files:
# frysk-imports/getopt/src/getopt/gnu/classpath/tools/getopt/OptionGroup.java
# frysk-imports/getopt/src/getopt/gnu/classpath/tools/getopt/Parser.java
# frysk-imports/getopt/src/getopt/gnu/classpath/tools/getopt/Option.java
# frysk-imports/getopt/src/getopt/gnu/classpath/tools/getopt/Messages.java 
# With the versions of a real cvs checkout
# For some reason these 4 files don't seem to get properly updated.
