This page describes the current packaging practices for Ruby in Debian. For more general information, see this wiki page. Some information no longer relevant is moved to Teams/Ruby/Packaging/Archive

Another effort to document the workflow of packaging ruby-gems for Debian is made by the debian-diaspora Team at: this wiki page, which is targeting beginners and very detailed.

Joining the Debian Ruby team

We always welcome people to help us out. If you want to, please follow the following guidelines.

Using Git

We use git together with myrepos (Multiple Repository management tool) to track the git repositories for each package.

Before you continue, ensure you have installed the tools used by the team:

apt-get install myrepos git-buildpackage pristine-tar gem2deb

Git workflow

The following workflow is used for (almost) all non-native packages maintained by the Ruby team:

Obtaining the master repository

git clone git@salsa.debian.org:ruby-team/meta.git ruby-team

To obtain one of the packages, do:

cd ruby-team
./checkout $PACKAGE

If you want to obtain all of the team packages (have in mind that the team has a lot of packages, so this will probably take a little long), do:

# look at .mrconfig
mr --force checkout

To clone all team packages with parallel checkouts, use

mr --force -j 5 checkout

To avoid typing your username and your password see this ?page.

If you don't want to use mr, you can clone individual repos:

gbp clone --pristine-tar git@salsa.debian.org:ruby-team/<pkg-name>.git

Creating a new Git repository and pushing an existing package to salsa.debian.org

Note: please do not leave empty repositories on salsa; only create a repository there just before pushing your package.

Suppose you want to package the latest 0.7 version of the foo Ruby gem, to obtain a ruby-foo package. See the naming conventions for packages.

On your local workstation:

cd ruby-team
./setup-project

Packaging new gems from scratch

Note: See Teams/Ruby/Packaging/gem2deb if you are new to ruby packaging

On your local machine, get a basic .dsc from the library you want to package, using:

gem2deb foo

gem2deb will then try to download the foo gem from rubygems.org, and convert it to a primitive Debian package ruby-foo_0.7-1.dsc. You can also run gem2deb on a local .gem file foo-0.7.gem or a tarball (e.g. from Github).

At this point, please do not make any change to the package generated by gem2deb. It is important to track all the changes in git. Then:

cd where-you-cloned-pkg-ruby-extras.git
./update-mrconfig # will generate the config for your new repo
./checkout ruby-foo # will clone your new repo
cd ruby-foo

gbp import-dsc --pristine-tar path-to/ruby-foo_0.7-1.dsc
git tag -d debian/0.7-1 # because the package is not ready yet
git push --all
git push --tags

Then, make the needed changes to the packaging, and then

git push

After upload, tag the package with

git tag debian/0.7-1

And don't forget to

git push --tags

Known Issues

If mr checkout gives an error like mr: illegal section "[DEFAULT]" in untrusted:

Add .mrconfig path to ~/.mrtrust

If your local username is different from your Alioth username (that's probably the case for non-DD developers with -guest accounts), add the following to your ~/.ssh/config:

Host alioth.debian.org svn.debian.org git.debian.org
User alioth-username

Guidelines for Ruby packaging

gem2deb as the preferred packaging tool for ruby software

gem2deb is the current packaging tool for Debian Ruby packages. It:

It serves two goals:

gem2deb can be considered to some extent as the reference implementation of the Debian Ruby policy. See Teams/Ruby/Packaging/gem2deb for using gem2deb to create new gem packages.

Switching to github tar and other changes to orig-source

see this page

Guidelines for Packaging Ruby on Rails Applications

Multiple gemspec files

You can create debian/gemspec as a symbolic link to the gemspec file you want to use. You can also set DH_RUBY_GEMSPEC variable in debian/rules. For autopkgtest, you should remove the Testsuite field in debian/control and create debian/tests manually.

Example packages: ruby-concurrent, ruby-flipper, ruby-elasticsearch

Handling Rails Engines

There are some special ruby gems that provides a rails engine. Purpose of many of those rails engines are providing ?JavaScript libraries to rails applications. jquery-rails gem is such an example, it provides jquery.js to rails applications through a mechanism called rails assets pipeline. These gems usually have a app/assets or vendor/assets or lib/assets directory. In all cases the js files are embedded in the gem.

See Teams/Ruby/Packaging/RailsEngines for packaging such gems.

Tasks for team-maintained Ruby packages

Updating a package to a newer version

First make sure you got a local repository from salsa which has the pristine-tar branch:

gbp clone --pristine-tar git@salsa.debian.org:ruby-team/<pkg-name>.git

If you have a working debian/watch file (check by running uscan --verbose --report), you can simply import a new version with

gbp import-orig --pristine-tar --uscan

If you want a different version than latest version, you may have to download it manually using a web browser / wget or use uscan --verbose --download-version option and run gbp import-orig --pristine-tar separately.

Alternatively, you can fetch the most recent version of a gem, and make a tarball out of it

gem2tgz <gemname>

where <gemname> is the upstream name of the gem, or run gem2tgz on a local .gem file.

You can also get a specific version and then create the tgz by doing

gem fetch -v <gemname>
gem2tgz <gemname>.gem

Then import the created tarball in the Git repository with gbp import-orig --pristine-tar.

Edit debian/changelog.

Option 1 (gbp dch):

You can use the following command,

gbp dch -a

Verify the version in changelog is updated, if the version is not updated, update it manually (if there is an UNRELEASED entry when running this command, the upstream version won't be updated automatically).

Option 2 (dch):

Or use dch for it, it will give you a template:

dch -v <new-upstream-version>-1

Insert this as the first entry:

  * New upstream Release

Then try to build the package like usual and make corrections and changes which are needed.

Once you are done, change UNRELEASED to unstable (or experimental in case of breaking changes) and push the branches and the tags to the team repository

git push -u --all --follow-tags

Install the package and see if all dependencies are satisfied for rubygems integration by creating a Gemfile for the library and running bundle install --local.

$ echo "gem '<library name>', '<version>'" > Gemfile
$ bundle install --local

See steps of updating rails apps like diaspora, gitlab and redmine

Updating packages with API breaking changes

Read this transitions primer if you are new to handling transitions.

At least https://SemVer.org compliance should be assumed (even though many upstreams don't follow it and breaking changes are introduced in even security updates, for example rack 2.0.7 -> 2.0.8 is not compatible) as a compromise (as assuming every change breaks is not practical). This means major version updates of upstream with public API (when version >= 1.0) and minor updates of upstream without a public API (when version < 1.0). For example ruby-method-source update from 0.8 to 1.0 and pry update from 0.12 to 0.13, both are breaking changes (sometimes we may be lucky and nothing breaks, but we cannot assume that when upstream explicitly gives a warning by appropriate version bumps).

When uploading such API breaking changes these steps must be followed,

  1. Verify autopkgtests of all reverse dependencies and rebuilds of all reverse build dependencies are passing. Use Packaging/ruby-team-meta-build; or upload to experimental and watch the britney pseudo-excuses for experimental

  2. There are two paths you can take for uploading to unstable,
    1. Ideally all breaking packages should be fixed before uploading to unstable. Fixed packages should be uploaded along with the package that introduced API breakage.
    2. Upload to experimental and file bug reports with severity important against all failed packages. It is a good idea to document the list of packages that failed in debian/changelog. Give sufficient time for the maintainers (at least a week for simple fixes or more for complex changes) to fix the broken packages.
  3. When all the broken packages are fixed or the provided time is passed, upload to unstable along with all the fixed packages. Add Breaks for all the packages that failed. The bugs against unfixed packages should be raised to serious.

Exceptions (be careful with minor updates also/minor updates broke API in the past): rails, ruby-rack, ruby-doorkeeper, ruby-devise, ruby-graphql, ruby-grape

Note: Bigger transitions like ruby or rails may need collaboration from the whole team and new versions may be uploaded to unstable and broken packages may be fixed later. Try to coordinate with the team on the mailing list.

Requesting Sponsorship

Once your package is ready (or at least, once you think it is), a DD will have to review your changes and upload it to the archive. It is important to understand that reviewing and sponsoring packages is a tedious process, and that most DDs would prefer to do something else instead. So, make sure that you make the best possible use of their time, so they will be happy to sponsor you again. :-)

First, make sure that your package is really in good shape. That means answering at least the following questions:

Once your package is ready, you must:

Subject: RFS: ruby-foo 1.2-1, ruby-bar 2.0-1

Hi,

The following packages are ready to be uploaded (I also verified the
points listed on http://wiki.debian.org/Teams/Ruby/Packaging#Requesting_Sponsorship).

<Describe the reason behind updating the package.>

Could you please sponsor them?

 ruby-foo 1.2-1
 ruby-bar 2.0-1

Thank you!


PackageManagement CategoryPackaging


CategoryPackaging