Ergo Project has a variety of Ruby repositories available. If we go over them branch by branch, then for Enterprise Linux 5, we have the following repositories available:
Since a stock installation of an Enterprise Linux 5 generation ships ruby 1.8.5, the feature* repositories mentioned here are considered Fast-Tracks, as they override the packages available in the distribution itself. The custom repository however is not supposed to override any packages, but instead add to the Enterprise Linux basic software channels.
To package just one package for these repositories, one may need a little help from the system as well as the build system. For example, maintaining 2 versions of a single spec file just because one repository forces you to use "Requires: ruby(abi) = 1.8" while the other forces you to use "Requires: ruby(abi) = 1.9" is rather inefficient. Instead, we let the buildroot tell the binary package build process what ruby(abi) version the binary package is to require. This way, a package maintainer can use one single version of the spec file across all repositories.
The ruby package provides the /etc/rpm/macros.ruby file. This file contains macros to ease the packaging of ruby libraries and gems.
The contents are, in order:
The %{rubyabi} and %{rubyapi} macros define the version of Ruby. When used in a package .spec file, it looks like:
Requires: ruby(abi) = %{rubyabi}
The package spec is now truly portable between different versions of Ruby (1.8.5, 1.8.6, 1.8.7, 1.9.1, 1.9.2) and no longer requires a certain mainstream Ruby API/ABI to build. However, on the installed system, the package would still require ruby(api) = 1.8.6, for example.
This both prevents the system from using Ruby 1.8.7 module packages such as libraries and gems without also installing a package providing the 1.8.7 API or ABI, as well as prevents unintentional teeny upgrades on a system.
For everything that is local, or not packaged, /usr/local/ is used. /etc/rpm/macros.ruby provides the following shortcuts to these local (site) directories. There's two variants; architecture specific, en architecture independent.
%ruby_sitearch => %{_prefix}/local/%{_lib}/ruby/
%ruby_sitelib => %{_prefix}/local/share/ruby/
These directories though are in /usr/local/ (site specific and not upstream or unmanaged). The directories you should be looking for when packaging ruby extensions or gems, are:
%ruby_vendorarch => %{_libdir}/ruby/
%ruby_vendorlib => %{_datadir}/ruby/
Compared to former packaging guidelines, here's a list of changes: