View unanswered posts | View active topics It is currently Tue Aug 11, 2020 11:21 am

This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Using pbuilder to build multiple distribution packages 
Author Message
LQFP112 - Up with the play

Joined: Tue May 01, 2012 4:17 pm
Posts: 211
Location: Shrewsbury PA
So recently I've had the opportunity to learn how to use pbuilder, which is a really powerful tool. Basically it allows you to build for several distributions and architectures, from within a single environment. It uses chroot jails to perform this, and is just plain awesome.

To do this, you need several things. First, follow the instructions here to set up pbuilder: ... cleanroom/

Once you've done that, your application has to have a debian directory, which is outside the scope of this topic. The debian's control file will both allow a .dsc file to be generated, allowing pbuilder to build, and also define what packages are required for building.

The process itself is fairly simple:
$ export ARCH=i386
$ export DIST=precise
$ debuild -S (-us -uc are optional arguments you canuse here, incase you don't want signing)

You will see some text scroll, including a line like this:
dpkg-source: info: building emstudio in emstudio_0.0.1-1.dsc

This is your dsc file. Once debuild has finished, run pbuilder:
$ sudo pbuilder build --buildresult outputdir emstudio_0.0.1-1.dsc
I: using fakeroot in build.
I: Current time: Sun May 26 12:25:39 EDT 2013
I: pbuilder-time-stamp: 1369585539
I: Building the build Environment
I: extracting base tarball [/var/cache/pbuilder/wheezy-i386-base.tgz]
I: creating local configuration
I: copying local configuration
I: mounting /proc filesystem
I: mounting /dev/pts filesystem
I: Mounting /var/cache/pbuilder/ccache
I: Mounting /var/cache/pbuilder/wheezy-i386/result
I: policy-rc.d already exists
W: hookdir /var/cache/pbuilder/wheezy-i386/hooks does not exist, skipping
I: Obtaining the cached apt archive contents
I: Setting up ccache
I: Installing the build-deps
W: no hooks of type D found -- ignoring
 -> Attempting to satisfy build-dependencies
 -> Creating pbuilder-satisfydepends-dummy package
Package: pbuilder-satisfydepends-dummy
Version: 0.invalid.0
Architecture: i386

This will take a while. It activates the jailed environment from pbuilder's stored tar file, downloads the necessarily packages to build your application, then builds it. At the end, your files will all be built in outputdir.

So basically, if you build a pbuilder for every dist/arch you need, then run a script with something like this in it:
$ git clone myrepohere/something.git
$ cd something
$ export ARCH=i386
$ export DIST=wheezy
$ debuild -S -uc -us
$ sudo pbuilder build --buildresult wheezy-i386 something.dsc

$ export ARCH=amd64
$ export DIST=wheezy
$ sudo pbuilder build --buildresult wheezy-amd64 something.dsc

$ export ARCH=i386
$ export DIST=precise
$ sudo pbuilder build --buildresult precise-i386 something.dsc

$ export ARCH=amd64
$ export DIST=precise
$ sudo pbuilder build --buildresult precise-amd64 something.dsc

You will now have 4 output folders, with the 4 built installers!

Interesting Stuff
My Car

Sun May 26, 2013 6:51 pm
Profile WWW
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 0 guests

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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF. ColorizeIt.