Anonymous CVS is a method of keeping your local copy of the OpenBSD source tree up to date with respect to changes made to current OpenBSD sources. In addition to following the bleeding edge of development, it is also possible to track the patches for errata of a release.
The major advantage of Anonymous CVS over other source code update techniques is that it works directly against a central source code repository or mirror. This means that you have the full set of CVS commands available to control merging and updating your changes with other source changes and for performing diffs, change histories and other queries against the central repository.
The OpenBSD Project currently has five main source repositories:
To summarize, the real strength of using Anonymous CVS is that it is a "tolerant" source code control system - it respects changes that you have made to your local sources and makes "best efforts" to update your entire source tree, rather than leaving you a list of arcane problems that have to be resolved before continuing.
CVS is the source code control system used to manage the OpenBSD source tree. It implements a central repository for all officially released source code and changes, while permitting developers to maintain local copies of the source code with their working changes. Developers with "write access" can commit changes directly to the OpenBSD source tree, while "Anonymous CVS" users have "read access" and can keep their local copies of the source up to date and issue queries against the central repository.
The major strength of CVS is that it has the ability to perform intelligent merges of changes to the central repository with changes that you make to your local copy. This means that if you make a change to a module and perform an update, your changes are not "blown away", rather CVS makes best efforts to merge the changes made to the central sources with changes you've made to your local copy.
In the event that the changes can't be completely merged, CVS provides a "soft fallback", in terms of providing you with annotated changes to your local copy, preserving an unmodified copy of your version and continuing to update any other source modules you requested.
The latest version of CVS is available at Cyclic. Versions earlier than 1.6 are not recommended, and may not work. If you already have OpenBSD installed, CVS is included.
People who own an OpenBSD CD may have seen the CVS/ dirs on it. Actually there is a reason, the CD has a checkout of the OpenBSD src module usable to continue updating from. Using this tree will result in a much faster initial CVS update than a fresh checkout of the full OpenBSD source tree. There are two ways of using the CD:
# cd /mnt; pax -rw CVS Makefile [a-z]* /usr/src
# mount -t union -o -b /mnt /usr/src
For people who don't have a CD on hand, you can use cvs(1) to "checkout" the source repository for you. This is discussed in the next section.
After this, /usr/src will be a nice checkout area where all cvs(1) commands will work OK.
CVS was designed to be a simple way to retrieve and update your sources, therefore there isn't much involved at all in doing so. You must first decide whether you want to track current or a patch branch. The current tree has all of the up to the minute changes, whereas a patch branch contains a formal release plus the patches from the errata already applied. For a definition of current, see the Upgrade Mini-FAQ.
Once you have decided which tree to follow, you must choose which Anonymous CVS server you are going to use. A list of these servers is below. Do, however, notice that there are three ways to access these servers.
NOTE: For users wishing to use rsh, you must first set the CVS_RSH variable to rsh.
$ export CVS_RSH=/usr/bin/rsh
% setenv CVS_RSH /usr/bin/rsh
Once you have chosen which Anonymous CVS Server you will use, and which method you will use, you can start using cvs. For those of you who have CDs you can start with the CVS checkout that is on the CD by using the method above to get the sources onto your system. If you don't have a CD handy, use the method below to checkout the sources. This method puts the OpenBSD source tree into /usr/src.
# cd /usr; cvs checkout -P src
The above will checkout the current source tree. Many of you will only want the patch branch sources. To checkout a patch branch, you must specify a tag along with your command. Example:
# cd /usr; cvs checkout -P -rOPENBSD_3_4 src
Or OPENBSD_3_3 for 3.3, etc.
The OPENBSD_3_4 tag contains the release sources and errata already applied.
There are two levels of source tree access:
Please see the note about ssh vs. rsh below!
Note: If your server is listed on here with inaccurate or unknown information, please contact beck@openbsd.org
You may want to use traceroute(8) to find out which server is nearest you. Problems with a server should be reported to the maintainer of the server in question.
IMPORTANT NOTE: There are a few issues relating to cryptographic software that everyone should be aware of:
NOTICE: If you want to update a branch (such as a patch branch)
to current, you would add the -A
flag to cvs, but this flag is of little use otherwise. Some older
versions of the OpenBSD documentation recommended use of this flag
in many examples. We no longer recommend this flag unless absolutely necessary.
A sample use of an anoncvs server would be:
% setenv CVSROOT anoncvs@anoncvs.ca.openbsd.org:/cvs % cd /tmp % cvs get src/sys/arch/sparc [copies the files from the repository to your machine] % cvs log src/sys/arch/sparc/sparc/locore.s [shows the commit log for the chosen file] % cvs diff -bc -r1.1 -r1.5 src/sys/arch/sparc/sparc/locore.s [shows the changes between revisions 1.1 and rev 1.5]
% setenv CVSROOT :pserver:anoncvs@anoncvs.ca.openbsd.org:/cvs % cvs login (Logging in to anoncvs@anoncvs1.ca.openbsd.org) CVS password: anoncvs [This writes a line to ~/.cvspass (filename over-ridden by CVS_PASSFILE).] [An example line from my ~/.cvspass after typing 'blah' for the above ] [password is: ] [:pserver:anoncvs@anoncvs5.usa.openbsd.org:/cvs Au'yc ] [After logging in ONCE every other use of the above CVSROOT will work. ] % cvs get ksrc-i386 ksrc-common [Allows you to retrieve ONLY that necessary to rebuild an i386 kernel. ]
Here is how someone using anoncvs regularly would update his source tree:
(If you are following current):
# setenv CVSROOT anoncvs@anoncvs.ca.openbsd.org:/cvs # cd /usr # cvs -q get -P src
(If you are following the patch branch for 3.4):
# setenv CVSROOT anoncvs@anoncvs.ca.openbsd.org:/cvs # cd /usr # cvs -q get -rOPENBSD_3_4 -P src
(If you are following current):
# cd /usr/src # cvs -q up -Pd
(If you are following the patch branch for 3.4):
# cd /usr/src # cvs -q up -rOPENBSD_3_4 -PdEvery time you ran this it would synchronize your /usr/src tree. It would not destroy any of your local changes, rather it would attempt to merge changes in. If you use obj directories (not obj symbolic links) you may wish to append "-I obj" to the cvs command line, this will keep cvs from spitting out a warning about all the obj directories it is going to encounter which are not in the repository.
# cd /usr/src # cvs -d $CVSROOT -q up -Pd
To use ports, it is similar to src:
(If you are following current):
# setenv CVSROOT anoncvs@anoncvs.ca.openbsd.org:/cvs # cd /usr # cvs -q get -P ports
(If you are following the patch branch for 3.4):
# setenv CVSROOT anoncvs@anoncvs.ca.openbsd.org:/cvs # cd /usr # cvs -q get -rOPENBSD_3_4 -P ports
(If you are following current):
# cd /usr # cvs -q up -Pd ports
(If you are following the patch branch for 3.4):
# cd /usr # cvs -q up -rOPENBSD_3_4 ports
or to make a diff of a locally patched module (here cd.c) to include with a bug report:
# cd /usr # cvs diff -u src/sys/scsi/cd.c > /tmp/patch
The cvs(1) man page (included with the CVS sources) has much more information about how CVS can be used.
Anoncvs mirrors also carry the OpenBSD X11 (XFree86) source tree. You can adapt the recipe above to update your XFree86 source tree from the third CD. You can copy or download the XFree86 3 source tree with the X11 cvs module, although the current module containing XFree86 4 is XF4. There are two ways to get the XF4 sources to /usr/XF4:
# cd /mnt; cp -Rp XF4 /usr
# mount -t union -o -b /mnt/XF4 /usr/XF4
# cd /usr/XF4 # cvs -q update -Pd
Warning: When using cvs you should take care that your current directory is either the root of the tree you are referencing or in a separate place such as /tmp. Some commands such as "get" can create an arbitrary sub-tree in the current directory, and a subsequent update will recursively flesh out this sub-tree.
The anoncvs service gives fledgling developers a chance to learn CVS operation and get thoroughly involved in the development process before getting "commit" access -- as a result of showing useful skills and high quality results they will naturally later be given developer access. As well, people providing patches can create their "diff"s relative to the CVS tree, which will ease integration.
By default, the CVS client uses ssh ("secure shell": OpenSSH) to talk to the CVS server.
Many of the CVS sites no longer support rsh for security reasons. Local problems like firewalls or imperfect protocol emulators such as slirp may also hinder rsh usage. However, if rsh is desired, one must set the CVS_RSH environment variable to point to rsh (typically /usr/bin/rsh).
If local policy prevents outgoing connections to ssh's default port of 22, port 2022 may be used in its place. Note, however, that not all anoncvs servers accept ssh connections on this port. Furthermore, most anoncvs servers no longer accept the none cipher, as it is disabled in recent versions of ssh for security reasons. Also, do not be tempted to turn on compression: CVS already compresses.
One could specify something like the following in the $HOME/.ssh/config configuration file to avoid the pitfalls and restrictions mentioned above:
Host anoncvs.ca.openbsd.org Compression no Port 2022
CVS is a little noisy starting up; to quiet it a bit you may want to do this:
% setenv CVS_CLIENT_PORT -1
Users wishing to mirror the OpenBSD CVS tree itself may now do so from anoncvs.usa.openbsd.org or anoncvs1.usa.openbsd.org (these are different machines). Note that this is the cvs tree, not a checked out source tree. It is only useful if you want to be able to do fast cvs operations (diff, annotate, etc) or if you have multiple source trees and you only want to transfer new data once (you can then checkout a tree from your local cvs mirror).
A sample supfile would be:
cvs host=anoncvs.usa.openbsd.org hostbase=/ base=/home delete
which would mirror the cvs tree into /home/cvs with the sup data files ending up in /home/sup. The full OpenBSD cvs tree is currently about 2.2GB in size.
If you wish to be a new anoncvs mirror site, please contact the anoncvs maintainer. Anoncvs mirrors require about 1.7GB of disk, and use up to 32MB of swap per anoncvs user (assuming the user does a large operation; while smaller operations use fewer resources, anoncvs still makes much more of an impact than ftp or sup). Such anoncvs machines should have excellent network connectivity for the area they are expected to serve. A document which describes the setup of anoncvs servers is available.
It is important to note that upgrading from a release to the current tree by rebuilding the sources can be rather difficult due to dependencies that are often not obvious. Therefore, it is suggested that you first install the latest snapshot before attempting a tree build from source.