tips for using CVS for managing maintained ports ?

Alexander Leidinger Alexander at Leidinger.net
Sun Nov 27 18:11:53 GMT 2005


On Sun, 27 Nov 2005 13:51:20 +0200
Ion-Mihai Tetcu <itetcu at people.tecnik93.com> wrote:

> Managing all this by hand has became to costly so now I use RCS and a
> copy of the port in the same /usr/ports/category dir (I keep
> my /usr/ports up-to-date with cvsup); but I can't have subdirs (e.g.
> files) in RCS; and I would like to simplify the testing made by other
> RoFUG members on various platforms / OS versions.

You could get a copy of the CVS repository with CVS and check-out the
ports tree with cvs from this copy instead of using cvsup directly.
Then you have the full power of CVS at your hands and don't need to
worry about overwritten files. You also have a very fast way of
generating diffs or looking at the CVS history. Currently the entire
repo consumes 2.5G, ports only consumes 812M.

Another way would be doing 3 way merges. In my last job I was at home
only at the weekend, and I didn't had the possibility to use
cvsup/ssh/cvs at work. But I could use portsnap. So I kept 3 ports
trees. An old one, a development one, and a new one. The new one was
updates with portsnap. Then I did a diff between the old and the new,
merged the diffs into the development one and finally updated the old
one.

Here's how I did it:
---snip---
#!/bin/sh

#set -x

diff_exclude="--exclude INDEX --exclude INDEX-5 --exclude INDEX-6 --exclude INDEX.db --exclude CVS --exclude distfiles --exclude packages --exclude .portsnap.INDEX --exclude work"

cd /usr

if [ ! -e 3way.diff ]; then
        echo '>>> Updating the Ports Collection'
        portsnap update

        echo '>>> Cleaning the Ports Collection from intermediate files'
        find ports -name \*.orig -print -delete

#       echo '>>> Cleaning the reference collection from intermediate files'
#       find old_ports -name \*.orig -print -delete

        echo '>>> Diffing Ports Collection'
        diff -ruHdN ${diff_exclude} old_ports ports > 3way.diff
fi

cd devel_ports
echo '>>> Checking development version for conflicts'
patch -C --quiet -p1 < ../3way.diff
if [ $? -ne 0 ]; then
        echo -n '>>> Code conflics, waiting 30 secs before proceeding...'
        sleep 30
        echo ' done'

        echo '>>> Updating reference collection'
        portsnap update -p /usr/old_ports

        echo '>>> Patching development version, it will contain conflicts'
        patch --quiet -p1 < ../3way.diff 2>&1 | tee /tmp/3way.log
else
        echo '>>> Patching development version'
        patch --quiet -p1 < ../3way.diff

        echo '>>> Deleting intermediate/obsolete files'
        find -d . \( -name \*.orig -o -name \*.rej -o -name .\#\* -o -empty \) -print -delete
        rm ../3way.diff

        echo '>>> Updating reference collection'
        portsnap update -p /usr/old_ports

#       echo '>>> Deleting intermediate files in the reference collection'
#       find /usr/old_ports -name \*.orig -print -delete

        echo '>>> Generating ports-WIP patch in /tmp'
        cd /usr
        diff -ruHdN ${diff_exclude} ports devel_ports > /tmp/ports-WIP.diff
fi

Bye,
Alexander.

-- 
            Secret hacker rule #11: hackers read manuals.

http://www.Leidinger.net                       Alexander @ Leidinger.net
  GPG fingerprint = C518 BC70 E67F 143F BE91  3365 79E2 9C60 B006 3FE7


More information about the freebsd-ports mailing list