pbuilder tips

Many thanks to Arnaud Fontaine for providing me with the solutions to all pbuilder problems I had during the last years.

This is what happens to me: someone reports a bug in debtags, and it turns out that the bug needs fixing in libwibble.

I start by fixing libwibble, then I need to recompile libtagcoll2-dev, then use it to recompile libept-dev, which I can finally use to rebuild debtags.

A normal pbuilder setup would only take dependencies from apt sources, so I need to create an APT source with the packages I just built and feed it to pbuilder. Now, thanks to Arnaud's suggestion, I have the easy way to create the APT repository:

$ cat update-aptsource
cd /var/cache/pbuilder/result
dpkg-scanpackages . /dev/null | gzip -9 > Packages.gz
echo "Running pbuilder update..."
su -c "pbuilder update"

Since pbuilder works in a chroot environment, the easiest way of making it access the repository is via http. First I put the new repository online:

ln -s /var/cache/pbuilder/result /var/www/debian

Then I add it to /etc/pbuilderrc:

OTHERMIRROR="deb http://localhost/debian/ ./"

Then I tell pbuilder to update the configuration inside the chroots:

pbuilder update --override-config

And finally I can build my stack of packages.

This is probably not rocket science for many DDs. What I'm really appreciating here is using the minimum amount of pbuilder customization and of lines of code of extra infrastructure to maintain.

Now, at every compile round, I just need to run that update-aptsource script to inject into the system the dependencies that I have just built.

Update: Josh Triplett sent the configuration options to avoid using an HTTP server and use pbuilder's bind-mount facility:

OTHERMIRROR="deb file:/var/cache/pbuilder/result/ ./"

The syntax of BINDMOUNTS is to take a directory from outside the chroot and bind mount it to appear in the same place inside the chroot. No option exists to mount a directory outside the chroot in a different place inside the chroot.

It can be done writing a custom hook script, but one needs to be careful: people have lost home directories by having them still bind-mounted in the pbuilder chroot when pbuilder cleans it up.