Random thoughts shooting out of volatile mind
Tutorial: Packaging Ruby Gem in Debian
Disclaimer: I'm not a ruby programmer I do ruby packaging because I want to help out the pkg-ruby-extras in their transition to new policy in Wheezy

To start with I came to package ruby because we (me and some of my friends) wanted to package Diaspora for Debian but later figured that there is lot needs to be done in the pkg-ruby-extras so thought of helping the team which will intern help in packaging Diaspora.
Before I start here is the new policy for Ruby in Wheezy [1] and here is the current status of ruby packages in Wheezy [2] this is regernerated daily.

New policy uses a tool called gem2deb which makes it very easy to package a gem (of course it only creates skeleton package :)). If you are on testing/unstable you can install the tool by issuing following command
# apt-get install gem2deb
If not you can install it from Github using following commands

git clone git://github.com/ln/gem2deb.git
cd gem2deb
rake install
then, cd to some temporary place, and do:
gem2deb rdiscount # native gem
gem2deb i18n # pure-ruby gem

Once you have installed gem2deb its a 3 step task, follow the following 3 steps to get a rough package source ready of a gem
1. Download the gem using following command
gem fetch polyglot
2. Convert the .gem file to .tar.gz using following command
gem2tgz polyglot-0.3.1.gem
3. Now create a rough Debian package source using following command
dh-make-ruby polyglot-0.3.1.tar.gz
Actually the pkg-ruby-extras team suggests using gem2deb in the second step itself which tries to build the gem along with creating Debian package source for it. But I prefer going this way and build the package once I'm completely finished with packaging related stuffs for the package (i.e editing copyright control changelog and other stuffs). If you think you are lazy to follow the above 3 steps then you should checkout the script which I've written. All you need to do is give the gem name(s) to the script and it does the above 3 steps for you.

Once the above 3 steps and editing task for the package is done go ahead and build the package using pbuilder. Check the resulting package for lintian warnings and errors (You can ignore warning regarding ruby-version field for now there is already a wishlist bug reported against lintian for this). If you are a new maintainer like me go ahead and upload the package to mentors.debian.net and send RFS to debian-ruby at lists dot debian dot org and wait for the review :) (and do promptly follow up to the replies).
Reference for this tutorial is in RubyInWheezy page [1]. After reading this tutorial if you are Debian user and passionate about Debian I hope you will help out pkg-ruby-extras in this transition :)

[1] http://wiki.debian.org/Teams/Ruby/RubyInWheezy
[2] http://pkg-ruby-extras.alioth.debian.org/wheezy/details.html
Posted by: copyninja on Sunday, 15 May 2011

blog comments powered by Disqus
Fork me on GitHub