Development - Setting up pbuilder

This is a very quick and brief guide to how I currently set up pbuilder, it works for me, there might be better guides about, I don't know, I haven't looked.

First, you need to have pbuilder and debootstrap installed... after that create a temporary directory and cd in to it.

Next step is to debootstrap for the distribution you are going to develop for, so debootstrap --variant=buildd dist . http://some/mirror which will create the basic filesystem, you're almost ready... now, go in to that and edit the etc/apt/sources.list adding in a line for your prefered mirror. Next step is to clean out the cache that's in there, so, remove all the .deb files from var/cache/apt/archives.

Now you need to make a .tgz of the stuff, so... tar -czf /var/cache/pbuilder/base-dist.tgz . will create you a file suitable for use with pbuilder, you no longer need the files in your temporary directory (assuming that the .tgz file was created nicely). So, you've got this base-dist.tgz file, what next? You'll probably need gnupg in the pbuilder setup (certainly for the more recent debian distributions, and for hoary, it makes it a lot easier if you have this...), so, pbuilder login --basetgz /var/cache/pbuilder/base-dist.tgz --save-after-login once that's 'logged you in' you'll need to run apt-get update and then apt-get install gnupg, then you can exit the chroot and all should be well with the world, it should save the changes in to the .tgz file ready for later use.

From now on in, you should be fine to just use the usual pbuilder commands with the --basetgz flag pointing to the right base file, and all should be well.

I use sudo in order to run pbuilder myself, and so I've actually got some simple single line wrapper scripts that I use, I also use the --buildresult flag in order to seperate out the builds from the different pbuilder setups.

I hope that this quick guide helps, that's about it...