Migrate CVS repository to GForge

At work we were testdriving SourceForge Enterprise Edition. It is a great system to keep all your project information, source code, documents, bug reports and changes together, and linked. As you may have noticed, the pricing model of the Enterprise Edition is a well kept secret on the site. Our management bargained with the Colabnet people, but the costs (or TCO) were way to steep to keep SourceForge as our main system.

Another product which promises to do almost the same thing is GForge Advanced Server. GForge originally started as a fork of the (then open source) SourceForge code, and is not as advanced as SourceForge is today. But their pricing is more to the likings of our financial people, and we decided it has a good tradeoff between function and price.

Having said all this, we need to migrate a few projects from SourceForge to GForge. If you’d like to know how to do this, this article is for you. It describes how to get your CVS repository into GForge in 6 steps.

Step 1: Disabling writer access to CVS in SourceForge

To be on the safe side, block write access to the CVS repository to prevent people from committing (and loosing) changes. You can block access using the settings in your SourceForge project, or modifying the “writers” file to the CVSROOT of your repository. If you’re not migrating from a SourceForge machine, you’ll probably want to use the latter method.

Step 2: Getting the modules from SourceForge

Log into your SourceForge server, go to the root of the CVS tree for your project. In our example, we’ll use “project1” and the modules “modulefoo” and “modulebar” (for the foobar minded). An example ssh session will look like this:

[root@projects /]# cd /cvsroot/project1
[root@projects project1]# ls -al
drwxrws---  10 nobody reps1010     4096 Mar  4 20:12 .
drwxr-sr-x  10 root   root         4096 Feb 20 13:59 ..
drwxrwsr-x   3 nobody reps1010     4096 Dec 28 14:23 CVSROOT
drwxrwsr-x   6 nobody reps1010     4096 Mar  4 14:26 modulefoo
drwxrwsr-x   5 nobody reps1010     4096 Mar  4 14:27 modulebar
[root@projects project1]#
         tar -czf project1.tar.gz modulefoo modulebar

Please note that we do not put the CVSROOT in the tar file. This prevents us from overwriting the CVSROOT later on in the GForge repository. After building the tar file, we need to send it to the GForge machine. You can do this by a secure copy. Put the tar file in the home directory of the user you’re using to connect to GForge during the copy. We’ll move it later.

Remove the tar file from the SourceForge server and disconnect. We’re done at the SourceForge server.

Step 3: Add CVS to your GForge project

We need a project to host our sourcefiles (and more). Using a web browser, connect to your GForge machine and create a project, or use an existing one if you’ve allready done so. Now go into the “Admin” tab of the project, and select “CVS repository” as your scm (Source Code Management) and press Submit:

Add CVS SCM to GForge

After you’ve done this, you should have a proper CVS repository set up on your GForge server, in which we can unpack the tarfile we’ve just created.

Step 4: Unpack the tar file on the GForge machine

In this example, I’m using the root user for convenience. Depending on your administrator, maybe you’re not allowed to be root (for good reason). Should you not have enough permissions to execute any of the following commands in the right locations, ask your administrator to execute Step 4 and 5 for you.

Log on to the GForge machine, and become root. Move the tar file to the cvsroot location of your project, and unpack the modules there. Your session should look something like this:

[root@gforge ~]# cd /cvsroot/project1
[root@gforge project1]# mv /home/someuser/project1.tar.gz .
[root@gforge project1]# tar -xzf project1.tar.gz
[root@gforge project1]# rm project1.tar.gz
[root@gforge project1]# ls -al
drwxrws---  5 nobody project1 4096 Feb 20 14:20 .
drwxr-xr-x 12 root   root     4096 Mar  4 19:49 ..
drwxrwsr-x  3 nobody project1 4096 Feb 20 14:19 CVSROOT
drwxrwsr-x  6 nobody 519      4096 Mar  3 11:57 modulefoo
drwxrwsr-x  7 nobody 519      4096 Feb 20 16:14 modulebar
[root@gforge project1]#

At this point, the modules are in GForge, but we can not access them yet.

Step 5: Setting the permissions

The files and folders in the modules are having the wrong ownership and permissions because they came from a different machine with different users. To be able to set the permissions, we need a username and a group to add to these files. When adding a project in GForge, a group with the same name as the project is also made.

First we need to change the ownership of the files, without touching the CVSROOT:

chown -R nobody:project1 modulefoo modulebar

Next, we need to set the permissions of all directories (except for CVSROOT) in the tree. We do this by recursively finding all directories in the modules and executing chmod against them. Type the following on 1 line, exactly as shown:

find modulefoo modulebar -type d -exec
    chmod u+rwx,g+rwxs,o+rx,o-w {} \;

The files have slightly different permissions. You can set these by typing the following on 1 line, exactly as shown:

find modulefoo modulebar -type f -exec
    chmod u+r,u-wx,g+r,g-wxs,o+r,o-wx {} \;

To check that everything has worked, take a look at the file and directory permissions of modulefoo:

[root@gforge project1]# ls -al modulefoo
drwxrwsr-x  6 nobody project1  4096 Mar  3 11:57 .
drwxrws---  5 nobody project1  4096 Feb 20 14:20 ..
drwsrwsr-x  2 nobody project1  4096 Feb 20 14:20 Attic
-r--r--r--  1 nobody project1 16330 Mar  3 11:57 build.properties,v
-r--r--r--  1 nobody project1 15195 Mar  3 11:57 .cvsignore,v

Step 6: Restart and Check GForge Access

CVS access will now work, but in GForge you will get an error in the CVS browser. To get rid of this error you need to restart apache. As root, do:

cd /etc/init.d
apachectl restart

Close your ssh session. Open your browser and go to your GForge server. Open your project, and click on the “CVS” tab on the right. You should now see the root of the project, with modulefoo and modulebar as folders in a list. Congratulations, you’re done.

Should you get the dreaded “Python error” with some rubbish text about not having enough permissions, you did not restart apache, or something went wrong while setting the file permissions and ownershisps. Double check them, and make sure you didn’t touch the CVSROOT directory, or the current or parent directories. If you did, simply restore from your backup and retry 🙂

Have fun migrating your projects.


13 Responses to Migrate CVS repository to GForge

  1. rolfje says:

    Bonus excersise: You can move the CVSROOT/history file over to the GForge machine. Once the parse_cvs_history.php job has run, you can have some history migrated into GForge.

    The only thing is that it does not seem to pick up ALL the history, if somebody finds out why I’d be happy to learn.

  2. jozef says:

    could you please tell me how much does cost an additional SFEE or GForge seat license per year?

  3. jozef says:

    I do not understad how GForge AS licenses the plugins for Eclipse, MS VS and MS Project. Are they available for the free 15 users edition? I need to evaluate them, but i see no download.

  4. rolfje says:

    I do not know how much the licenses cost for SourceForge or GForge. A couple of collegues talked to the SourceForge reseller in the Netherlands, and although they managed to get a discount, the seat licenses were a magnitude higher than the GForge licenses.

    Please contact GForge and Sourceforge sales staff for this information (both companies are not publishing prices, which is not a good thing in my opinion).

    GForge AS plugins are available to customers who have bought licenses. You can download them from your customer support page after you registered. If you contact the people at GForge, maybe they can give you some sort of temporary license and send you a plugin by email.

    Good luck.

  5. jozef says:

    Many thanks for your information.
    Do you use a time tracking feature of GForge to manage the budget of project?

  6. rolfje says:

    No Problem. No we do’n use any of the time tracking features. yet.

    Main reasons for using GForge (or alike) is for us:
    – Integrated code and bugtracking system
    – One server, one backup, easy management
    – Server in a DMZ, accesible for customers
    – Visibility configurable per project, per user
    – Searching works within documents (doc, pdf), and trackers.
    – Common, documented, procedure for doing projects, makes people more flexible to switch between projects.

    GForge is not perfect (authetication is a bit inconsequent at places, and the docmanager could use an overhaul) but is is way better than having 100’s of servers running all kinds of flavours of CVS (pserver, ssh, tunneled, what have you), and several seperate servers for bugtracking.

  7. Manu says:

    Nice, but in the find chmod command before the ; you need to place a backward slah “\”

  8. Manu says:

    So my command looked like this:
    find foobar -type f -exec chmod u+r,u-wx,g+r,g-wxs,o+r,o-wx {} \;

  9. rolfje says:

    You are right. For some reason, wordpress removes those slashes. I’ve put them back in a couple of times but for some reason they keep dissapearing. I’ll retry.

  10. sindhu says:

    Hi, This was very informative. Can someone tell me how to
    migrate projects form gforge to sourceforge/teamforge. Thank

  11. rolfje says:

    I think the process should be pretty much identical, but as we migrated away from sourceforge and have since dumped those servers, I can’t tell you how the reverse process exactly works.

    What you can try is register an open source project at sourceforge.net, switch on CVS, and try to migrate some fake code from a local fake CVS into that project. This way you can play with it without breaking important stuff.

    I would also advise you to post a question on one of the stackoverflow.com sites, you’ll get pretty good response there.

    If/when you’ve figured out how to do this, I’d appreciate it if you can post it somewhere and link to it from this comments feed, so that others benefit from that.

    I hope your migration works out, all the best!

  12. Manjunath Mariyappa says:

    Hi Rolfje,

    Thanks for posting the complete steps to migrate CVS projects from sourceforge to Gforge.
    The steps worked perfectly fine without any issues.

    Manjunath Mariyappa

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s