Skip to main content

Creating a dummy Debian package for Subversion (svn)

Since I've installed Subversion, I've been looking around for a good wiki and ticket management system so that I can get the whole 'development environment' setup on my home server.

I installed Wikipedia's MediaWiki at work, after our Instiki wiki came unstuck and left me with a whole load of nothing after it decided to stop writing archives to disk for about 5 weeks! MediaWiki is a little heavyweight for what I need, so I started to look around. I noticed on the Ruby on Rails website that they had a pretty simple ticket system, and after some investigation it turned out to the the open source Python-based Trac.

Trac also has a rather pretty Subversion repository browser so it seemed perfect for the small home projects that I want to develop.

I went to 'apt-get' Trac on my Debian Stable server, only to find that it wanted to install Subversion as a dependency even though I had a later version installed from source.

The Debian package management system works great so long as you don't install any applications from source, if you do it doesn't know they are installed and so will try to install over the top of your newer version.

What you need to do is create a 'dummy package' to fool the Debian package management system into thinking that it's installed a valid package. Here's how I made a Subversion package for my latest 'built from source' version 1.2.1 of Subversion.

First you need install the equivs package, this provides all the tools to be able to build Debian packages that apt-get & dpkg can understand and install.

apt-get install equivs

Now that equivs is installed, you need to generate the templates that are used to build the package. Run equivs-control and pass in the name of the package that you want to create. In my case I wanted to emulate the Subversion package that Trac wanted to install which was named 'subversion'.

equivs-control subversion

This creates a 'subversion' file in the directory that you ran the equivs-control command from. Edit this file as follows:

* Leave the top three lines:

Section: misc
Priority: optional
Standards-Version: 3.5.10

* Change the following lines: (note: the Subversion I installed was 1.2.1, hence the "Version: 1.2.1-1" value)

Package: subversion
Version: 1.2.1-1
Maintainer: Andrew Beacock <andrew@andrewbeacock.com>
Architecture: all
Description: A dummy Subversion package to fool Debian's package management system into thinking that the 'built from source' version is an official Debian package.

* Remove all these lines:

Pre-Depends: <packages>
Depends: <packages>
Recommends: <packages>
Suggests: <package>
Provides: <(virtual)package>
Copyright: <copyright file; defaults to GPL2>
Changelog: <changelog file; defaults to a generic changelog>
Readme: <README.Debian file; defaults to a generic one>
Extra-Files: <additional files for the doc directory, commaseperated>

Save the file, quit back to the console and then run the equivs-build command to build the package.

equivs-build subversion

As long as you've done everything right, it will start to generate all the install scripts that are required by Debian packages, and ends up creating an equivs directory (that can be safely deleted) and the package itself - subversion_1.2.1-1_all.deb.

Now install this package using dpkg as you have it locally and apt-get would get the wrong version from the internet.

dpkg -i subversion_1.2.1-1_all.deb

You now have Subversion registered in Debian's package management system. To prove it, run dpkg -l subversion, there should be "ii" to the left of the listing for "subversion". This means that you can now install Trac without it stomping over your existing 'latest version' of Subversion.

A future post will document the steps involved to build Trac from source, but using the Debian package management system to install all the dependant components...

Technorati Tags: , , , ,

Comments

Anonymous said…
Just what I needed, thanks Andrew!
David F. said…
As of 2013/03/12 Works like a charm! Thanks.