Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Oct 1998 16:53:01 -0500 (EST)
From:      Tom Rush <tom@chattpiano.com>
To:        Andrew Boothman <andrew@sour.cream.org>
Cc:        freebsd-stable@FreeBSD.ORG
Subject:   RE: Stable and CTM
Message-ID:  <199810252153.QAA19412@chattpiano.com>
In-Reply-To: <3.0.5.32.19981024183958.007dbe70@ice.cream.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 24-Oct-98 Andrew Boothman wrote:
> Hi,
> 
> I'm interested in tracking -stable so I read the section in the manual
> about " Synchronizing Source Trees over the Internet" and because my
> FreeBSD box doesn't have a connection to the 'net, I selected CTM as the
> best method for staying up-to-date because I can take CTM deltas to my
> machine on disk.
> 
> I went to ftp.freebsd.org/pub/FreeBSD/CTM/src-2.2/ to find the most recent
> src-2.2.whateverxR227 file so that I could update from the source contained
> on my WC 2.2.7-RELEASE CD2.
> 
> Unfortunatly the only transition deltas available where the "xempty" ones.
> In other words the ones that allow you to start from a completely empty
> source tree. What happened to all the "xR227" transition deltas?

I don't think there ever were any.

I have used cvsup, and now ctm, to keep my cvs tree up to date.  In order to
get going with ctm, though, I found it necessary to do quite a bit of manual
intervention to sync the tree with the ctm deltas.  I cobbled up this script
to help with it, which basically checks the md5 checksums to see if the delta
is even close to where it should be.

To use it, check the date of the files on your CD, then download the deltas that
were made on or just before or after that date.  Set the variables in the
script appropriately, then run it with the delta number you want to check.

If files need updating, ctm commands for those files only are echoed into a file
that you can then run with /bin/sh.  If not, you get some rather feeble
instructions about what you might try next.  Once things are synced and you
have created a .ctm_status file, you can apply the remainder of the deltas
normally.

This script is by no means production quality.  It doesn't do any modifications
to the tree by itself, however, so it won't hurt anything to try it.

Watch out for files shown as "does not exist" (other than .ctm_status); there
probably won't be any, but if there are they would need to be specially
handled. 
---
Tom Rush
tom@chattpiano.com

---------------

#!/bin/sh
#
# ctmsync -- script to help sync your source tree with ctm deltas
#
# Set the following variables:
#
# Where your sources are
SRCTREE=/usr/src
# Where your deltas are
CTMDIR=${HOME}/CTM
# Delta types you want to apply
DELTATREE=src-2.2

if [ $# -ne 1 ]; then
    echo usage: `basename $0` ctm-delta-number
    exit 1
fi

NDELTA=$1
DELTA=${CTMDIR}/${DELTATREE}.${NDELTA}.gz

if [ ! -f $DELTA ]; then
    echo Can\'t find $DELTA
    exit 1
fi

UPDATEFILE=${HOME}/ctmsync-${NDELTA}
CTMFTMP=/tmp/ctmsync$$

UPTODATE=0
OUTOFDATE=0
OUTOFSYNC=0

cd $SRCTREE

trap "rm -f $CTMFTMP $UPDATEFILE ; exit" 0 1 2 15

gzip -d -c $DELTA | grep '^CTMF' > $CTMFTMP 
exec < $CTMFTMP
while read a file b c d cksum1 cksum2 e 
do
    if [ -f $file ]; then
        set `md5 $file`
        if [ "$4" = "$cksum1" ]; then
            echo $file is out of date
            OUTOFDATE=`expr $OUTOFDATE + 1`
            echo ctm -v -b ${SRCTREE} -e $file ${DELTA} >> ${UPDATEFILE}
        elif [ "$4" = "$cksum2" ]; then
            echo $file is up to date with this delta
            UPTODATE=`expr $UPTODATE + 1`
        else
            echo $file will not sync with this delta
            OUTOFSYNC=`expr $OUTOFSYNC + 1`
        fi
    else
        echo $file does not exist
    fi
done

rm -f $CTMFTMP

echo
echo You have $OUTOFDATE files out of date, $UPTODATE files up to date,
echo and $OUTOFSYNC files out of sync with this delta.
echo

if [ ${OUTOFDATE} -eq 0 ]; then
    if [ ${OUTOFSYNC} -gt 0 ]; then
        echo If you have no out of date files and only some out of sync, then
        echo you should probably try a later delta.
    else 
        echo You seem to be up to date for the files in this delta.
    fi
else 
    echo You can update the out of date files with the command:
    echo \"sh ${UPDATEFILE}\"
    if [ ${OUTOFSYNC} -gt 0 ]; then
        echo However, you may need to apply an earlier delta for the
        echo out of sync files.
    elif [ ${UPTODATE} -eq 0 ]; then
        echo Since no files are or up to date or out of sync, you may be
        echo able to use ctm normally, e.g. \"ctm -v -b $SRCTREE ${DELTA}\".
        echo But you will need to create .ctm_status using the number of
        echo the previous delta.
    fi
fi

echo
echo When you get things in sync, you need to create the file
echo ${SRCTREE}/.ctm_status, which contains the latest delta number,
echo e.g. \"echo ${NDELTA} \> ${SRCTREE}/.ctm_status\"



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810252153.QAA19412>