Chapter 19 Obtaining sources by CVS

Table of Contents
19.1 Fetching system and userland source
19.2 Fetching pkgsrc

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 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.

19.1 Fetching system and userland source

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-<BRANCH> -PA src

Where <BRANCH> is the release branch to be checked out, for example, 1.6 would be 1-6, 2.2 would be 2-2. If 2.0 were the branch then it would look like:

% cvs checkout -rnetbsd-2-0 -PA src

Where <BRANCH> is the release branch to be checked out, for example, 1.6 would be 1-6, 2.2 would be 2-2. Note that the branch name does not include the patch level, thus for 1.6.2 it would still be 1-6. If 2.0 were the branch then it would look like:

% cvs checkout -rnetbsd-2-0 -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-<BRANCH> -PA src

To obtain the current source just omit "-rnetbsd-BRANCH" in the last line.

To just update the 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-BRANCH -PAd src

Or by ssh:

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

To update the current source tree, omit the BRANCH.

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
% 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.

Note: you must go to: /usr/src/sys/arch/$arch/compile/$kernel_conf_name and do make clean in there and remove that dir before you wish to do a cvs update, for else that one can be unclean as well. That takes care of the kernel source part to go well during cvs update.

19.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.