Pbuilder is a tool for building Debian packages. It will download the dependencies, build the package in a clean chroot, and return the result to you. It caches stuff pretty well, and can build things on other distributions.

Install the packages pbuilder and cowbuilder (to get the more efficient copy-on-write mode.)

Basic Instructions

First, we have to set up the chroot. You are mostly insulated from the details (unless you look yourself). Most files are placed in /var/cache/pbuilder/. The first of the commands below will create it using the default parameters (the distribution and mirror from your host system). The second one suggests a different mirror (NOTE: you definitely want a fast mirror) and different distribution.

sudo pbuilder create
# OR
sudo pbuilder create --distribution etch --mirror http://ftp.utexas.edu/pub/mirror/debian/

After that, it's set up. To keep the base system up to date or clean old downloaded packages, you can use

sudo pbuilder update
sudo pbuilder clean

It's easy to build a package. Just cd to the package directory (containing the infamous debian directory), and do

cd XXXXy.yy/
pdebuild

Magic happens:

richard@zarankiewicz:~$ ls /var/cache/pbuilder/result/
XXXX_X.XX_amd64.changes  XXXX_X.XX.dsc            
XXXX_X.XX_amd64.deb      XXXX_X.XX.tar.gz         

Using cowbuilder

cowbuilder --create {--distribution sid} {--mirror http://mirror.cc.columbia.edu/debian/}
pdebuild --pbuilder cowbuilder

You can put in your ~/.pbuilderrc:

PDEBUILD_PBUILDER=cowbuilder

DebianNotes/Pbuilder (last edited 2010-10-27 18:00:26 by RichardDarst)