Table of Contents
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 “NetBSD-current” source tree contains the development branch on which the bleeding edge of development can be followed or tested, as well as several release source tree in which patches for errata are applied to fix issues, minor new features are pulled up from NetBSD-current and to close security holes found. Release branches currently maintained are “netbsd-1-6” which contains the NetBSD 1.6 release and subsequent patch releases (1.6.1, 1.6.2, ...) as well as the “netbsd-2-0” branch, which does the same for the NetBSD 2.0 release (with upcoming patch releases 2.1, 2.2, etc.). New release branches will be added for all future major releases (3.0, ...).
The CVS program is part of NetBSD. If you have an old release which didn't come with CVS, you can install it either by using pkg_add, or building from pkgsrc. To install via pkg_add, just do:
%
pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/
OS Ver
/arch
/All/cvs
where OS Ver
, and arch
can be obtained by running.
%
sysctl kern.osrelease hw.machine_arch
Kernel and userland sources are usually places in
/usr/src
. This directory is not present by
default in the NetBSD installation, and you will need to create it
first. As it is in a system directory, you will need root access
to create the directory, and make sure your normal user account
can write to it. For demonstration purpose, it is assumed that
your non-root login is “carlo”:
%
su
Password:*****
#
mkdir /usr/src
#
chown carlo /usr/src
If you want to use pkgsrc (which is most likely), you can
prepare /usr/pkgsrc
at the same time:
#
mkdir /usr/pkgsrc
#
chown carlo /usr/pkgsrc
Please note that for the subsequent steps, root access is neither needed nor recommended, so this preparation step should be done first. All CVS operations can (and should) be done as normal user, and you don't need root privileges any more:
#
exit
%
To get the NetBSD kernel and userland sources from scratch
without having anything in /usr/src
,
run:
%
setenv CVS_RSH ssh
%
setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot
%
cd /usr
%
cvs checkout -r
<BRANCH>
-P src
Where <BRANCH>
is the
release branch to be checked out, for example, “netbsd-1-6”
or “netbsd-2-0”. Note that the
branch name does not include the patch level, thus for 1.6.2
it would still be 1-6. If you want the branch for NetBSD 2.0 and
beyond, the command would look like:
%
cvs checkout -rnetbsd-2-0 -P 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 -r
<BRANCH>
-P src
To obtain the NetBSD-current source just omit
“-r
BRANCH
”
and replace it by “-A
”:
%
cd /usr
%
cvs checkout -A -P src
If you have checked out sources from a release branch in
/usr/src
and want
to update them to get the latest security- and bug-fixes,
run:
%
cd /usr/src
%
cvs update -Pd
To update your NetBSD-current source tree,
add the -A
flag: cvs update -A -Pd.
CVS is usually quite fast for fetching sources if you have decent internet connectivity. However, in a case you are using a modem, you may wish to compress data for the update. In that case run:
%
cvs -z3 checkout ...
or
%
cvs -z3 -d $CVSROOT update ...
The 3 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!
Pkgsrc (“package source”) is the NetBSD packages collection which can be used to easily install and deinstall software on your NetBSD system. See Chapter 30, The package collection for more information.
To fetch pkgsrc from scratch into
/usr/pkgsrc
, run:
%
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 pkgsrc just do:
%
cd /usr/pkgsrc
%
cvs update -Pd
If you find yourself typing some options to cvs over and over
again, you can as well put them into a file
.cvsrc
in your home directory. The
following example is taken from my
$HOME/.cvsrc
, it is useful for just typing
cvs update on a directory with a branch
checked out to update it (adding -A
would revert
the branch to
the -current branch, which is not what I usually want!), I
prefer unified diffs, transfers should do some compression and
“cvs update” should be mostly quiet: