PBuilder setup

To actually build our packages, we use PBuilder, which build binary packages from source packages in a minimal chroot environment. With multiple chroot environments, we are capable of building for multiple versions of multiple distributions, and even multiple architectures, all on a single machine.

Procedure 2.2.  Setting up PBuilder/COWBuilder

  1. A ~/.pbuilderrc for multiple distributions

    Put the following in ~/.pbuilderrc

    # This is to enable building packages for multiple distributions
    # Note: it doesn't work for cowbuilder.
    #       to get cowbuilder to work, use a wrapper that sets environment variables
    #       like DISTRIBUTION and MIRRORSITE before it starts cowbuilder, because they
    #       never get to cowbuilder if they are only set from within pbuilder, as is
    #       the case when they are set in this file
    
    #Setting PDEBUILD to 'cowbuilder' has no effect, although the manpage of pbuilderrc says it should
    #PDEBUILD_PBUILDER=pbuilder
    #PDEBUILD_PBUILDER=cowbuilder
    
    if [ -n "${DIST}" ]; then
        echo ".pbuilderrc detects DIST ${DIST}, while DISTRIBUTION is ${DISTRIBUTION}"
        DISTRIBUTION=$DIST
        case ${DIST} in
            'lenny'|'squeeze'|'wheezy'|'sid' )
                MIRRORSITE=http://osmirror.rug.nl/debian
                echo "set MIRRORSITE to ${MIRRORSITE}"
                ;;
            'lucid'|'maverick'|'natty'|'oneiric'|'precise' )
                MIRRORSITE=http://osmirror.rug.nl/ubuntu
                echo "set MIRRORSITE to ${MIRRORSITE}"
                ;;
        esac
        BASETGZ="$(dirname $BASETGZ)/$DIST-base.tgz"
        BUILDRESULT="/var/cache/pbuilder/$DIST/result/"
        APTCACHE="/var/cache/pbuilder/$DIST/aptcache/"
    fi
    
    	    

    Yes, the BASEPATH is for cowbuilder. And no, we 're not using cowbuilder here.

  2. Creating PBuilder tarballs

    1. For Ubuntu


        
      jurjen@cit-zb-3-53:~$ sudo -s
      root@cit-zb-3-53:~# for D in lucid maverick natty oneiric precise ; do DIST=${D} pbuilder --create --debootstrap debootstrap --debootstrapopts --keyring=/etc/apt/trusted.gpg || break ; done
        

    2. For Debian


        
      root@cit-zb-3-53:~# for D in lenny squeeze wheezy sid ; do DIST=${D} pbuilder --create --debootstrap debootstrap --debootstrapopts --keyring=/usr/share/keyrings/debian-archive-keyring.gpg || break ; done
        

      [Note]Note

      On Ubuntu, one also needs:

      sudo DIST=precise pbuilder --update --components "main restricted universe multiverse" --override-config

      lest pdebuild start complaining about packages being virtual that are not virtual at all. That's just an indication that it cannot find said packages.