Saturday, March 29, 2008

Adventures in SVN

It's been blogged about before and will probably be blogged about again, but getting svn installed as a launchd service in OS X is both easy and fustrating at the same time. It seems like it should be like a checkbox somewhere cause at the end of the day it's not that hard. My task was simple, just install svn so that I don't have to keep on restarting it every time my cat hits my power button or other power related failure happens to my server computer. Which now happens to be an iMac G5 running Leopard. Also is the added trick of making sure that my windows laptop can easily checkout the repository.

I started with a simple google search which led me to some old pages.

"Starting svn with launchd" which led me to Mr. Paulus' page on doing the exact same thing with his Mac Mini in Tiger. Problem was that both these pages don't actually solve the problem anymore because of changes of svn. Fortunately Mr. Paulus' page linked to yet another blog where he got the instructions on how to use launchd in the first place. Marc Pacheco's page has been updated.

My problem was that I got the service installed but nothing could talk to it. This was because I guess svn now likes to use IPv6 instead of IPv4. The original launchd plist has instructions to use IPv4 which causes the problem.

Ok, no prob, just change to IPv6, or do what I did and just remove the specification completely. This fixed the issue for me at least, on my Mac.

Windows on the other hand doesn't like to install IPv6 by default in Windows XP. So in order to get this working at all I had to install IPv6 for my network adapter on my Windows XP box. I have also found out that at least in my experience, installing IPv6 on windows also improves the speed of any file sharing that you are doing between the 2 platforms. I don't know if this is just something that happened to me or if it's proven elsewhere, but it helps a lot.


Here's my final file that 'works for me' in Leopard. If you use it make sure to replace the --root=... with your repository location.

<plist version=\"1.0\">
<dict>
<key>Debug</key>
<false>
<key>Disabled</key>
<false>
<key>Label</key>
<string>svn</string>
<key>OnDemand</key>
<true>
<key>Program</key>
<string>/usr/local/bin/svnserve</string>
<key>ProgramArguments</key>
<array>
<string>svnserve</string>
<string>--inetd</string>
<string>--root=svnrepository</string>
</array>
<key>ServiceDescription</key>
<string>SVN Code Version Management</string>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>svn</string>
<key>SockType</key>
<string>stream</string>
</dict>
</dict>
<key>Umask</key>
<integer>2</integer>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false>
</false>
</dict>
</true>
</false></false></dict>
</plist>

No comments: