January 31st, 2009

Ubuntu, Erlang and Launchpad

Ubuntu Hardy has an old version of Erlang. Ordinarily this wouldn't be a problem, but it turns out that R12B (the current release) added a few libraries that I use in my Project Euler solutions. Upgrading to Intrepid isn't really something I want to do at the moment (for reasons that I'll happily discuss over a beer) and language interpreters don't get backported.

This left me with two options: Rewrite my code to not use the new regular expression library and the not-quite-an-array data structure that Hardy's version of Ubuntu lacks or build and install a modern Erlang from source. Fortunately, a little investigation turned up a third: Launchpad's Personal Package Archives.

I was surprised at easy it is to rebuild a deb source package and get it into Launchpad's build system. Since I didn't have to make any changes, it was merely a matter of downloading the source files from Intrepid's Launchpad page, adding a changelog entry to get my own version number and email address (for pgp signing) in there and running a couple of commands to build and upload the new source package.

There are a couple of caveats to adding packages to a PPA, though. It's generally a good idea to at least build and test the binaries locally before uploading. Not only is this polite (in that you're less likely to tie up shared build resources with broken code), it also saves time waiting around for builds to be scheduled only to discover that they're broken. In addition, there's a bit of a lag between Launchpad claiming that a build is complete and the binaries actually being available. In particular, it took quite a while for launchpad to make my i386 packages (which includes all the architecture-independent stuff) available despite announcing a successful build in the web interface.

All in all, I'm very impressed with PPAs. In half an afternoon, I have managed to add custom (sort of) versions of several packages to my PPA and install them on my local machine. Not only that, but they're available for anyone who wants to use them with no extra effort on my part.