Automated Build Tests for Multiple Releases

These scripts build on my previous customisation of ~/.pbuilderrc. They provide the package-maintainer with a way to quickly do build tests for multiple release and/or architectures before uploading to the PPA buildd enviroment, thus ensuring package builds will always be successful.


This is designed for local testing during package development. Usage is:

build_test ${RELEASE} ${ARCH}
# e.g:
build_test gutsy i386

build_test intrepid amd64

# build for the current host architecture
build_test gutsy

# build for the release specified in debian/changelog, using the current host architecture

It relies on the mechanism described in Creating Pbuilder Variations to locate the correct pbuilder base image.

The script is run in the root of the package's source directory. It takes 2 optional arguments RELEASE and ARCH. If these don't exist it sets the values based on the current host and the debian/changelog. It enables logging to a standard location (${BASE%/*}/build-logs/), setting the 32-bit kernel personality if needed, checking the pdebuild result and adding FAILED to the log-file name, and when the build is successful grep-ing any "warning" and "error" strings from the log-file to help highlight any build issues.


I also modified my original PPA Publish Multiple Releases script to be able to test-build the same package and one architecture for multiple releases (e.g. gutsy hardy intrepid) in a single automated process. To test for multiple releases and architectures do:

ppa_build_test x86_64 gutsy hardy intrepid
ppa_build_test i386 gutsy hardy intrepid

It relies on the mechanism described in Creating Pbuilder Variations to locate the correct pbuilder base image.

Excluding Source-Code Repository Data (SVN/CVS/git/etc.)

I've added support for excluding the repository files typically present in repository check-outs. For dpkg-source versions v1.14.7 or later this uses the built-in default options of -I. For pre v1.14.7 versions where a file has to be given that contains the exceptions, the option passed is -Idebian/dpkg-source.excludes. You will need to create that file for this option to work. Something like this will be sufficient (debian/dpkg-source.excludes):


The scripts use a suitable form of the -I option for the host and the pbuilder. This means that, for example, building a package on Hardy in a Gutsy pbuilder will pass different options to pdebuild. E.g:

pdebuild --logfile /home/all/pbuilder/build-logs/red5-0.7.1-0ubuntu1~r2968~ppa1g-gutsy-amd64-2008-08-21_22-20-07.log 
 --debbuildopts -I -- --debbuildopts -Idebian/dpkg-source.excludes

Notice the two --debbuildopts, one before the -- separator and one after. The first is used whilst packaging the source in the host environment and the last inside the pbuilder environment.


2009-09-02 build_test and ppa_build_test refreshed from local in-use versions for consistency 2008-09-29 build_test and ppa_build_test, added BUILD_TEST=1 so ~/.pbuilderrc knows when to use the build-test specific code. This ensure other tools that use pbuilder such as prevu (backport tool) don't fail because the build-test code in ~/.pbuilderrc interfers with their configuration.
2008-08-24 build_test Refactored ${DIST}, renamed to ${RELEASE} to maintain consistency with other scripts.
2008-08-23 build_test and ppa_build_test Add support for alternate debian/control for each release. For example, create debian/control.gutsy with alternate Build-Depends. During preparation, if a file is found matching debian/control.${RELEASE}, the existing debian/control will be backed up to /tmp/ and the alternate will replace it. This allows a package-maintainer to keep a single source for building for a range of releases (Edgy, Feisty, Gutsy, Hardy, Intrepid, etc.) and easily deal with changing requirements for building.
2008-08-21 build_test and ppa_build_test Add support for excluding SVN/CVS/GIT/etc repository files from source packages (for dpkg-source versions pre- and post- the v1.14.7 changes to the -I option format). This enables the exclusion option on the host and in the pbuilder to be different, based on the version of dpkg-source installed (Note: in actuality, the script 'guesses' that a Feisty or Gutsy pbuilder environment will not have v1.14.7 or later installed).
2008-08-20 ppa_build_test Fix: use pdebuild --debbuildopts -I to prevent VCS (SVN, CVS, git, etc.) files being included in source tarball
2008-08-20 build_test Fix: use pdebuild --debbuildopts -I to prevent VCS (SVN, CVS, git, etc.) files being included in source tarball