OpenBSD Anonymous CVS


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 errata patches of a release.

Anonymous CVS works directly against a central source code repository. This means that you have the full set of CVS commands available to control merging and updating your changes with other source changes, performing diffs, change histories and other queries against the central repository. In the event that the changes can't be completely merged, CVS provides annotated changes to your local copy and preserves an unmodified copy of your version.

The OpenBSD Project currently has four active source repositories:

What is CVS?

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. There are two levels of source tree access:

Getting started using Anonymous CVS

While you can download the entire source tree from an anoncvs server, you can save time and bandwidth by preloading your tree with the source tarballs. This is particularly true if you are running -stable, as relatively few files change between the -release and -stable.

The source files for download from the mirrors are separated into two files to reduce the time required to download for those wishing to work with only one part of the tree. The kernel sources are in sys.tar.gz and the userland sources are in src.tar.gz.

# cd /usr/src
# tar xzf /tmp/src.tar.gz
# tar xzf /tmp/sys.tar.gz
# cd /usr
# tar xzf /tmp/xenocara.tar.gz
# tar xzf /tmp/ports.tar.gz

Using CVS to get and update your source tree

CVS was designed to be a simple way to retrieve and update your sources. 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 the patch branch contains the sources for the release plus the patches from the errata and lesser issues already applied. For more information on the flavors of OpenBSD, see here.

Choose the Anonymous CVS server you are going to use from the list of servers below, then you can start using cvs. If you begin with src.tar.gz and sys.tar.gz as mentioned above, you can skip the initial get and proceed to updating.

To use ports, it is similar to src. Make sure your user is member of the wsrc group and that /usr/ports is group writable by wsrc. In the above example, -q is optional, only intended to minimize cvs' output. For those who like to see screenfulls of output, it can be omitted.

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.

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.

Example usage for cvs(1)

A sample use of an anoncvs server would be:
$ cd /tmp
$ cvs -d anoncvs@anoncvs.ca.openbsd.org:/cvs get -P src/sys/arch/sparc
[copies the files from the repository to your machine]
$ cd src/sys/arch/sparc
$ cvs log locore.s
[shows the commit log for the chosen file]
$ cvs diff -bc -r1.1 -r1.5 locore.s
[shows the changes between revisions 1.1 and rev 1.5]

Available Anonymous CVS servers

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.

If local policy prevents outgoing connections to ssh's default port of 22, some servers permit connections on an alternative port (typically 2022). These are noted in the list above. To use a different port, reconfigure your ssh client by adding a Host entry to $HOME/.ssh/config, e.g.:

Host anoncvs.ca.openbsd.org
    Port 2022

Setting up an anoncvs mirror

Anoncvs mirrors currently require about 6GB of disk (and it will grow!), and use up to 64MB 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). 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.

Final notes

After upgrading your source tree, you should read the comments at the top of /usr/src/Makefile before attempting a build. Also, you should build a new kernel before doing a make build if possible. In some cases it may be necessary to rebuild and install the config utility before you can build the kernel. If config GENERIC fails this is probably the case.

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.