Difference between revisions of "SAC Debian packaging"

From PDP/Grid Wiki
Jump to navigationJump to search
(working out the right order of sections, from most commonly used to least commonly used)
Line 6: Line 6:
  
 
== Setting up a personal build environment ==
 
== Setting up a personal build environment ==
 +
 +
Before getting anything to work, it is necessary to make several preparations. Luckily, it's just a one-time endeavor.
 +
 +
=== GPG key ===
 +
 +
All Debian packaging tools use GPG signing by default. If you already have a gpg key, you can use that. If not, create one. Preferably using a key length of at least 2048 (although 4096 is common these days).
 +
 +
=== Environment variables ===
 +
 +
Many of the tools source ~/.devscripts for environment variables. Of course they may be put in ~/.profile as well. The following variables are relevant:
 +
* DEBSIGN_KEYID, this should be the identifier of your GPG key. (You can find it by typing gpg --list-secret-keys; e.g. if the output lists 4096R/8AAE244E then 8AAE244E is the key id.)
 +
* DEBEMAIL, your e-mail address. This must match the one in your gpg info.
 +
* DEBFULLNAME, your full name (exactly as listed in the gpg info)
 +
 +
=== Machine environment ===
 +
 +
Development should be done on either a Debian or Ubuntu machine.
  
 
== packaging a new component for the first time ==
 
== packaging a new component for the first time ==

Revision as of 18:00, 4 April 2012

The following procedures extend the SAC software procedures with respect to the creation and distribution of Debian and Ubuntu packages.

packaging a new release of an existing component

releasing packages for multiple distributions

Setting up a personal build environment

Before getting anything to work, it is necessary to make several preparations. Luckily, it's just a one-time endeavor.

GPG key

All Debian packaging tools use GPG signing by default. If you already have a gpg key, you can use that. If not, create one. Preferably using a key length of at least 2048 (although 4096 is common these days).

Environment variables

Many of the tools source ~/.devscripts for environment variables. Of course they may be put in ~/.profile as well. The following variables are relevant:

  • DEBSIGN_KEYID, this should be the identifier of your GPG key. (You can find it by typing gpg --list-secret-keys; e.g. if the output lists 4096R/8AAE244E then 8AAE244E is the key id.)
  • DEBEMAIL, your e-mail address. This must match the one in your gpg info.
  • DEBFULLNAME, your full name (exactly as listed in the gpg info)

Machine environment

Development should be done on either a Debian or Ubuntu machine.

packaging a new component for the first time

system configurations

cowbuilder

reprepro

Anatomy of a Debian source package

This material is provided to help understand how to package for Debian. The most important thing is to familiarize yourself with the available material for Debian maintainers and developers, but as this can be a bit overwhelming, these notes are somewhat tailored to our situation and may help to clarify.

older material

TODO move these to the relevant sections above

Debian packaging requires a debian/ subdirectory in the root of the upstream source directory. The structure of this directory is described in the Debian New Maintainer's Guide. For the SAC middleware, the debian packaging is maintained in SVN. Debian does not prescribe the exact method of creating packages, as is the case with RPM, and several helper libraries have emerged over time. The most notable are debhelper and the newer CDBS. Both should make it a snap to build packages with.


The following steps are required only once for every source packaged to be debianized. All of this could be done manually, but it is a lot of hassle and prone to errors, so better leave it to the automated tools. Should any package decide to radically change it's nature (hopefully this will never happen!) it may be required to repeat these steps.

Required System: Debian/Ubuntu. Required tools: dh_make.

  • Unpack the upstream sources.
  • Run dh_make -r cdbs (and answer some questions).
  • Review the contents of the debian/ subdirectory.
  • Create a subdirectory in SVN under mwsec/packaging/debian/trunk for the new package.
  • add the debian directory to this subdirectory
  • set the svn:MergeWithUpstream property.

(TODO: review and verify this part!)

Setting up pbuilder for building Debian packages

Debian's pbuilder is a system for building packages in a clean environment. It can use chroot or copy-on-write. In order to set it up so it can build for multiple distributions, some enhancements to the configuration need to be applied.

Because pbuilder needs to be run as root, users are allowed to run /usr/sbin/pbuilder through sudo.

The main installation is on ref-debian6-64.testbed.

FIXME: the new machine has things set up slightly differently than before. We're moving to cowbuilder + cowpoke...

To accommodate Ubuntu builds, the ubuntu-archive-keyring package was installed manually from the Ubuntu archives. Otherwise debootstrap will fail.

To build a package, it should suffice to go to the SVN directory mwsec/packaging/debian/trunk/component/ and run:

DIST=stable svn-buildpackage --svn-builder pdebuild --pbuilder cowbuilder

The cowbuilder will use the copy-on-write root in /var/cache/pbuilder/stable-amd64/base.cow. For other distributions just change DIST=stable, e.g. DIST=oneiric for the 11.10 Ubuntu release.

In order to build a i386 build after the amd64 build, select -B to do a binary build only. Passing arguments is a bit tricky:

ARCH=i386 DIST=stable svn-buildpackage --svn-builder pdebuild --pbuilder cowbuilder --debbuildopts "-us -uc -B"

Creating a repository of packages to be downloaded

Debian offers several tools for generating repositories; some are meant for full-size Debian archives and others for simple, private use. For the SAC middleware the reprepro utility offers enough features while at the same time it is easy to install and maintain.

Basically follow the guidelines on how to set up a repository. TODO: link the pbuilder output to this.

Put the build results in the 'incoming' directory. Use this in $HOME/.dput.cf

[mwsec]
method = local
incoming = /var/www/repos/apt/incoming
allow_unsigned_uploads = 1
run_dinstall = 0

And run dput:

dput mwsec /var/cache/pbuilder/stable-amd64/result/lcmaps_1.4.34-1_amd64.changes 

Process the 'incoming' directory (this should be automated sometime):

reprepro -b /var/www/repos/apt/debian processincoming squeeze lcmaps_1.4.34-1_amd64.changes

(First it may be required to set the distribution in the changes file to 'squeeze' with the changestool command).

Sync the local repository to software.nikhef.nl:

rsync -rvP /var/www/repos/apt/debian/ software.nikhef.nl:/project/srv/www/site/software/html/dist/debian/