This mini-tutorial is copyright David J. Andruczyk Jan 1st 2012 based uponvarious howto's scattered across the internet with a little personal experienced tossed in.

Goal: To be able to build debian/ubuntu packages for multiple releases without needed a machine for each release.

Tools used: 1. apt-cacher-ng (to save from having to download the same stuff over and over again)2. pbuilder with appropriate configuration and setup (see below)3. Debian or ubuntu machine. This tutorial is based on Ubuntu 10.04 running on an i686 32 bit CPU.

Requirements: 1. Linux machine (64 bit required if you want to make 64 bit packages), this tutorial is based on Ubuntu 10.04, other version/os your mileage will vary.2. Plenty of space under /var/cache. apt-cache-ng will cache every pkg downloaded into /var/cache/apt-cacher-ng, and pbuilder defaults to using /var/cache/pbuilder as it's root.

NOTE: if you want to build 64 bit packages you MUST be on a 64 bit capable machine with a 64 bit OS, otherwise you're restricted to making 32 bit packages only.

First off install the tools:

Code:

apt-get install apt-cacher-ng pbuilder debootstrap quilt

apt-cacher-ng acts like a debian or ubuntu mirror/proxy listening on port 3142. So you can take an /etc/apt/sources entry and change the hostname to "localhost:3142", or setup apt to use a http proxy of http://localhost:3142 and run apt-get update and it should work, when a request for a file comes in, it will serve it from the cache if present, otherwise it'll download and stream it to the client at the same time populating the cache, thus hte next time around it just uses the cache saving lots of time. The cache is intelligent enough to always give you current stuff.

pbuilder is used to make clean pristine chroot's for each distro and architecture target (for 32/64 bit pkgs), and hence it requires some configuration so things go into the right place as well as handling the special case of sequential package creation where a latter package depends on the former package being available within the buildroot to work (case in point the FreeEMS toolchain compiler depends on binutils which isn't available in the normal repository), so some magic needs to happen in order to make the appropriate stuff available in the build root.

# this is your configuration file for pbuilder.# the file in /usr/share/pbuilder/pbuilderrc is the default template.# /etc/pbuilderrc is the one meant for editing.## read pbuilderrc.5 document for notes on specific options.

# command to satisfy build-dependencies; the default is an internal shell# implementation which is relatively slow; there are two alternate# implementations, the "experimental" implementation,# "pbuilder-satisfydepends-experimental", which might be useful to pull# packages from experimental or from repositories with a low APT Pin Priority,# and the "aptitude" implementation, which will resolve build-dependencies and# build-conflicts with aptitude which helps dealing with complex cases but does# not support unsigned APT repositoriesPBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends"

I chose to also have a PER USER ~/.pbuilderrc script which overrides some of the defaults for some specific cases of using pbuilder, I recommend using this as a baseline and adjusting it to your needs as you see fit.

~/.pbuilderrc

Code:

# 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"

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum