#!/bin/sh
# fkr, jberry, yeled
# checks out both HEAD and then the CVS Tag specified in $RELEASE_TAG_FILE
# made for dulcinea 2005-12-06
# TODO should clean up after itself.
# TODO shouldn't refer to the Tag as "dp1.0"

DPROOT="/Volumes/bigsrc/darwinports"
RELEASE_TAG_FILE="base/config/RELEASE_TAG"

# Check out HEAD
export HOME=/var/root
TMPDIR=dp
cd ${DPROOT} ; cvs -q -R -d /cvs/od co -P -d ${TMPDIR}.tmp darwinports
rsync -q --exclude=.cvsignore --exclude=CVS -a --delete ${DPROOT}/${TMPDIR}.tmp/ ${DPROOT}/${TMPDIR}/
#rsync --dry-run --exclude=.cvsignore --exclude=CVS -a --delete ${DPROOT}/${TMPDIR}.tmp/ ${DPROOT}/${TMPDIR}/
echo `date -u +%s` > ${DPROOT}/${TMPDIR}/TIMESTAMP

# Extract the release tag from HEAD
read RELEASE_TAG < ${DPROOT}/${TMPDIR}/${RELEASE_TAG_FILE}
[ -n "${RELEASE_TAG}" ] || ( echo "no RELEASE_TAG specified in cvs HEAD" ; exit 1 )

# Checkout from the release tag specified in HEAD
export HOME=/var/root
TMPDIR=dp1.0
cd ${DPROOT} ; cvs -q -R -d /cvs/od co -r ${RELEASE_TAG} -P -d ${TMPDIR}.tmp darwinports
rsync -q --exclude=.cvsignore --exclude=CVS -a --delete ${DPROOT}/${TMPDIR}.tmp/ ${DPROOT}/${TMPDIR}/
#rsync --dry-run --exclude=.cvsignore --exclude=CVS -a --delete ${DPROOT}/${TMPDIR}.tmp/ ${DPROOT}/${TMPDIR}/
echo `date -u +%s` > ${DPROOT}/${TMPDIR}/TIMESTAMP

