pbuilder/pdebuild mini-howto (Was: Building a build environment)
2008/7/29 Richard Hurt <rnhurt@kangaroobox.com>:
> I am just getting started in Debian package building and I need to know if
> this idea is valid or if there is a better way.
> [...]
> What do you use?
I find pbuilder easiest to work with. Since I am mostly running
Testing, I have two setups, one for Sid and one for Backports. Here is
a mini-howto for what to do.
Create a ~/deb/unstable-pbuilderrc:
DISTRIBUTION="sid"
BASETGZ="$HOME/var/pbuilder/$DISTRIBUTION-base.tgz"
BUILDPLACE="$HOME/var/pbuilder/$DISTRIBUTION"
MIRRORSITE="http://ftp.se.debian.org/debian"
USEPROC="yes"
USEDEVPTS="yes"
USEDEVFS="no"
BUILDRESULT="$HOME/var/presult"
APTCACHE="/var/cache/apt/archives"
APTCACHEHARDLINK="no"
REMOVEPACKAGES="lilo grub"
HOOKDIR=""
export DEBIAN_FRONTEND="noninteractive"
DEBEMAIL="Jens Peter Secher <jps@debian.org>"
BUILDSOURCEROOTCMD="fakeroot"
PBUILDERROOTCMD="sudo"
DEBBUILDOPTS=""
APTCONFDIR="$HOME/deb/apt.config"
BUILDUSERID="1000"
BINDMOUNTS=""
DEBOOTSTRAPOPTS[0]='--variant=buildd'
And create a ~/deb/backports-pbuilderrc:
DISTRIBUTION="etch"
BASETGZ="$HOME/var/pbuilder/backports-base.tgz"
BUILDPLACE="$HOME/var/pbuilder/backports"
MIRRORSITE="http://ftp.se.debian.org/debian"
OTHERMIRROR="deb http://www.backports.org/debian/
$DISTRIBUTION-backports main"
USEPROC="yes"
USEDEVPTS="yes"
USEDEVFS="no"
BUILDRESULT="$HOME/var/presult"
APTCACHE="/var/cache/apt/archives"
APTCACHEHARDLINK="no"
REMOVEPACKAGES="lilo grub"
HOOKDIR=""
export DEBIAN_FRONTEND="noninteractive"
DEBEMAIL="Jens Peter Secher <jps@debian.org>"
BUILDSOURCEROOTCMD="fakeroot"
PBUILDERROOTCMD="sudo"
DEBBUILDOPTS=""
APTCONFDIR="$HOME/deb/apt.config"
BUILDUSERID="1000"
BINDMOUNTS=""
DEBOOTSTRAPOPTS[0]='--variant=buildd'
To stop apt complaining, create an
~/deb/apt.config/apt.conf.d/allow-unauthenticated:
APT::Get::AllowUnauthenticated 1;
To give pbuilder a place to store its stuff, do
mkdir -p ~/var/presults ~/var/pbuilder
To create the environments, do
sudo pbuilder create --configfile ~/deb/unstable-pbuilderrc
sudo pbuilder create --configfile ~/deb/backports-pbuilderrc
To build a new package, in your package directory
(eg. ~/deb/libfoo/libfoo-2.13/) you then just do
pdebuild --configfile ~/deb/unstable-pbuilderrc
or to build a backport, use the -sa -v options:
pdebuild --configfile ~/deb/backports-pbuilderrc --debbuildopts '-sa -v2.12-1'
To manually install dependencies in the environment, you can do
sudo pbuilder login --configfile ~/deb/backports-pbuilderrc
and then manually copy (source) packages into the chroot. To tweak
things in the environment in general, you can do
sudo pbuilder login --save-after-exec --configfile ~/deb/unstable-pbuilderrc
To sponsor a package, use the -k option:
pdebuild --configfile ~/deb/unstable-pbuilderrc --debbuildopts '-kFE63E8A1'
Remember to update the environments before building:
sudo /usr/sbin/pbuilder update --configfile ~/deb/unstable-pbuilderrc
The resulting packages are placed in ~/var/presults, where you need to
sign them with debsign, which works best with GPG Agent running, so put
something like this in your .xsession file:
if test -f $HOME/.gpg-agent-info && \
kill -0 `cut -d: -f 2 $HOME/.gpg-agent-info` 2>/dev/null;
then
GPG_AGENT_INFO=`cat $HOME/.gpg-agent-info`
export GPG_AGENT_INFO
else
eval `gpg-agent --daemon`
echo $GPG_AGENT_INFO >$HOME/.gpg-agent-info
fi
HTH,
--
Jens Peter Secher.
_DD6A 05B0 174E BFB2 D4D9 B52E 0EE5 978A FE63 E8A1 jpsecher gmail com_.
A. Because it breaks the logical sequence of discussion.
Q. Why is top posting bad?
Reply to: