Chapter 18. Obtaining sources by CVS

Table of Contents
18.1. Fetching system and userland source
18.2. Fetching pkgsrc

This chapter (Obtaining sources by CVS) has been contributed by Reinoud Koornstra

CVS (Concurrent Versions System) can be used to fetch the NetBSD source tree or to keep the NetBSD source tree up to date with respect to changes made to the NetBSD sources. There are three trees maintained for which you can use CVS to obtain them or keep them up to date: the current source tree, in which the bleeding edge of developement can be followed or tested, the 1.5 release source tree in which patches for errata are applied to fix issued and to close security holes found (for example the fragmentation issue in ipf was fixed) and in which some things are added, or replaced by a newer version, which have been found stable and safe to use. For example its now possible to remove the complete arp table with the arp command, this is added functionality and not a fix. Then there is the 1.4 release tree to which only patches for errata are applied. This tree won't be developed any further.

18.1. Fetching system and userland source

In NetBSD 1.4.x and 1.5.x CVS is not part of the native system. Its will be part of 1.6 and it already a part from the current branch. To install CVS (if you dont already have it), just do:

% pkg_add ftp://ftp.netbsd.org/pub/NetBSD/packages/<OS Ver>/<arch>/All/cvs-1.11nb2.tgz    

Where <OS Ver>, and <arch> can be obtained by running

% sysctl kern.osrelease hw.machine_arch    

To get the sources from scratch without having anything in /usr/src

% setenv CVSROOT :pserver:anoncvs@anoncvs.netbsd.org:/cvsroot
% cd /usr
% cvs login
password: anoncvs
% cvs checkout -rnetbsd-1-5 -PA src
    

Or do it by ssh, so that the data is encrypted:

% setenv CVS_RSH ssh
% setenv CVSROOT anoncvs@anoncvs.netbsd.org:/cvsroot
% cd /usr
% cvs checkout -rnetbsd-1-5 -PA src
    

This will fetch the source from the 1.5 release branch. To obtain the current source just omit "-rnetbsd-1-5" in the last line. To obtain the 1.4 release branch, use "-rnetbsd-1-4" in the last line.

To just update the 1.5 release source tree if you already got one:

% setenv CVSROOT :pserver:anoncvs@anoncvs.netbsd.org:/cvsroot
% cd /usr
% cvs login 
password: anoncvs
% cvs -d $CVSROOT update -rnetbsd-1-5 -PAd src
    

Or by ssh:

% setenv CVS_RSH ssh
% setenv CVSROOT anoncvs@anoncvs.netbsd.org:/cvsroot
% cd /usr
% cvs -d $CVSROOT update -rnetbsd-1-5 -PAd src
    

To update the 1.5 current source tree, omit the "-rnetbsd-1-5" To update the 1.4 release source tree, use "-rnetbsd-1-4"

When you wish to do an update from an unclean tree, i.e. when you rebuild some part of the source or even the whole source tree or the kernel source, and didn't do a make cleandir you have to make object files in the source tree.

The object directories are necessary to do a "cvs update" on an unclean tree. An unclean tree is a source tree in which you have built parts of the tree, i.e. compiled parts or the whole source tree, without having done a "make clean" in those parts or a "make" cleandir on the whole source tree. Otherwise, cvs will want to create directories that have the same name as some of the binairies, and will fail. (Where you used to have a directory called "groff", you now build the binary "groff", but "cvs" must create all the empty directories before pruning them.)

So in /usr/src:

% makedir /usr/obj
% make obj
    

Now you're ready to do the cvs update. Or do a make cleandir in /usr/src before using cvs. It's easier and less work instead of making the objectdirs when updating from an unclean tree. CVS is going a lot faster then sup. I don't know exactly how long it's going to take to fetch all the sources. I have only experience with T1 and higher speed lines in which case it just takes an hour or a little more to fetch the complete source, depending of course how well the connection is at the moment. I have no experience how long it takes with a modem. However, in a case you are using a modem, you will wish to compress ond decompress data once it is transferred. In that case do

% cvs -z5 checkout .........    

or

% cvs -z5 -d $CVSROOT update ......    

The 5 is the level of compression, you can use any number between 1 and 9 where 1 is the fastest compression method and 9 the best but slowest compression method. Keep in mind that this will put extra load on the cvs server.

18.2. Fetching pkgsrc

Pkgsrc (package source), is a set of software utilities and libraries which have been ported to NetBSD. Its very easy this way to install and deinstall software on your NetBSD system: it fetches the sources files needed, patches the source if needed, configures it and builds the binairies and installs the binaries and man pages. It keeps a database of all packages installed and exactly which files belongs to a package and where the are stored.

To fetch all the pkgsrc from scratch:

% setenv CVSROOT :pserver:anoncvs@anoncvs.netbsd.org:/cvsroot
% cd /usr
% cvs login 
(the password is: "anoncvs")
% cvs checkout -PA pkgsrc 
    

Or by ssh:

% setenv CVS_RSH ssh
% setenv CVSROOT anoncvs@anoncvs.netbsd.org:/cvsroot
% cd /usr
% cvs checkout -PA pkgsrc
    

This will create the directory pkgsrc in your /usr and all the package source will be stored under /usr/pkgsrc

To update the pkgsrc just do:

% setenv CVSROOT :pserver:anoncvs@anoncvs.netbsd.org:/cvsroot
% cd /usr
% cvs login
(the password is: "anoncvs")
% cvs -d $CVSROOT update -PAd pkgsrc
    

Or by ssh:

% setenv CVS_RSH ssh
% setenv CVSROOT anoncvs@anoncvs.netbsd.org:/cvsroot
% cd /usr
% cvs -d $CVSROOT update -PAd pkgsrc
    

However, make sure the pkgsrc dir is clean when you start udating. So do a make clean in /usr/pkgsrc if you aint sure.