Using pbuilder as a package builder allows you to build the package from
within a chroot environment. You can build binary packages without using
pbuilder, but you must have all the build
dependencies installed on your system first. However, pbuilder allows the
packager to check the build dependencies because the package is built within a
minimal Ubuntu installation, and the build dependencies are downloaded
according to the debian/control
file.
The following is a brief guide to installing, using, and updating a pbuilder environment, however, there are many details of pbuilder usage that are outside the realm of this guide. The pbuilder man page has lots of information and should be consulted if you have problems or need more detailed information.
The first, and perhaps most obvious, thing to do is to install pbuilder. If you want to create a pbuilder for a release newer than the one you currently have installed, you will need to manually install the debootstrap .deb (from packages.ubuntu.com) from the newer release. To create a pbuilder execute:
sudo pbuilder create --distribution <distro> \ --othermirror "deb http://archive.ubuntu.com/ubuntu <distro> universe multiverse"
where <distro> is the release you want
(edgy for instance) to create the pbuilder
for. If you would like to create more than one
pbuilder environment you can append the
--basetgz flag with the desired location for
the compressed pbuilder environment.
The default is /var/cache/pbuilder/base.tgz
.
If you do choose to use --basetgz you will
need to use it with the other pbuilder
commands so pbuilder knows which
compressed build environment to use.
![]() |
|
Creating a pbuilder environment will take some time as debootstrap essentially downloads a minimal Ubuntu installation. |
Now that you have a running pbuilder you can build binary packages from the source package by invoking:
sudo pbuilder build *.dsc
This will build all the source packages in the current directory. The
resulting .debs and source packages can be found in
/var/cache/pbuilder/result/
(which can be
changed with the --buildresult flag).
You should always have a current pbuilder whenever you are testing your source packages, especially when you are building for a development release that is rapidly changing, to ensure that the dependencies are properly found. To update your pbuilder, use:
sudo pbuilder update
If you would like to upgrade you pbuilder to a new release you can use pbuilder update in combination with the --distribution flag:
sudo pbuilder update --distribution <newdistro> --override-config