If you are maintaining Debian packages then you probably know the problem that you have a number of upstream versions and revisions flying around your file system. There is a nice way to handle different revisions through the SubVersion repository system: svn-buildpackage from Eduard Bloch. To make things truly perfect you can even use the pbuilder but then it becomes a mess of different man pages and command line options. I have gone through that so you won't have to.
Install the needed packages
apt-get install subversion apt-get install svn-buildpackage apt-get install pbuilder
Set up a Subversion repository
Make sure you have a SubVersion repository already created using
svnadmin create ...
Every package is supposed to have a repository of its own.
Import your package into the repository
Using the svn-inject command you will now need to import the package into the repository. First create a directory where you want the repository to be checked out (on your workstation) and run something like this:
svn-inject -c 2 /path/to/old/package/filepp_1.7.1-6.dsc http://my.reposito.ry/svn/filepp
- the name of the tool that imports your package into the repository
checks out the full repository tree. (See
http://svnbook.red-bean.com/en/1.1/ch05s04.html#svn-ch-5-sect-6.1 on how the repository layout looks like. The -c option just controls which part of the repository is checked out now. It will not change anything in the repository itself. -c 0 does not check out anything. -c 1 just checks out the trunk directory. And finally you will get everything from the repository by using -c 2.)
- checks out the full repository tree. (See
- the path to the .dsc file of the package you want to import
- the Subversion URL of the repository you have created
You will probably now have a directory layout similar to this:
What's in there
The *.orig.tar.gz archives (aka upstream tarballs) go here
Here is where you will start to build the package. It's the place that contains the debian/ directory.
Contains the upstream releases
Contains tags (copies) of your work for every upload (every time you use dch -i
Note: filepp is just the name of my example package. Yours will probably named differently.
Creating the pbuilder directory
pbuilder is a nice tool that uses debootstrap (another nice tool) to create a clean build environment in a chroot directory. It makes sure that your build dependencies are set correctly and builds your package on a virtual 'sid' without using whatever weird package versions you may use on your workstation.
Put these lines into your ~/.pbuilderrc
Use any mirror you like. The default mirror is in Japan which may not be the best choice for you. See /etc/pbuilderrc for more options.
Make sure you can use sudo to gain root privileges for the pbuilder program. Put this line into your /etc/sudoers file:
frederic ALL=(ALL) /usr/sbin/pbuilder
Assuming that your user name is frederic.
sudo pbuilder create
Build the package
Change to the filepp/trunk directory and just work on the package like you always did. Once you are happy with your work and want to create binary packages run this command:
svn-buildpackage --svn-builder="pdebuild --buildresult `pwd`/../build-area --debsign-k email@example.com"
You may as well leave out the --debsign-k option if you do not need/want to sign the package.
At the end of the build process you will automatically be shown lintian warnings/errors - if there are any.
If all goes well you will find your package in filepp/build-area. There is one quirk though. There is a superfluous file called something like filepp_1.7.1-7_source.changes. This file was created during the build process. It can confuse your dupload though. So make sure you just remove it before you upload the package. (The svn-buildpackage maintainer told me that it is generated by pbuilder.)
Tagging a revision
Once your package is uploaded you should create a tag from it. In Subversion speak this means creating a copy of your current trunk directory. This way you can always take a historic version in case you need it. Just run:
Don't forget to commit the changes (svn ci). A new debian/changelog entry will be started automatically.
Updating to a new upstream version
Once your upstream developers comes up with a new *orig.tar.gz you need to update your package. This is done using the svn-upgrade command. Just give it the new tarball as a parameter and you are set:
Using svn-buildpackage with debuild: https://trac.cyconet.org/debian/wiki/SvnBuildPackage
How the Debian Perl group handles things: http://pkg-perl.alioth.debian.org/subversion.html