It's a piece of cake to create a gemfile RPM package using the gem2rpm tool, but Fedora Package Guidelines for Ruby compliance is not that straightforward. Let me explain basic issues a packager will be facing to.

The fist part is a duck soup. Really. Set the gem2rpm against downloaded gem file. Most likely you'll need to redirect it's standard output to a file. That's your starting point spec file. So far, so good, isn't it?

Now the fun starts.

  • Define sitelib and sitearch macros. Example.
  • Use %global instead of %define for all the others. Example.
  • Add ruby(abi) requirement. Example.
  • The gem2rpm tool starts with Requires only. If the gem has any build requirements you will need to convert them. The best place to find build requirements is the gem homepage. Example.
  • Both %prep and %build sections should all be gone. Example.
  • The tool doesn't use macro in the files section. You can. Example.
  • Both build root and clean sections are not necessarry for modern Fedoras. Wipe them out not blinking your eye. Example.
  • You can cleanup the spec file at last. Example.
  • Checkout the upstream license as the gem2rpm puts "GPLv2 or Ruby" constrant there.

This is not an universal blueprint. It only works for gems without native libraries or special artifacts. It has been prepared with Fedora 14 guidelines. Please note the guidelines can change in the future.

That's all folks!