[unknown button type]

PBuilder notes

PBuilder is an excellent tool for ensuring correct packaging on Debian/Ubuntu distributions. It uses [c]debootstrap to create a clean chroot in which it builds your package. It also means you can do backports quite easily.

This script is originally from the Ubuntu PBuilder Howto (and somewhere else I can't find now). It's an excellent config file for pbuilder: save it as ~/.pbuilderrc, and then:

  1. Create pbuilder chroots with sudo pbuilder create sid (or lenny, squeeze, jaunty, intrepid, etc)
  2. Build packages with pdebuild where you would normally use debuild (I have an alias in ~/.bashrc: alias pdeb='pdebuild --buildresult `pwd`/../build-area --debbuildopts "-j8" ' )
  3. To backport to eg. jaunty, use DIST=jaunty pdebuild

This trick requires debootstrap (instead of cdebootstrap). Note that I keep my pbuilder stuff in ~/Software/pbuilder.

~/.pbuilderrc:

# Other options
REMOVEPACKAGES=lilo
DEBOOTSTRAPOPTS='--variant=buildd'
BUILDSOURCEROOTCMD=fakeroot
AUTO_DEBSIGN=no
DEBOOTSTRAP=debootstrap
HOOKDIR=$HOME/Software/pbuilder/hooks/
 
# Codenames for Debian suites according to their alias. Update these when
# needed.
UNSTABLE_CODENAME="sid"
TESTING_CODENAME="squeeze"
STABLE_CODENAME="lenny"
STABLE_BACKPORTS_SUITE="$STABLE_CODENAME-backports"
 
# List of Debian suites.
DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME
    "unstable" "testing" "stable")
 
# List of Ubuntu suites. Update these when needed.
UBUNTU_SUITES=("jaunty" "intrepid" "hardy" "gutsy")
 
# Mirrors to use. Update these to your preferred mirror.
DEBIAN_MIRROR="ftp.iinet.net.au/debian"
UBUNTU_MIRROR="ftp.iinet.net.au/linux"
 
# Optionally use the changelog of a package to determine the suite to use if
# none set.
if [ -z "${DIST}" ] && [ -r "debian/changelog" ]; then
    DIST=$(dpkg-parsechangelog | awk '/^Distribution: / {print $2}')
    # Use the unstable suite for Debian experimental packages.
    if [ "${DIST}" == "experimental" ]; then
        DIST="unstable"
    fi
fi
 
# Optionally set a default distribution if none is used. Note that you can set
# your own default (i.e. ${DIST:="unstable"}).
# : ${DIST:="$(lsb_release --short --codename)"}
: ${DIST:="sid"}
 
# Optionally change Debian release states in $DIST to their names.
case "$DIST" in
    unstable)
        DIST="$UNSTABLE_CODENAME"
        ;;
    testing)
        DIST="$TESTING_CODENAME"
        ;;
    stable)
        DIST="$STABLE_CODENAME"
        ;;
esac
 
# Optionally set the architecture to the host architecture if none set. Note
# that you can set your own default (i.e. ${ARCH:="i386"}).
#: ${ARCH:="$(dpkg --print-architecture)"}
 
NAME="$DIST"
if [ -n "${ARCH}" ]; then
    NAME="$NAME-$ARCH"
    DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}")
fi
 
BASEDIR="$HOME/Software/pbuilder"
BASETGZ="$BASEDIR/$NAME-base.tgz"
DISTRIBUTION="$DIST"
BUILDRESULT="$BASEDIR/$NAME/result/"
APTCACHE="$BASEDIR/$NAME/aptcache/"
BUILDPLACE="$BASEDIR/build-$NAME/"
 
if $(echo ${DEBIAN_SUITES[@]} | grep -q $DIST); then
    # Debian configuration
    MIRRORSITE="http://$DEBIAN_MIRROR/debian/"
    # COMPONENTS="main contrib non-free"
	COMPONENTS="main"
    if $(echo "$STABLE_CODENAME stable" | grep -q $DIST); then
        EXTRAPACKAGES="$EXTRAPACKAGES debian-backports-keyring"
        OTHERMIRROR="$OTHERMIRROR | deb http://www.backports.org/debian $STABLE_BACKPORTS_SUITE $COMPONENTS"
    fi
elif $(echo ${UBUNTU_SUITES[@]} | grep -q $DIST); then
    # Ubuntu configuration
    MIRRORSITE="http://$UBUNTU_MIRROR/ubuntu/"
    # COMPONENTS="main restricted universe multiverse"
	COMPONENTS="main"
else
    echo "Unknown distribution: $DIST"
    exit 1
fi

The “hooks” directory contains a script to run lintian on resulting packages.

B90lintian:

#!/bin/bash
# example file to be used with --hookdir
#
# run lintian on generated deb files
#!/bin/sh
# run lintian
 
echo "I: installing lintian and running it on the package"
apt-get install -y --force-yes lintian &>/dev/null
echo "++++ Lintian output ++++"
lintian --allow-root --color=always -I /tmp/buildd/*.changes | tee /tmp/buildd/lintian
echo "++++ End lintian output ++++"