Differences between revisions 17 and 18
Revision 17 as of 2009-03-16 03:35:22
Size: 3553
Editor: anonymous
Comment: converted to 1.6 markup
Revision 18 as of 2011-05-11 18:13:13
Size: 3439
Comment:
Deletions are marked like this. Additions are marked like this.
Line 29: Line 29:
== Bash and SVN tips == ==== Bash and SVN tips ===
Line 31: Line 31:
Setup your `.bashrc` according to: Setup your `.bashrc` according to: http://upsilon.cc/~zack/blog/posts/2007/09/svn-cowbuilder/
Line 33: Line 33:
http://upsilon.cc/~zack/blog/posts/2007/09/svn-cowbuilder/ ==== Building your package for many distributions at once ====
Line 35: Line 35:
== Building your package for many distributions at once == `cowbuilder` is really handy to build your pet project for many distributions at once. If you have got an `amd64` system, you can easily build a package for `i386` and `amd64` architectures and for say `stable`, `sid` and `lucid`.
Line 37: Line 37:
`cowbuilder` is really handy to build your pet project for many distributions at once. If you have got an `amd64` system, you can easily build a package for `i386` and `amd64` architectures and for say `etch`, `sid` and `gutsy`.
Line 39: Line 38:
The first step involves creating as many basepaths as you need. I chose to put them in `/var/cache/pbuilder/$DIST-$ARCH.cow`. You can use an `apt` cache to reduce the downloads on mirrors, so my mirror is always `http://apt:9999/debian` or `http://apt:9999/ubuntu`.
( you shoud then add {{{--mirror http://apt:9999/debian }}}
Line 41: Line 41:
I use an `apt` cache to reduce the downloads on mirrors, so my mirror is always `http://apt:9999/debian` or `http://apt:9999/ubuntu`.

I adapted a `~/.pbuilderrc` file to this purpose. I stole it from the [[https://wiki.ubuntu.com/PbuilderHowto|Ubuntu pbuilder howto]].
  * The first step involves creating as many basepaths as you need. I chose to put them in `/var/cache/pbuilder/$DIST-$ARCH/base.cow`.
Line 46: Line 43:
if [ -n "${DIST}" ]; then
    DISTRIBUTION="$DIST"
    BUILDRESULT="/var/cache/pbuilder/result/$DIST/"
    if [ "$DIST" == "gutsy" ]; then
        echo "Adding universe"
        COMPONENTS="main universe"
    fi
fi
APTCACHE=""
sudo mkdir /var/cache/pbuilder/squezze-i386
Line 56: Line 45:
  * Then create a `~/.pbuilderrc` file to this purpose. You can use the example of the [[https://wiki.ubuntu.com/PbuilderHowto|Ubuntu pbuilder howto]].
Line 59: Line 49:
$ DIST=etch sudo cowbuilder --create --basepath /var/cache/pbuilder/etch-amd64.cow --mirror http://apt:9999/debian DIST=squeeze sudo cowbuilder --create --basepath /var/cache/pbuilder/squeeze-amd64/base.cow

cowbuilder

This is the tutorial for cowbuilder. See also qemubuilder.

Usage

Initialization

Create the base image:

sudo cowbuilder --create

And a new and shiny build image is created in /var/cache/pbuilder/base.cow/

Every day usage

Update the base image

sudo cowbuilder --update

Build a package:

sudo cowbuilder --build somepackage.dsc

Tips

==== Bash and SVN tips ===

Setup your .bashrc according to: http://upsilon.cc/~zack/blog/posts/2007/09/svn-cowbuilder/

Building your package for many distributions at once

cowbuilder is really handy to build your pet project for many distributions at once. If you have got an amd64 system, you can easily build a package for i386 and amd64 architectures and for say stable, sid and lucid.

You can use an apt cache to reduce the downloads on mirrors, so my mirror is always http://apt:9999/debian or http://apt:9999/ubuntu. ( you shoud then add --mirror http://apt:9999/debian 

  • The first step involves creating as many basepaths as you need. I chose to put them in /var/cache/pbuilder/$DIST-$ARCH/base.cow.

sudo mkdir  /var/cache/pbuilder/squezze-i386

Creating a base path :

DIST=squeeze sudo cowbuilder --create --basepath /var/cache/pbuilder/squeeze-amd64/base.cow 

Creating an ubuntu base path which is trickier because one must :

  • import ubuntu signing keys
  • use a backport of the latest cdebootstrap if you use etch and install pbuilder > 0.174

  • exclude packages of priority important in /usr/share/cdebootstrap/generic-ubuntu/packages

  • add universe to complete creation of chroot because the cowdancer package is in universe.

<!> Some steps left to describe here.

$ DIST=gutsy sudo cowbuilder --create --distribution gutsy --components "main universe" --basepath /var/cache/pbuilder/gutsy-amd64.cow --mirror http://apt:9999/ubuntu --debootstrapopts --exclude=udev,pcmciautils,initramfs-tools

Building i386 base paths may be achieved by appending those options to the cowbuilder --create command line.

--debootstrapopts --arch --debootstrapopts i386

Once everything is set up, I use this script in a debian source package directory to build it for every distribution.

set -e

RESULTDIR=$1
[ -d $RESULTDIR ] || mkdir $RESULTDIR

DISTLIST=$(ls -d /var/cache/pbuilder/*.cow)

for chrootdir in $DISTLIST
do
    sudo cowbuilder --update --basepath $chrootdir
    DIST=$(basename $chrootdir | cut -d'-' -f1)
    [ -d $RESULTDIR/$DIST ] || mkdir $RESULTDIR/$DIST
    DIST=$DIST pdebuild --pbuilder cowbuilder\
                        --buildresult $RESULTDIR/$DIST\
                        -- --basepath $chrootdir
done

Troubleshooting

Slow copying and removing of the COW directory

What cowbuilder does is:

cp -al /var/cache/pbuilder/base.cow /tmp/new
rm -rf /tmp/new

Of course cowbuilder uses a different location than /tmp/new. You need to optimize those 2 commands on your computer. They should take around 0.2s each. If not, try to use the ext3 filesystem, for more details, see our benchmarks.