BSD DevCenter
oreilly.comSafari Books Online.Conferences.

advertisement


Big Scary Daemons

BSD Tricks: CVS

05/03/2001

Earlier, we looked at RCS. I highly recommend RCS on any file where incorrect changes can cause havoc or pain. RCS also has a network-aware big brother: CVS, or Concurrent Versions System. If you've been around the BSD world for any length of time, chances are you've heard of CVS. The term for developers, "committers," comes from CVS.

Many curious users have checked it out and been put off by a man page that's over nine thousand words long and describes hundreds of possible combinations of operations. Most people only need a small subset of CVS' abilities, however.

The basic idea of CVS is quite simple: revision control from a repository server somewhere on the Net. As a user, though, you don't need to check things into the repository. All you have to do is check them out. Since CVS is network-aware, you're essentially downloading files from the central server. Unlike other server protocols, but much like RCS, CVS keeps a complete history of what's happened to each file. You can download particular versions of files, branches of source code trees, or even source code as it existed on a particular date.

Before you can do anything, you need to tell your system where to find the repository. You do this with the CVSROOT environment variable. Choose the appropriate CVSROOT for your project. Although many projects use CVS, we'll look at the BSD CVS servers. Each BSD has several CVS mirrors, but here's one of each to play with.


  • FreeBSD :pserver:anoncvs@anoncvs.FreeBSD.org:/home/ncvs
  • OpenBSD :pserver:anoncvs@anoncvs1.usa.openbsd.org:/cvs
  • NetBSD :pserver:anoncvs@anoncvs.netbsd.org:/cvsroot

Once you've set CVSROOT, connect to the server with

cvs login

If the CVS server's anonymous account has no password, it will let you right in. Otherwise, it'll prompt you for a password. Most projects (including non-BSD ones) use the password anoncvs.

Once you've successfully logged in, you'll get your local shell prompt back. Unlike FTP's obvious client, CVS lurks in the background. You can do whatever you like in the foreground, and CVS will just wait for any command beginning with cvs.

CVS organizes information in modules. A module is generally a directory in the source tree. In FreeBSD, for example, a module is most commonly a program name (e.g., more) or a port name (e.g., ports/security/strobe is the module "strobe"). NetBSD has large modules; for example, the kernel sources are the srcsys modules. OpenBSD is somewhere in between, with smaller modules for large chunks of the operating system.

To see the modules available in a particular repository, just do:

cvs checkout CVSROOT/modules

This will create a directory, CVSROOT, that contains a file, modules. This file lists every module you can check out of that repository.

You can easily download a module with the "cvs checkout" command. For example, if you want the latest version of FreeBSD's make, you do:

cvs checkout make

Similarly, if you want the latest version of the FreeBSD port snort, you can use:

cvs checkout snort

This is convenient if you want the latest version of a port, but don't want to upgrade your whole source tree or bother to FTP out for it.

Pages: 1, 2

Next Pagearrow





Sponsored by: