Checkout and update system sources and pkgsrc with cvsup or csup
Download this article as a single PDF document
Contents
Introduction
Sources of NetBSD can be updated with multiple tools.
One of them is cvsup or csup, which is also the "FreeBSD way" to update the system sources.
CVSup is a CVS-optimized general-purpose network file distribution system.
CVSup includes special features and optimizations specifically tailored to CVS repositories. By taking advantage of the special properties of the files contained in CVS repositories, CVSup is able to perform updates much faster than traditional systems.
CVSup uses the "zlib" compression package to optionally compress all communications. This provides an additional 65-75% compression, on top of the diff-based compression already built into CVSup.
CSup is CVSup rewritten in C which makes it faster and more portable compared to the original CVSup which is written in modula3.
Disk space requirements
You will need about 900 MB for the entire source tree.
Build the required application
Building cvsup or csup is as easy as running two commands:
CVSup:
# cd /usr/pkgsrc/devel/cvsup ; make install clean
CSup:
# cd /usr/pkgsrc/net/csup ; make install clean
There are also precompiled binaries in the pkgsrc tree that you can use instead.
If you do not have the initial packages you can always download a tarball from
ftp://ftp.netbsd.org:/pub/NetBSD/packages/pkgsrc.tar.gz
or from your local ftp mirror.
List of the mirror sites is avaliable at: http://www.netbsd.org/mirrors/
Move then pkgsrc.tar.gz to /usr and unpack it running:
# tar zxf pkgsrc.tar.gz
Now create configuration file for cvsup/csup.
Edit /etc/supfile putting there:
### Tags: ### #*default release=cvs tag=. # NetBSD CURRENT #*defaultrelease=cvs tag=netbsd-5.0-PATCH001 #*default release=cvs tag=netbsd-5-0 *default release=cvs tag=netbsd-5 ### CVSup/CSup sites: ### *default host=cvsup.se.netbsd.org #*default host=cvsup.no.netbsd.org #*default host=cvsup.jp.NetBSD.org #*default host=cvsup2.jp.NetBSD.org #*default host=cvsup.uk.NetBSD.org #*default host=cvsup.us.NetBSD.org *default delete use-rel-suffix *default umask=002 *default base=/usr # Location to put the repository *default prefix=/usr # Where to put the sup subdirectory *default compress # Use this unless your network link # is a T1 or faster # You can get everything using the ``netbsd collection. # Alternatively, comment out the ``netbsd collection and just get one or # more of the partial collections by uncommenting them below. netbsd-src netbsd-pkgsrc # Packages netbsd-pkgsrc-wip prefix=/usr/pkgsrc # WIP (work in progress) packages [1] - Put in /usr/pkgsrc/wip #netbsd-htdocs # WWW pages #netbsd-othersrc # Other Sources netbsd-xsrc # The X11 distribution #netbsd-basesrc # The base distribution #netbsd-syssrc # The kernel distribution #netbsd-crypto # Crypto sources #netbsd-sharesrc # The /usr/share distribution #netbsd-gnusrc # GNU Sources #netbsd-doc # Documentation #To get certain module from certain date: #netbsd-src tag=. date=2004.07.15.10.10.10
Note [1] - You can also use cvsup/csup to check out WIP packages which go to /usr/pkgsrc/wip becouse of the prefix= option . I am not sure but I think this works only with the swedish mirror.
Next create a shell script to easly fire up new update session.
Mine is placed in /usr/local/sbin/cvsrun as my LOCALBASE is set to /usr/local
(LOCALBASE=/usr/local set in /etc/mk.conf).
You can put it anywhere in your $PATH , i.e /usr/pkg/sbin
The script looks as follows:
#!/bin/sh export PATH="/usr/local/bin:/usr/local/sbin:/usr/pkg/bin:/usr/pkg/sbin:${PATH}" #Use one of following: #XSUP=${XSUP:-`which cvsup`} # CVSup XSUP=${XSUP:-`which csup`} # CSup echo Subject: `hostname` ${XSUP} run output ${XSUP} -g -L 2 /etc/supfile
Change the file's mode so it can be executed only by root:
# chmod 700 /usr/local/sbin/cvsrun
Run cvsup/csup
Now you can simply run the cvsrun command:
# cvsrun
and your sources will be automatically updated using the definitions from the /etc/supfile file.
The output will look like this:
# cvsrun Subject: xyz.yazzy.net cvsup run output Parsing supfile "/etc/supfile" Connecting to cvsup.no.netbsd.org Connected to cvsup.no.netbsd.org Server software version: SNAP_16_1h Negotiating file attribute support Exchanging collection information Establishing multiplexed-mode data connection Running Updating collection netbsd-src/cvs Edit src/bin/date/netdate.c Add delta 1.25 2006.06.14.16.35.16 ginsbach Edit src/crypto/dist/ssh/sshconnect.c Add delta 1.35 2006.06.14.15.36.00 ginsbach
That's all folks. Marcin
<comments />
Katsuhide said ...
<comment date="2012-04-16T22:36:35Z" name="Katsuhide"> reacquainting myself with an old fernid, plus all my experimenting with pkgsrc on Mac OS X (Notes on using NetBSD’s pkgsrc on Mac OS X) means I already know the ins and out of package management on it too. Stay tuned for further </comment>
Idana said ...
<comment date="2012-08-11T02:07:19Z" name="Idana"> People nromally pay me for this and you are giving it away! </comment>