Note: This web site is only kept up to date for OSG Software 1.2 (VDT 2.0.0). If you are looking for information for the most recent release, the RPM-based OSG Software 3.0, please see the OSG documentation web site

Debian pbuilder Notes

Initial Setup

Every pbuilder operation works on a “base” — a pre-built, minimal Debian installation. When not actively running, pbuilder stores the base as a .tgz file, usually in /var/cache/pbuilder. Before configuring or building in pbuilder, the initial base must be created.

If the underlying machine supports it, pbuilder permits building on alternate architectures, such as x86 on x86-64, and alternate OS releases, such as etch on lenny. To do this, a separate base is created for each particular architecture and/or OS release combination.

Once created, the pbuilder base must be configured to work in our environment. Currently, we make two significant changes: One to support automated installation of Sun Java software, and one to add the VDT Debian signing key.

Create an Initial Base Install

Only one command is needed to create a pbuilder base, but the command can be long and complicated. To document the command, and to enable its modification and reuse, save the command in a simple shell script.

Set up Sun Java License Agreement

The Java packages are non-free (as in speech) and annoying: They require the user to accept the license agreement. However, it is possible to pre-answer the license agreement question, but the one-time setup to do so is non-obvious. The instructions below refer to a pbuilder hooks directory, which can be anywhere but is typically “$HOME/.pbuilder-hooks”.

  1. Create a directory to hold the hook file:
    mkdir PBUILDER_HOOKS_DIR
  2. Configure pbuilder to use the hooks directory:

    In $HOME/.pbuilderrc:

    HOOKDIR=PBUILDER_HOOKS_DIR
  3. Add a hook to accept Sun Java license agreement questions:

    In $PBUILDER_HOOKS_DIR/D50sun-java-licenses:

    #!/bin/sh
    
    debconf-set-selections <<EOF
    sun-java5-bin shared/accepted-sun-dlj-v1-1 boolean true
    sun-java5-jre shared/accepted-sun-dlj-v1-1 boolean true
    sun-java5-jdk shared/accepted-sun-dlj-v1-1 boolean true
    sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true
    sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true
    sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true
    EOF
  4. Make sure the hook script is executable:
    chmod 0755 $PBUILDER_HOOKS_DIR/D50sun-java-licenses

Add VDT Public Signing Key

The VDT APT repository is signed using a GPG key. Technically, pbuilder will work without adding the VDT’s signing key to APT, but adding the key eliminates some warning messages in pbuilder’s already verbose build output.

  1. Get a copy of the public signing key text:
    cat /home/cat/debian-signing/debian-public.gpg
  2. Log into the pbuilder base environment:
    sudo pbuilder --login --save-after-login

    Or, for an alternate base:

    sudo pbuilder --login --save-after-login --basetgz /var/cache/pbuilder/base-i386.tgz
  3. Add the key:
    cat | apt-key add -

    Paste in the key text and press Ctrl-D.

  4. Exit the pbuilder environment to save the APT key change
    logout

Routine Use

Update the Base Packages

Before building a package in pbuilder, it is best to update the base installation’s Debian packages.

Build a Package

Using a RAM Disk for Speed

Henning Fehrmann (LIGO, Hannover) suggested using a RAM disk for intermediate files to speed the overall build process. I do not have complete notes on how to do so, but here are a few pointers.

Command for setting up a RAM disk:

  mount --types tmpfs --options size=1g ramdisk /mnt/build

Then, the idea is to set key directories to use the RAM disk instead of spinning disk.