Lately I have been hacking around with pbuilder. Here I collect some information:
cdebootstrap
to debootstrap
. You also need to explicitly specify the MIRRORSITE (and possibly COMPONENTS) parameters (however, COMPONENTS is only available when packporting the currently unstable pbuilder to etch).pbuilderrc
even if started with sudo, and since this file is a fully powerful shell script, it is not securely possible to allow an (untrusted) user to run pbuilder via sudo.I have setup my pbuilder
so I can build packages for ubuntu dapper, ubuntu gutsy and debian etch by simply setting an environment variable:
$ sudo env DIST=gutsy pbuilder --build libsenf_0.0r702.dsc
This setup is achieved by simply placing the following into my ~/.pbuilderrc
(not root's !):
if [ -z "$DIST" ]; then echo echo "Environment variable '\$DIST' not set" echo exit 1 fi BASETGZ=/var/cache/pbuilder/$DIST.tgz BUILDRESULT=/var/cache/pbuilder/result/$DIST APTCACHE=/var/cache/pbuilder/aptcache/$DIST BINDMOUNTS=$BUILDRESULT OTHERMIRROR="deb file:$BUILDRESULT ./" DISTRIBUTION=$DIST TIMEOUT_TIME="" EXTRAPACKAGES="gnupg" case "$DIST" in gutsy|dapper) MIRRORSITE=http://de.archive.ubuntu.com/ubuntu/ COMPONENTS="main universe" ;; *) ;; esac
With above configuration, the build-roots can easily be configured:
To add the keyfile to the build root's, I have done (I used the same key for all repositories):
$ dist=gutsy $ result=/var/cache/pbuilder/result $ sudo mkdir $result/$dist $ sudo cp $result/etch/{update.sh,archive.key} $result/$dist $ sudo $result/$dist/update.sh $ sudo env DIST=$dist pbuilder --create $ echo -e '#!/bin/sh\napt-key add -' >run.sh $ sudo env DIST=$dist pbuilder --execute --save-after-exec run.sh <$result/archive.key $ rm run.sh $ sudo env DIST=$dist pbuilder --update
The configuration above already adds the packages built using the pbuilder available to the pbuilder to satisfy further build depends (see OTHERMIRROR
and BINDMOUNTS
setting). For this to work, I have setup each of the result directories as a debian repository (see SettingUpASimpleDebianRepository).
Before new packages are used by the pbuilder, you need to update the repository meta-data and need to update the build-root:
$ sudo /var/cache/pbuilder/gutsy/update.sh $ sudo env DIST=gutsy pbuilder --update