Contact me sending an e-mail (antispam defense activated)
Some Debian Packaging Tips
Sandro Tosi, 01 August 2006
It's been about 6/8 months since my first attempt of packaging a tool for Debian, and during this time I've collected some tips that could be useful to share.
1. First phases of packaging a new tool
There are mainly two categories of packages: brand new (ie, you're packaging an application that new for Debian) or upgrades (ie, you're upgrading an appplication already in Debian).
The second category could be the easier one, since someone else has already done all the configuration for the packaging, but the first category is the one where you can learn more about creation and maintenance of a Debian package. Note, don't give up! It might seem too difficult, but if I was able to forge a package, everybody can! :)
Ok, so you'd like to package something for Debian; so, first you have to choose what to package: you could have found a tool no already package, and so start from that one (this is a good choise, since usually you will use that software, so you can notice bugs and corrections needed to increase usability of that program) or, if you have still nothing to package, you can go to a webpage where Debian users request a tool to be packaged.
Before start with the real activity of packaging, you'll have to install some support tools, useful during packaging; I suggest the following packages: ***** debhelper? debian-policy? maint-guide? debuild? lintian? linda? svn-buildpackage? pbuilder? cvs-buildpackage?
2. Initial steps of packaging
Following you can find a list of steps you'll have to follow in order to setup a nice Debian package starting from an upstream tarball (let's suppose the tool you're going to package is called foobar and the version is 1.4:
3. Handle packages with source code management systems
For the first times, the previous sequence could be good, but if you go further, you'll need some different package source management. As you may already heard, there are some source code versioning tools, to handle code, the most famous are CVS and Subversion (SVN). Some Debian Developers (you may find them called simply DD) have written tools to use both SVN and CVS to manage the package creation, keeping track of the modifications, and easy the package creation and upgrade to a new upstream version. I suggest to use SVN, since is the de-facto standard.
In order to take advance from SVN, you have to follow a different path from the previous one; the first three steps as valid even here, then the difference (I suppose you have already a SVN repository where to store package code, if not, create one; I suppose you have it in /SNV/ directory):
and now you can continue with the previous 4-5-6 steps.
Injecting the source package in its first phase of creation, allow to store the whole history of creation. Someone may argue that's not needed to inject a rough package (with all dh_make templates in debian/) but I'd rather this way: you are free to choose when to inport you package into the repository, at the beginning, or at the end of package setup.
Now, when you need to create a package, you have to commit the changes done in the working copy to the repository and exec svn-buildpackage (take a look at its manpage for some explaination).