Using CVS and Project Builder
 

Having struggled and fought with Project Builder trying to get it to access CVS. I thought it would be handy to make some tips available. My notes are from my attempt to get Project Builder to connect to SourceForge. If I've ommited anything or made mistakes let me know, wjt100@york.ac.uk

Using CVS
Mac OS X comes with CVS installed and you can use it right out of the command line. It is however quite strange to a beginner. Fortunately there are some excellent resources on the web that explain how to use CVS:

The CVS Book
The CVS Manual

Apple's CVS Overview
SourceForge CVS Documentation

A very good series on the MacDevCenter on using cvs and version control basics. It also provides some help for using Project Builder with CVS.
Part 1 (Concepts)
Part 2 (Use)
Part 3 (Releases)


CVS Frontends
To make life easier for us who don't want to learn obscure commands, there are a couple of CVS front ends that run under Mac OS X.

CVL - Cocoa frontend, takes a little while to get your head round it.
MacCVS - Mac counterpart to WinCVS.
SmartCVS Java app, powerful and self explanatory. My choice.

Getting a project from CVS
Project Builder does not support checking out a project from CVS, so it has to be done from the command line or from one of the front ends. If you want to be able to commit files to the CVS server then make sure that you check out the project with permission to commit.

Using SourceForge you may checkout a project in two ways (Examples borrowed from SourceForge):

As a non-developer (not able to perform write operations, eg. commits) you use a pserver. After this is done you are finished. Project Builder will allow you to update your sources from CVS and to see diffs, but you will not be able to commit any changes you make. First you need to login this enables you to then checkout the module, the password for SourceForge is blank (just hit return).
$ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/myproject login

Logging in to :pserver:anonymous@cvs.sourceforge.net:2401/cvsroot/myproject
CVS password:
$
To checkout you need to know the name of the module (Top-level directory in CVS) you want to retrieve.

$ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/myproject checkout modulename

cvs checkout: Updating modulename
U modulename/LICENSE
U modulename/Makefile
U modulename/README
U modulename/client.c
U modulename/client.h
U modulename/server.c
U modulename/server.h
$

As a developer you use SSH as an external authorisation for CVS. First you set the environment variable "CVS_RSH" to SSH, using "setenv CVS_RSH ssh" for tcsh (Mac OS X default) and C shell derivatives or "export CVS_RSH=ssh" for the Bourne shell. This can also be done by adding it into the ~/.MacOSX/environment.plist file. Then you can perform the checkout and you will be prompted for your password.
$ setenv CVS_RSH ssh

$ cvs -d:ext:username@cvs.sourceforge.net:/cvsroot/myproject checkout modulename

username@cvs.sourceforge.net's password:
cvs checkout: Updating modulename
U modulename/LICENSE
U modulename/Makefile
U modulename/README
U modulename/client.c
U modulename/client.h
U modulename/server.c
U modulename/server.h
$

Once you have a project from CVS, you no longer need to specify the project or module when performing CVS actions whilst you are in the checked-out directories. So the commands abreviate to things like "cvs diff -u client.c" to compare the contents of your working copy to the current data in the CVS repository.

Getting SSH to work with Project Builder
Unfortunately Project Builder does not use SSH by default or have a mechanism for asking for your password when you logon using SSH, therefore CVS appears not to work. There are two ways round this, one is to use another application to provide the password, the other is to use public/private keys for authentication. I've found that using keys was faster and generally nicer, but use what you feel happy with.

Note: I've found that Project Builder often takes a long time to get going. Often it will take over a quarter of an hour before it starts using CVS.

Application Authentication
You can use SSHPassKey to provide the password for you. This will take care of everything including making Project Builder use SSH for CVS. It comes with a ReadMe that explains how to use it.

Using SSH
To make sure Project Builder uses SSH for CVS, you must add in the CVS_RSH environment variable in so that when loaded Project Builder uses it. To do this use the Property List Editor to create/edit your ~/.MacOSX/environment.plist file. This file contains environment variables that are used for all applications. Add in "CVS_RSH" as a key with a string value of "ssh". After logging back in Project Builder will now attempt to use SSH to access CVS. Project Builder will still not be able to ask you for your password, so you need to set-up ssh to use keys to authenticate you rather than a password.

Keys
Again SourceForge has good documentation on this, SourceForge. SSH uses two protocols the default is SSH2 which uses DSA public key cryptography as opposed to RSA for SSH1. Firstly you create a public/private key pair, which you will rather than your password to authenticate.
$ sh-keygen -t dsa
This will create the key pair placing the public key in ~/.ssh/id_dsa.pub.

Sample SSH2 (DSA) key data (borrowed from SourceForge, data is normally on one line, but has been broken here for your viewing convenience):
ssh-dss AAAAB3NzaC1kc3MAAACBAN431nwhJuE5F5HhsTVS7WlSCH1dn/vaPOZQ6WOBvCYIY6k97UkW
XbsLjKIBz2P/jaL2w92U72cUmKiXgVFaxP7LgRylF0UHjFoPfbbesY2isfdHTgGnbmJDOui+RHGNiLl6
f62q0mPIZQxyq6SSyqLD6NiO3IlyrsCSXAerkrdxAAAAFQD7wt2MuZU27cF4oOd6puEcm/jl7wAAAIEA
vQvsiBcgEVvlAIMnZlP2QdO2O96p0wlCoHmKS8WYhwiAEB4QsLypM9ZQ/yG4HO7p9y7gcgo8cyUo/9jd
pOMKAWVJSsujqqH0VBLHZVD5tdBPG4p4i3uws6my2z2AQARMfKN9L/uSmfEi69sDy6JkEah27yOp3zVh
xZInM/hFrVcAAACBAL9K78gikerCL/LFLK4FkQp56drqx2WmubrAuG9SmnPpRQR5SNoA6lYI3CRttLHT
540XW0PYDz53NnBc3C3/v3EE4nokyyUw783mWKbAbI6+jtibViUhfJwbi7xLB2TVyeWMBeHArsxkfHyO
zFyjC4Db4UrmU71tYQfOlzmIipf7 username@hostname.localdomain

You can then place the public key onto the remote servers you want to connect to. To do this on SourceForge there is a web interface Edit CVS/SSH Shared Keys where you can paste you public key in.

After 6 hours the key will be propagated to all SourceForge's servers and you should be able to access CVS without a password.

Contact

William Thimbleby wjt100@york.ac.uk