Debian Med Group Policy

Andreas Tille

First review  

David Paleino

Initial writing  

Charles Plessy

Contributions in 2008 

$ policy.xml rev. @REV@ - @DATE@ (@AUTHOR@) $


Table of Contents

Introduction
How to Contribute
Membership
Essential readings
Repositories
Give me the source!
Repository structure
Migration of a source package from Subversion to Git.
Packaging
Announcing intent to package
Tasks
Policy
debian/control
debian/copyright
debian/changelog
debian/README.source
Debhelper
CDBS
Injecting a new package
Handling patches

Introduction

Debian Med is a “Debian Pure Blend” with the aim to develop Debian into an operating system that is particularly well fit for the requirements for medical practice and research.

The Debian Med project presents packages that are associated with medicine, pre-clinical research, and life sciences. Its developments are mostly focused on three areas for the moment: medical practice, imaging and bioinformatics.

Over the previous years, several initiatives have spawned that address the scientific disciplines like chemistry or bioinformatics. Debian Med is not a competition to these efforts but a platform to present the packages to the community as a Debian Pure Blend.

How to Contribute

From the developer to the user, there is a long chain of tasks in which we always welcome participation. First we must keep ourselves informed about the software landscape in biology and medicine. Software to be packaged is chosen according to criteria such as users' need and the consistency of the distribution.

Once in Debian, the software is monitored for its quality and bugs are fixed, if possible in collaboration with the upstream maintainer(s). All this work would not be very useful if it remains confidential.

We also dedicate some time to advertise it to the world via www.debian.org and to ease the integration of new members.

Please contact us on debian-med@lists.debian.org if you want to help to make medical and biological software available to Debian users. Read the Membership section if you're interested in joining us.

If you speak a language other than English, you can contribute rightaway with translations of package descriptions at ddtp.debian.org.

When working on these, you will find immediate targets for improvements of the original English versions, too. For these, though, you need access to Debian Med's source code repository. Very welcome are tutorials that guide Debian users towards the use of packages to their immediate benefit. You may also consider to write respective articles for Magazines, be they online or in print.

Membership

To request membership to this group, please go on our Alioth page, or directly follow this link. Remember that you must have an Alioth account before requesting membership (see here to request an Alioth account).

Essential readings

Repositories

We use Subversion (SVN) and Git repositories, hosted on Alioth, the hosting facility provided by Debian to free software developers. You can have a look at each repository through Alioth's web interfaces: wsvn viewsvn and gitweb.

The Subversion repository is the primary location for our source packages. However, the Git repository is free to use for special cases, for instance when the Subversion tags take a disproportionated size, when the maintainer is much more comfortable with Git than Subversion, when some special features of Git or git-buildpackage are desired, or more simply when the maintainer wants to thake the opportunity to familiarise with Git.

Give me the source!

To check sources out from our repostitories, please do:

  • If you are a member of Debian Med or a Debian developper, you have write permission:

    svn co svn+ssh://user@alioth.debian.org/svn/debian-med/trunk/...

    respectively

    git clone git+ssh://user@alioth.debian.org/git/debian-med/<package>.git

    You can avoid specifying your Alioth user name by setting it in ~/.ssh/config:

    Host *.debian.org
    	User yourusername
    							
  • For read-only access, the syntax is slightly different:

    svn co svn://svn.debian.org/svn/debian-med/trunk/... git clone git://git.debian.org/git/debian-med/<package>.git

Another way to check the sources is through the use of the debcheckout command, from the devscripts package.

Repository structure

The SVN repository is structured as follows:


      
debian-med/
 └ trunk/
    ├ community/
    │  ├ debtags/
    │  ├ infrastructure/
    │  └ website/
    └ packages/
       ├ <package A>/
       │  ├ branches/
       │  ├ tags/
       │  └ trunk/
       │     └ debian/
       ├ <package B>/
       │  ├ branches/
       │  ├ tags/
       │  └ trunk/
       │     └ debian/
       …       
       

       

Note

We are currently considering an alternative layout in which all the trunk, tags and branches directories are grouped together, so that developpers can checkout trunks without tags.

The Git repository is not structured: each package is in its own Git repository. But all of them are under the same debian-med directory.

Migration of a source package from Subversion to Git.

There is no easy way to prepare a Git repository from our Subversion repository that would look like the package was always managed in Git, because we use svn-buildpackage with the mergeWithUpstream property set, which excludes the upstream sources. Nevertheless, the following receipe will genearate a Git repostitory that contains all the history of the debian directory, plus a collection of selected upstream source releases.

  • Start the conversion as explained in the Alioth/Git page of the Debian wiki. To be consistent with a later usage of git-buildpackage, it is preferable to prefix the tag names “debian”. During this conversion, you can take advantage of the file /trunk/community/infrastructure/comitters in the Subversion repository, and expand it if necessary.

  • Import of the upstream original tarballs that you find relevant, for instance the ones that were part of a stable release). When this paragraph was written, it was necessary to follow special instruction detailed in bug 471560.

  • Upload to alioth.debian.org/git/debian-med and set up the hooks and other meta-data as explained in the Alioth/Git page of the Debian wiki.

Packaging

Announcing intent to package

If you intent to work on a Debian package you should follow the normal Debian rules and file a WNPP bug report.

It is a good idea to keep the Debian Med mailing list debian-med@lists.debian.org in CC and to set it as the owner of the ITP to keep your co-workers informed. This will ensure that we notice if for some reason the package has not been uploaded.

In addition, please add the package to the “task” file where it fits the best, and document your ITP number using the WNPP field name.

Tasks

The Debian Med Debian Pure Blend is organised by tasks, that group packages around broad themes such as medical imaging for instance. The tasks list programs that are already packaged in Debian as well as packages in preparation.

The tasks files are not hosted in the Debian Med repositories, but in the Debian Blends repository. Nevertheless, all members of the Debian Med project on the Alioth forge have write access to the Blends subversion repository. You can easily check out its sources with the command debcheckout -a debian-med.

The syntax of the tasks files is very similar to Debian control files, and described in the Debian Blends website.

Policy

debian/control

  1. Section. Should be “science” for the source package.

  2. Priority. Should be “optional” unless forbidden by the Debian policy (see section 2.5). Packages of priority “extra” are excluded from some QA tests.

  3. Maintainer. Maintainer should be Debian Med Packaging Team . Please subscribe to this list if you list yourself in the Uploaders: field of one of Debian Med's packages. You can refer to the QA page corresponding to this email to gather information about the packages.

  4. Upload by Debian Maintainers. Should be enabled with the field DM-Upload-Allowed: yes. This means that when an Uploader becomes Debian Maintainer, he will immediately get the possibility to upload the package to Debian. Please consider this when you sponsor packages in which some Uploaders are added.

  5. Uploaders. Please add yourelf as an uploader when you have a significant interest in a package. Being Uploader means that you are expected to answer to the bug reports. It is totally acceptable to do some QA work on a package without adding oneself to the Uploaders field.

  6. Standards-Version. Please always use the latest unless there are concerns for backporting. If no changes are needed, please indicate this fact in the changelog, and increment the value of the field.

  7. Homepage. should be documented whenever possible

  8. Vcs-Svn: and Vcs-Browser: Please use the following templates:

    Vcs-Svn: svn://svn.debian.org/svn/debian-med/trunk/packages/<package>/trunk/
    Vcs-Browser: http://svn.debian.org/wsvn/debian-med/trunk/packages/<package>/trunk/?rev=0&sc=0
    					

    or

    Vcs-Git: git://git.debian.org/git/debian-med/<package>.git
    Vcs-Browser: http://git.debian.org/?p=debian-med/<package>.git
    					

debian/copyright

We use the proposed machine-readable format for the debian/copyright file. Please list yourself in the Files: debian/* section if you think that your contributions are not trivial and therefore subjected to copyright. Please chose a license that is compatible with the program you package. You can also use “same as if it were in the public domain” or “same as the packaged program itself”.

debian/changelog

Packages hosted in our Subversion repository, that have been modified but not uploaded must use UNRELEASED as a distribution name. This can be done automatically by declaring DEBCHANGE_RELEASE_HEURISTIC=changelog in ~/.devscripts and using dch.

debian/README.source

This file is recommended by the Policy (§ 4.14) from version 3.8.0 for documenting source package handling. Please follow the recommendation. For instance, this file is needed when we use a patch system, when the upstream sources are in another format than gzipped tar achive, when we repack the sources,…

Debhelper

Debhelper uses compatibility levels to control the behaviour of its commands. The latest level is not always available in Stable or Backports. Please avoid using it unless needed until it is available, to facilitate backporting. We currently recommend to use the level 5.

CDBS

The use of CDBS is welcome as it helps us to factorise our code. Nevertheless, please do not use complex CDBS for non-trivial packages, so that other developpers can quickly understand the package when doing QA work.

It is technically possible to build CDBS packages using Debhelper without the debian/compat file. Please do not, and always include such a file according to the above guidelines.

Injecting a new package

Subversion

To inject a new package to the SVN repository, you must have write access to it; i.e. you must be a member of the debian-med group on Alioth.

You can inject a new package only after successfully building it with dpkg-buildpackage (or any wrapper around it). We use the MergeWithUpstream workflow, so please keep all the modifications in the debian directory, and use the -o of svn-buildpackage, as in the following example:

svn-inject -o package.dsc svn+ssh://user@alioth.debian.org/svn/debian-med/trunk/packages/

The svn-inject command is found in the svn-buildpackage package (just apt-get it).

Once you injected a new package please make sure that it is mentioned in the apropriate tasks file in the package source of the debian-med Blend package in SVN. Normally maintainer watch the changes in the Debian Med packaging pool but it helps if the maintainer of a certain package verifies that everything is in the right place.

Git

Creating a local repository

Just a few instructions to get you started:

mkdir package

cd package

git init

git import-orig /path/to/package_version.orig.tar.gz

dh_make -p package_x.y.z

The above steps will create a repository with the appropriate layout for git-buildpackage, with three branches: master (where the Debian development will happen), pristine-tar, used by the pristine-tar tool during the package build process to recreate the original tarball, and upstream, which will contain the upstream source.

To display your name and more nicely in the Git log, you should instruct Git to do so (the --global option is to say Git these are the default parameters for every Git repository you commit to, without it the settings will be per-repository only):

git config [--global] user.name "$DEBFULLNAME"

git config [--global] user.email "$DEBEMAIL"

After you create your debian/ (be sure to commit it!), you should add a “remote” to the repository. A remote is where the commits will be pushed to, and the default remote is called “origin”.

If you are going to push to our Alioth repository, please do the following inside your local repository:

git remote add origin git+ssh://alioth.debian.org/git/debian-med/package.git

The next step is to create the remote repository on Alioth.

Creating the remote repository

ssh alioth.debian.org

cd /git/debian-med

./setup-repository packagename "Description of the package"

This will create a packagename.git repository on Alioth, with the proper hooks set up for our team.

Pushing the package

To push the package (make sure you've added the alioth remote!), do the following:

git push origin master

git push --all

git push --tags

For the first push, it's necessary to specify “origin master”. The next time you will push, a git push will suffice. Remember that this will only push the “master” branch (and the other two only if master is somehow related to the new branches), so be sure to also do a run with --all, and one with --tags (if you obviously changed anything in the other branches/tags).

Building the packages

Subversion

To build the package, just use the tools that svn-buildpackage carries. First of all, we suggest you to define some aliases for the most common commands:

alias svn-b='svn-buildpackage -us -uc -rfakeroot --svn-ignore'
alias svn-br='svn-b --svn-dont-purge --svn-reuse'
alias svn-bt='svn-buildpackage --svn-tag -rfakeroot'

Checkout the sources (see the proper section).

Once done, you're ready to do the work. First, cd to the trunk directory, and download the upstream sources (if there is a debian/watch file):

echo "origDir=.." >> .svn/deb-layout && uscan --force-download

Alternatively, you can try this, it depends on how the package was built (again, from the trunk/ directory):

debian/rules get-orig-source

Once done, edit the files you need, and then build the package with svn-b or svn-br.

If you're a Debian Med member, you can commit your changes:

svn commit

(also svn ci).

Otherwise, you can ask to be added to the group (see the Membership section), or send the result of svn diff to the mailing list (gzip -9 it, if it's too large).

Git

You should use git-buildpackage to build the packages with git. Be sure to run it from the “master” branch.

Unfortunately, by default git-buildpackage builds the package without using any chroot (the same as svn-buildpackage), but it's configurable to run it inside a chroot.

You can use this configuration file, ~/.gbp.conf:

[DEFAULT]
builder = ~/bin/git-pbuilder
cleaner = fakeroot debian/rules clean
pristine-tar = True

[git-buildpackage]
# use this for more svn-buildpackage like behaviour:
export-dir = ../build-area/
tarball-dir = ../tarballs/

With this configuration file you're specifying that git-buildpackage will use ~/bin/git-pbuilder as the builder script. This is an example script you can use:

#!/bin/sh
set -e

pdebuild --pbuilder cowbuilder --debbuildopts "-i\.git -I.git $*"
rm ../*_source.changes

This will build the package inside the default cowbuilder chroot, while passing any more parameters directly do dpkg-buildpackage.

Tagging packages

Subversion

It may happen that a package version has been uploaded to Debian repositories, and you forgot to tag the last build with

svn-buildpackage --svn-tag

You can tag this package also retroactively. A first step, creating the tags directory, can be achieved in two ways:

  • create it locally (it is a sibling of trunk/), and commit:

    svn mkdir tags

    svn commit

  • create it remotely:

    svn mkdir svn+ssh://user@svn.debian.org/svn/debian-med/trunk/packages/<package>/tags

After the tags directory has been created, you're ready to tag the package:

svn-buildpackage --svn-tag-only --svn-no-autodch

(--svn-no-autodch avoids debian/changelog to be marked as UNRELEASED).

Git

Tagging a release with git is pretty straightforward:

git tag tagname

The tag names usually follow the scheme “debian/x.y-z”, this will ensure compatibility with other tools as well (like git import-dsc).

You can also easily retroactively make tags:

git checkout <commit hash>

You're now at the point in history when you released the package. Just tag it as you would normally do.

After tagging, be sure to git push --tags, so that other people can benefit from it too.

Handling patches

Often happens that the upstream code doesn't fit well into the Debian distribution: be this wrong paths, missing features, anything that implies editing the source files. When you directly edit upstream's source files, your changes will be put into a .diff.gz file, which should instead contain only debian. To better organise the patches and group the by function, please use a patch handling system which keeps patches under the debian/patches directory.

The most known are quilt, simple-patchsys (from the CDBS package) and dpatch. Please don't use any other patch system in Debian Med, unless absolutely necessary.

Using quilt

Using quilt is rather easy.

First, make sure you have correctly setup quilt: open .quiltrc in your home directory (create it if you don't have one), and make sure it looks like this:

QUILT_DIFF_ARGS="--no-timestamps --no-index"
QUILT_REFRESH_ARGS="--no-timestamps --no-index"
QUILT_PATCH_OPTS="--unified-reject-files"
QUILT_PATCHES="debian/patches"

After this, you're ready to start working with quilt.

Creating a patch

To create a patch, use the new command. Run:

quilt new <patch_name>.patch

This will create (if it doesn't exist yet) a debian/patches/series file, which contains all the patches to be applied by quilt. Moreover, the new patch is also the topmost (the currently applied).

Now start editing files, with:

quilt edit <file>

and repeat the process for each file the patch is involved with. At the end, run

quilt refresh

This will compare the noted state of the edited files with the current state, and will produce a patch in debian/patches. Remember: the patch is currently applied (you can check this with quilt applied).

Applying and unapplying patches

Just two easy commands to do the job:

  • quilt pop will unapply the topmost patch.

  • quilt push will apply the next patch in debian/patches/series.

You can just add a "-a" flag to the commands above, to respectively apply/unapply all patches in the series.

Tip

You can check which patches are applied/unapplied with, respectively, quilt applied and quilt unapplied.

Editing patches

To edit a patch, first make it the topmost:

quilt push <patch_name>

If the patch is already applied, but is not the topmost, run quilt pop until it becomes the currently applied one.

You can now run quilt edit on the files you want to change, and, when you're done, quilt refresh.

Renaming patches

Sometimes it's useful to rename a patch. Without any hassle, do:

quilt rename -P <old_name>.patch <new_name>.patch

Other commands

Please see man 1 quilt to have a comprehensive list of commands.

Integration in the build process

Add in the very first part of debian/rules (i.e. before the targets), the line:

include /usr/share/quilt/quilt.make

Please use this to import patch and unpatch rules instead of writing them, and remember to add the needed dependencies to its targets:

...
build: patch build-stamp
build-stamp: configure
...

This kind of dependency will ensure that if you also patch the build system, you get a working patched build process.

Caution

Don't also put configure as a dependency of build (leave it in build-stamp): that may cause problems during parallel buildings (i.e. the -j flag of make).

Now add a dependency to the clean target:

...
clean: unpatch
...

If you've also patched the build system, using upstream's clean target might fail. This is what you should do:

...
clean: clean-patched unpatch
clean-patched:
...

Obviously, you could always use an approach like this, but it's an useless complication if you don't patch the build system, and you should keep debian/rules the simplest you can.

Using dpatch

Creating a patch

dpatch-edit-patch

Applying and unapplying patches

apply(-all), unapply(-all), status

Editing patches

dpatch-edit-patch

Renaming patches

Is this possible?

Other commands

Please see man 1 dpatch for a comprehensive list of commands.

Integration in the build process

Follow the instructions for quilt and adapt the path of inclusion to /usr/share/dpatch/dpatch.make