Friday, May 02, 2008

How to make SVN work on R-Forge and your local driver?

R has a new platform-R-Forge-that enables developers and users to communicate with each other. More importantly, it is a version control platform that enables different developers to keep track on what others have been working on. So that ideally, if developer A revises some code in a package, developer B will notice the change and can avoide working on the older verison of such package.

Here is the official user's manual for developers as well as users. I am a windows user. So here I try to summarize steps for windows users only. For users of other platform, please consult the manual reference.

Firstly, we need to install some softewares (these are all freewares).

  1. SSH Secure Shell Client 3.2.9: a SSH protocol client. This is the last free version of this software. It could be easily found online. There is a free SSH client OpenSSH. However, it would clash with Rtools because of multiple cygwin1.dll. One way to solve this is choose not to install cygwin when installing Rtools.
  2. TortoiseSVN: A windows-interfaced version control software.
  3. puttygen: A SSH key generator.
  4. pageant: A authentication agent.
Secondly, use puttygen to generate a SSH (This step is for admin and developers).

  1. Double click puttgen.exe and click "generate" (make soem random movemnet).
  2. Save the private key (do NOT set a password).
  3. Copy the text in the text field "Public key for pasting into OpenSSH authorized keys file" (or the red selected area in the figure below:
  4. Go to R-Forge, Login in and go to "My Page" and then click on "Account maintenance". At the bottom of this page, click on "edit key" in the "Shell Account Information" window. Copy and paste the key here.
  5. The key should look like this:
ssh-rsa AAA... foo@bar


Thirdly, you have to wait an hour for R-Forge to activate the key (No kidding, an hour!!)

Fourthly, double click pageant.exe and load your private key which you save in the 2nd step. After you doble click pageant.exe, you will see a pageant icon in the bottom right of the toolbar. Right click the iconand then "add key".

Finally, install TortoiseSVN and SSH Secure Shell Client. Assume all the default installation steps.
  1. Link SSH with SVN: Go to the TortoiseSVN folder in the start meanu. "start menu" --> "TortoiseSVN"-->"settings"--"Network" (on the left panel) --> Browse for SHH (on the left panel). The file we are looking for is, for example, C:\Program Files\SSH Communications Security\SSH Secure Shell\ssh2.exe
  2. Check out package from R-Forge: start up file manager "explorer" and pick a folder you want to store the check-outed package: Right click the mouse and you will see an option "SVN check out" click it (You should still keep pagean running).


In the "URL of repository", type, for example:

svn+ssh://peter@svn.r-forge.r-project.org/svnroot/arm/pkg

substitute "peter" for your R-Forge user name and substitute "arm" for the package name your want to check out!

In the "Checkout directory", type, for example:

c:/arm

A windows will pop out and ask you to type the password. The password is the same as your R-Forge password. Note, you should have you pageant running (check bottom right toolbar) with key loaded. The package will be checked out and you will find under checkout directory, there are some folders created such as "R", "man".


4. Now you have synchronized the package with R-Forge. You can revise it and upload it back to R-Forge. To do this, right click the folder or the files, there will be an option called "SVN commit".

In short, it is really complicated. And in fact, these steps are only useful for developers. For a common user, just checkout the package using:

svn://svn.r-forge.r-project.org/svnroot/arm/pkg

Of course, you cannot upload the code back to R-Forge if you are not the administrator or a developer.

5 comments:

Prestes said...

Thank you very much!! I've a new project in R-Forge and don't find any good documentation about how to use TortoiseSVN + SSH + R-Forge. Best regards!

Yu-Sung Su said...

Well, I could not find a good one either. So I figure out that I should write down how to make it work. I am glad that this helps!

Michał said...
This comment has been removed by the author.
Michał said...

Hi! Thanks a lot for the tips. One question: Do you know why do you need OpenSSH for this to work? The original R-Forge manual does not mention this. I'm just wondering...

I did not try your solution though as I use Cygwin for other things and I did not wanted to uninstall it. I was able to connect with TortoiseSVN specifying TortoisePlink as an SSH client (in Settings|Network). The only strange behavior I get is that when performing almost any kind of operation with Tortoise I have to type in a password, and do it multiple times (like 2-3) for a single operation, like viewing a log (!!!). Can it be a result of my network config (I have a router)? Any clues?

Yu-Sung Su said...

You need SSH client to do the SSH protocol with R-forge. I believe it was mentioned in the manual somewhere. I remember seeing it. One way to use OpenSHH without problems is to not to install Cygwin it provides. Of course, this assums that you already have a copy of Cygwin in your system.