March 17, 2009

Easy packaging of ruby gems for openSUSE

Every distribution has its own conventions to package scripting languages addons (perl modules, ruby gems, etc) as native packages. This allows packages to depend on those addons honoring the package dependencies, and at the same time, look like the addon was installed the scripting language tool (cpan, gem).

openSUSE keeps a repository of gems, thanks to Marcus Rueckert.

For ruby, David Lutterkort (augeas lead developer) created a nice tool to help converting gems into spec files.

I created a template for openSUSE-like rubygem-* packages, and David committed it upstream.

So, to create a package for a gem:

Fetch it:

gem fetch foo

Convert it:

gem2rpm -t opensuse.spec.template ./foo-1.1.gem > rubygem-foo.spec

Build and tweak it. Make sure everything is alright. Some gems work out of the box, some not, but still gem2rpm saves 90% of the effort. Consider submitting it to the project if you are willing to keep it up to date ;-)

Comments (4)

  1. March 19, 2009

    [...] in my last post, I wrote how to easily package gems for openSUSE, saving at least 99% of the work. However, how do you know that you need to package a new gem? [...]

  2. March 23, 2009
    darix said...

    the template is sadly not correct. fixing packages

  3. April 7, 2009
    darix said...

    the fixed template is now in svn. and we also got a rubygem-gem2rpm in the devel:languages:ruby:extensions project now.

    in the meanwhile i have created some new specs with it. =)

    though for upgrading i still manually edit the spec.

  4. December 17, 2009
    Pavol Rusnak said...

    I just found out that package gem2rpm contains a script called gem2rpm-opensuse which calls gem2rpm with correct parameters so it is no longer needed to specify the parameters manually.

Leave a Reply