pbuilder: binary .debs in a clean chroot#
Builds binary .debs from the per-target source package using
pbuilder in a minimal chroot, exactly as a Launchpad/buildd build
would — per https://wiki.ubuntu.com/PbuilderHowto.
Generic across Debian and Ubuntu: packaging/deb/pbuild.sh (called by
make pkg TARGET=<t>) builds this image with the target's BASE_IMAGE
and runs it. The image picks the right archive keyring for its base, and
pbuilderrc picks the right mirror/components from OS
(ubuntu→archive.ubuntu.com, debian→deb.debian.org).
Usage (normally via the top-level Makefile)#
make pkg TARGET=ubuntu-26.04 # -> out/ubuntu-26.04/*.deb
make pkg TARGET=ubuntu-24.04
make pkg TARGET=debian-13
Each runs: docker build (BASE per target) → docker run --privileged
→ pbuilder create (first time) → pbuilder build *.dsc. Results are
written to out/<target>/.
Important#
--privilegedis required — pbuilder builds in a chroot and needs mount/chroot; without itpbuilder createfails inside Docker.- Network at run time — debootstrap fetches the base chroot and apt installs the Build-Depends. The OxCaml compile itself uses only the vendored sources in the orig, so it needs no network.
- Per-target cache:
pbuild.shmounts aoxcaml-pbuilder-cache-<t>named volume at/var/cache/pbuilder, so the slowpbuilder createis done once per distro. - If a registry lacks e.g.
ubuntu:26.04, override that target'sBASE_IMAGE(editpackaging/targets/ubuntu-26.04.confor passBASE_IMAGE=on the make line). - The build is the full flambda2 bootstrap — expect it to take a while in the clean chroot.
Files#
| file | role |
|---|---|
Dockerfile |
${BASE} + pbuilder/debootstrap/devscripts; keyring matched to the base |
pbuilderrc |
/etc/pbuilderrc — distro/mirror/keyring/result, from DIST+OS |
build-debs.sh |
entrypoint: pbuilder create then build --buildresult /result *.dsc |