Saturday, January 15, 2011

Setting Up Pbuilder To Act Like Launchpad Build Farm

I build a lot of packages for my Launchpad PPA and I use a number of different systems to do it, so I find myself needing to set up pbuilder environments to test my build procedures pretty often. Unfortunately, documentation for this procedure is often out of date and/or goes into a lot of strange details and edge-cases that are unrelated to me, so I decided to write down my steps for future reference.

Here's what I do:
1. Install pbuilder and some other handy packages
Open up a terminal and type:
sudo aptitude install pbuilder debhelper devscripts build-essential
2. Tell the pbuilder environment that it is going to act just like the Launchpad build farm
Still in our terminal:
sudo pbuilder create --debootstrapopts --variant=buildd
This one takes a while because it's basically installing an entire system inside your existing installation, so grab a cup of coffee and watch the messages fly by.

3. Give it access to all official Ubuntu repositories
By default, your shiny new pbuilder environment won't have access to a lot of packages, so we'll want to add mirrors for common Ubuntu packages, as well as our own PPA to the pbuilder configuration file. So, still in a terminal, type:
nano ~/.pbuilderrc
and paste in:
OTHERMIRROR="deb http://archive.ubuntu.com/ubuntu [YOUR UBUNTU VERSION] main restricted universe multiverse | deb http://archive.ubuntu.com/ubuntu [YOUR UBUNTU VERSION]-backports main restricted universe multiverse | deb http://archive.ubuntu.com/ubuntu [YOUR UBUNTU VERSION]-security main restricted universe multiverse | deb http://archive.ubuntu.com/ubuntu [YOUR UBUNTU VERSION]-updates main restricted universe multiverse"
and we'll also pipe on a section for our PPA, so we can use our own packages as dependencies, which in my case looks like this:
| deb http://ppa.launchpad.net/hunter-kaller/ppa/ubuntu maverick main
4. Make our pbuilder trust packages from our PPA
First, we'll login to our pbuilder environment:
sudo pbuilder --login --save-after-login
Then, we'll give it the public key to our PPA, just like if we were adding it to our own keyring:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys [YOUR PUBLIC KEY HERE]
If all goes well, you can leave your pbuilder environment by typing:
exit
5. Update our environment with these new packages
Still in our terminal, type:
sudo pbuilder --update --override-config
This should get you in pretty good shape. Let me know if you run into any issues.

2 comments:

Unknown said...

Thank you so much! I am new to packaging and was banging my head on adding ppa.

Hunter K. said...

@Unknown
Glad it helped :D

Analytics Tracking Footer