Archive for the 'subversion' Category

Installing subversion python bindings

Tuesday, March 13th, 2007

This ended up being a hassle, for two reasons: 1) out of date build instructions in the subversion source, 2) their instructions may not work if you have multiple subversion installations. I learned a teensy bit of python troubleshooting along the way so jotting this down ….

First, building subversion:

./configure --with-apxs=/usr/sbin/apxs   # to build apache mods
            --with-swig                  

Note: in step 2 of subversion-1.4.3/subversion/bindings/swig/INSTALL, I got misled thinking the libsvn_swig_py.so should be there at this step. It shouldn’t. In fact, it won’t be even after step 3, but step 3 does build a similarly named file.

From here out the build was as advertised:


make swig-py
make check-swig-py
make install-swig-py   # switched to root for this step

Second, the install. The problem I had was that I had two versions of subversion installed (on purpose, for compatibility with an old repository on the same server). Unfortunately I was picking up the wrong version of the subversion bindings.

This is what subversion says to do, seems reasonable enough:

$ echo /usr/local/lib/svn-python 
> /usr/lib/python2.x/site-packages/subversion.pth

But…when python parses .pth files, it places them at the end of sys.path, rather than the position of the directory containing the .pth file. So even though I set PYTHONPATH=/usr/lib/python2.4/site-packages, sys.path ended up with that directory at the head, and /usr/local/lib/svn-python at the tail. Aaargh.

Sounds easy, but it took me a while to figure this all out. I learned:

  • python looks for modules in sys.path()
  • module.__path__ tells the provenance of the module; very handy
  • you really want tab-completion
  • Starting a new subversion repository

    Tuesday, August 29th, 2006

    Because I can never remember:

    svnadmin create /home/kylo/svnrepo

    svn mkdir file:///home/kylo/svnrepo/trunk -m “Add trunk”

    svn mkdir file:///home/kylo/svnrepo/branches -m “Add branches”

    svn mkdir file:///home/kylo/svnrepo/tags -m “Add tags”

    svn import /tmp/foo file:///home/kylo/svnrepo/trunk/foo -m “Import sample source from foo”

    Vendor branches in subversion

    Tuesday, June 13th, 2006

    Actually, the title is a bit of an oxymoron — subversion really doesn’t have support specifically for vendor branches. Instead subversion has a recommended practice for vendor branches, using subversion’s native branch/copy/merge support. Said practice is documented in the subversion book here.

    In the general case, though, updates on a vendor branch may be quite involved (i.e. lots of directory renames/reorgs, file movement, etc). To streamline the process, you really want to use a perl script that someone has concocted for this purpose.
    cd tmp
    svn co http://svn.collab.net/repos/svn/trunk/contrib
    cd client-side

    (or alternately download it here)

    Notice that this sucker is svn_load_dirs.pl.in (notice the .in extension); it wants a makefile (not supplied apparently) to tell it where the “svn” executable is stored. Assuming svn is in your path, then simply edit line 26 to:

    my $svn = 'svn';

    Okay, now just read how to use it and you’re ready to use vendor branches!
    This all seems like a hassle, and it kind of is, but managing vendor branches is a hassle. However, once you jump through the hoops above, the procedure works pretty well. Soldier on!