Many users ask about checking out mports or the source code to MidnightBSD using CVS.

Here's a quick rundown. I recommend viewing other tutorials for more details on CVS.

Checking out items anonymously

CVS has concept called a CVSROOT. This is the location of the CVS repository where all the source code is kept. When using MidnightBSD, users will need to checkout from our server.

The quick and dirty method to check out ports: (as root)

cd /usr
cvs -d anoncvs@stargazer.midnightbsd.org:/home/cvs co mports

When prompted, use the password anoncvs

For MidnightBSD source code for the latest development version:

cd /usr
cvs -d anoncvs@stargazer.midnightbsd.org:/home/cvs co src

To checkout 0.1.1-RELEASE:

cd /usr
cvs -d anoncvs@stargazer.midnightbsd.org:/home/cvs co -rRELENG_0_1_1_RELEASE src

This will get you started, but what about all these options.

-d is used to tell CVS where the CVSROOT is.
co is shorthand for checkout, a cvs command.
-r allows you to pick a revision. CVS has tags, branches, and even date options.

src and mports are called modules. Each module corresponds to a directory or category of items stored on the CVS server. MidnightBSD maintains several, but mports and src are the most common.

What about compression?

CVS does offer compression which can help with checkouts over slow connections.

Example:

cvs -z 3 -d anoncvs@stargazer.midnightbsd.org:/home/cvs co mports

Checkout for developers

CVS operates similarly for developers. Replace anoncvs with your username.

For instance, I would use

cvs -d laffer1@stargazer.midnightbsd.org:/home/cvs co src

Getting changes for an existing checkout

In CVS terminology, this is called an update.

To update the mports checkout, use

cd /usr/mports
cvs update -d -P

-d will create directories that do not exist yet. This is common with the mports system as new ports are created.

-P will prune out old directories that are now empty. Deleted ports are a common reason this may occur.

Developer Commands

Here are a few items developers may wish to know to work with MidnightBSD.

Committing Changes

After making changes to a file or files in a directory, you need to do the following to save the changes.

cvs commit

This will pop open an editor (usually vi) to add a commit comment. Always leave a comment on what you did (or think you did). Funny comments are acceptable.

Alternatively, you can add a comment via the command line.

cvs commit -m "This should fix the build"

You can also commit one file.

cvs commit myfilename

Adding files

After checking out code, it is often useful to add files. With mports, you should always use the add command. There are situations where add or a similar command import are used in src.

Example:

cvs add filename
cvs commit filename

This will add and commit a file named filename. You can add several files at once and directories (but not their contents) this way. A commit is always required to "save" to the server.

If the file is binary, such as an image file (PNG, GIF, etc), you will need to use a special flag to cvs add.

cvs add -kb myfile.png
cvs commit

This tells CVS the file is binary and not to try to do text diffs with it.

Removing Files

Some versions of CVS require you to remove each file from the file system first and then delete it from cvs.

Example:

rm myfile
cvs remove myfile
cvs commit

This removes the file named myfile.

A faster approach:

cvs remove -f myfile
cvs commit

This deletes the file from the file system and CVS.

Comparing files

Sometimes it is necessary to compare your local files with the server.

cvs diff filename

This will compare a file checked out with the server version showing any differences. You can also use cvs diff without a filename to view all changes in the directory.

Others prefer using

cvs diff -u

This will show unified diffs wich are easier to read.

Checking out from other OSes

Most of the BSDs default to using SSH to checkout source code from our CVS repositories. However, sometimes it is ideal to view code on other platforms.

On Mac OS X, users must set an environment variable to use ssh with cvs.

For instance, to checkout the www site from CVS using OS X anonymously:

(tcsh)

setenv CVS_RSH ssh
cvs -d anoncvs@stargazer.midnightbsd.org:/home/cvs co www

(bash)

CVS_RSH=ssh; export CVS_RSH
cvs -d anoncvs@stargazer.midnightbsd.org:/home/cvs co www

CVSMidnightBSD (last edited 2008-03-09 04:56:28 by 10)