Most of the packaging work can be simplified using the Ruby Package Tools. The tools are contained in the ruby-pkg-tools package, available in Debian. It contains the following:

The Team Member List

A list of team members of the Debian Ruby Extras Maintainers is kept in /usr/share/ruby-pkg-tools/ If you have joined the team, this file must be updated. Please refer to ?Joining the Team for more information about updating this file. The list is mostly used by the uploaders rule.

N.B: Double check that you haven’t forgotten a comma when adding yourself!

The CDBS Classes

The tools includes two CDBS classes, and, for automating the building of a package for upstream source that uses install.rb, setup.rb or extconf.rb as builder/installer. The classes try to create a package that adheres to the Debian/Ruby policy (draft version) and takes a lot of common standard and often the same work out of your hands.

Basic usage

A common debian/rules file for setup.rb using this ruby-setup-rb class would look like this:

# CDBS file to build the Foo Ruby package.

include /usr/share/cdbs/1/rules/
include /usr/share/ruby-pkg-tools/1/class/

libbreakpoint-ruby is an example of a setup.rb based Debian package.

For extconf.rb it would look like this:

# CDBS file to build the Foo Ruby package.

include /usr/share/cdbs/1/rules/
include /usr/share/ruby-pkg-tools/1/class/

You can have a look at libgpgme-ruby to see how an extconf.rb based package can be built.

Note that it is still possible to configure and override the behaviour of the class and debhelper. No control is lost. For more information about how to use the class, see the CDBS HOWTO.

N.B. When using either of these classes, don’t forget to add

The Uploaders Rule

Some time ago, we used to write the name of all the members of the team in the Uploaders control field. This has been argued against here. Please, do not use anymore. Uploaders should only be people who made significant changes to the package.

Retrieving Upstream Sources

Since after much discussion it was decided not to put all the upstream sources of every package into the Subversion repository, a tool was added to this package to help retrieving it. This tool, pkg-ruby-get-sources is described below; it can use either the pkg-ruby-extras.sources information file or (preferably) the package’s debian/watch file.

Basic usage

A basic usage scenario for pkg-ruby-get-sources is to do a checkout, get the upstream source and build:

$ cd Debian/packages
$ svn co svn+ssh://
$ cd libfoo-ruby/trunk
$ mkdir ../tarballs
$ pkg-ruby-get-sources
[100%] http://somesite/path/to/foo-ruby-0.1.tar.gz
$ ls ../tarballs
$ svn-buildpackage [...]

Note that pkg-ruby-get-sources retrieves the tarball and takes care of the naming of the file locally so that it suits the Debian source package name. For example see above where foo-ruby-0.1.tar.gz is automatically renamed to libfoo-ruby_0.1.orig.tar.gz.

Where does it find upstream sources?

There are two ways to find the upstream sources:

debian/watch files

This is by far the best way to do, as other tools from debian also use the information stored in this file (see for instance QA pages for developers).

The principle is simple: if the software you package provides a web page with a link to source tarballs, all you need to do is provide the location of this page along with a regular expression matching the link to the tarball. For a standard Rubyforge package, the watchfile would look like

version=3 .*tioga-([\d.-]*)\.t.*

To check the contents of this file, run

$ uscan --report

Look at the uscan manual page for more information.

Registering sources using the pkg-ruby-extras.sources file

Retrieve from Subversion:

and edit it. This file follows the YAML format.

  "0.1": http://somesite/path/to/foo-ruby-0.1.tar.gz</pre>

  "0.2": http://somesite/path/to/foo-ruby-0.2.tar.gz

Other features

pkg-ruby-get-sources allows for selecting different sources files (--sources) instead of using the one that comes with ruby-pkg-tools by default, so you can use your own. It also can list all available sources (--list-available) or download to a different target directory (--target-directory).