We build Web & Mobile Applications.

< All Articles

Ruby Subversion Bindings

UPDATE! The process outlined in this post is a bit easier with Subversion 1.6.6

Using David Summers’ RPMs it is possible to install Subversion, neon, APR and SWIG directly from RPM without any modifications.

Download the Subversion source and follow the last few steps of this article:

./configure --with-ssl --with-swig --with-berkeley-db
make swig-rb
make check-swig-rb
make install-swig-rb

I’m currently working on tidying up our development environment and team collaboration tools. One part of this is to either write or reuse an existing package – at the moment we use Trac but this doesn’t seem to be in the spirit of Rails development!

On my list to evaluate are Collaboa, Retrospectiva (which I believe was branched from Collaboa), Redmine (which we’ve used before, albeit a while ago) and Devalot.

A common requirement of the tools that support reading from your SVN repository is to have the Ruby SVN bindings installed and working – a task that for some reason seems harder than it should be.

The development box currently runs on CentOS and we often custom compile our own RPMs as those available as default are often hideously out of date or not available at all. The latter of the two seems to be the case for the Ruby Subversion bindings. I tend to prefer building the RPMs so I can maintain some element of package management and avoids the spewing of files that ‘make install’ causes – it also makes it easier to carry things across between machines.

I’ve tried to document the steps to help anyone else trying to achieve the same result – so I’ve included what I can translate from my notes!

The road to Subversion Ruby Bindings..

Prerequisites

I used my development machine to build this so it already had a lot of the development libraries on there. As such, there may be some prerequisites that I don’t explicitly state, but you should be able to determine what is required.

A couple of obvious prerequisites are:

Also, you may as well make sure your system is up to date before continuing.

yum update

SWIG

The source for subversion seems quite fussy about what versions to use – for SWIG it suggests a range with 1.3.29 being the latest supported update (I tried with 1.3.32 but ran into errors)

Pull down the source code and place it into your build directory. For a non RPM build then do the usual:

./configure
make
make install

For the RPM build I generated the swig.spec file from the source, and proceeded to build the RPMs (obviously you will need to configure your RPM build environment):

rpmbuild -ba swig.spec

This produced the required swig-1.3.29-1.i386.rpm which was then installed (you may need –U if you’ve got an older version of SWIG already installed):

rpm -i swig-1.3.29-1.i386.rpm

Neon

The neon library is also required and the preferred version is 0.25.5.

Pull down the source code and then either build from source or build the RPM. If you’re building from source you’ll need to include the ––with–ssl flag. If you’re building the RPM then grab the neon.spec file I used.

The resulting RPM files are neon-0.25.5-1.rpm and neon-devel-0.25.5-1.rpm – install both (only necessary on your build machine – if you’re reusing the RPMs once they’re all built you won’t need the devel packages).

APR and APR-Util

Thankfully (due to the good work of David Summers) I was able to find a reasonably up to date version of APR and APR–Util to avoid me having to build my own. Grab and install the following files:

Subversion

The final step is to build Subversion itself. Pull down version 1.4.5 and then place it in your source directory ready for building.

If you’re just making and installing then I can have a stab at the steps you should take, but obviously I went the RPM route so the following is untested:

rm -rf apr apr-util neon
./configure --with-openssl --with-ssl --with-swig --with-berkeley-db
make
make install
make swig-rb
make check-swig-rb
make install-swig-rb

If you’re taking the RPM route then here is the subversion.spec file – which is basically a modified version of that provided on David Summers’ site – updated to reflect the correct versions and add a ‘ruby’ RPM package along with those for Perl and Python.

The RPM files built will be:

Install subversion-1.4.5-1.i386.rpm and subversion-ruby-1.4.5-1.i386.rpm along with the other bindings if required.

Test it!

The final step is to test if it’s all working:

ruby -e 'puts require("svn/core")'

If you see the result true then you’re there! If not, somethings gone wrong so it’s time to step back and work out if it’s my instructions or if you’ve missed a step!

Updated on 07 February 2019
First published by Chris Anderton on 21 November 2007
© Chris Anderton 2019
"Ruby Subversion Bindings" by Chris Anderton at TheWebFellas is licensed under a Creative Commons Attribution 4.0 International License.