dunetna

[debian] [free software] [free knowledge] [sharing]


cowbuilder: Creating a proper image to build a package

Description: When packaging with cowbuilder, each time you want to build, all needed packages have to been configured. This recipe shows how to prepare a cowbuilder base to do all this configurations only once.

Language(s): english

Copy a basic image (or create it with sudo cowbuilder –create):

$ sudo cp -a /var/cache/pbuilder/base.cow /var/cache/pbuilder/base-PKGNAME.cow

Start a session within this image telling cowbuilder that all changes will be saved:

$ sudo cowbuilder --login --basepath /var/cache/pbuilder/base-PKGNAME.cow --save-after-login

Once inside the image, enable package sources:

# sed -i 's/#\(deb-src .*\)/\1/g' /etc/apt/sources.list
# aptitude update

Install build dependencies of the package:

# aptitude build-dep PKGNAME

Logout:

# exit

Now, to use this image for building:

$ sudo cowbuilder --build PKGNAME_VERSION.dsc --basepath /var/cache/pbuilder/PKGNAME.cow

If you use git-buildackage:

$ gbp buildpackage --git-pbuilder --git-dist='PKGNAME'

If you want to use this last command, your image must have the prefix 'base-' (see #721444)