Contents
Rules
Naming
These naming guidelines only apply to ruby packages whose main purpose is providing a Ruby library; packages that mainly provide user-level tools that happen to be written in Ruby do not need to follow these naming guidelines.
The name of a ruby extension/library package must be of the form ruby-UPSTREAM. If the upstream name "UPSTREAM" contains "ruby", that should be dropped from the name. For example, the SQLite database driver for ruby is called "sqlite3-ruby", the corresponding package should be called ruby-sqlite3, and not ruby-sqlite3-ruby.
Macros
The following macros are defined in /etc/rpm/macros.d/ruby.macros which is provided by ruby rpm, and use ruby themselves, so you always need to BuildRequire at least ruby.
%ruby_archdir %(ruby -rrbconfig -e 'print RbConfig::CONFIG["archdir"]') %ruby_libdir %(ruby -rrbconfig -e 'print RbConfig::CONFIG["rubylibdir"]') %ruby_sitearchdir %(ruby -rrbconfig -e 'print RbConfig::CONFIG["sitearchdir"]') %ruby_sitelibdir %(ruby -rrbconfig -e 'print RbConfig::CONFIG["sitelibdir"]') %ruby_vendorarchdir %(ruby -rrbconfig -e 'print RbConfig::CONFIG["vendorarchdir"]') %ruby_vendorlibdir %(ruby -rrbconfig -e 'print RbConfig::CONFIG["vendorlibdir"]') %ruby_gemdir %(ruby -rrbconfig -e 'print RbConfig::CONFIG["rubygemsdir"]') %ruby_ridir %(ruby -rrbconfig -e 'print RbConfig::CONFIG["ridir"]') %gem_build %gem_install
Tags
Group should be Development/Ruby
BuildArch must be noarch for pure ruby packages. If doc are splitted out as single package, the doc package should be set as noarch also.
BuildRequires
In the case of gems, packages should require rubygems.
Arch dependant packages should require (at least) ruby-devel.
Requires
Packages should require ruby(abi) = VERSION. It should be automatically added during build.
Gems must require rubygems (should be automatically added during build, you don’t have to add it yourself)
Gems shouldn’t have other explicit requires as it is already added from the gemspec file.
Provides
Packages shouldn’t have explicit provides, as it is automatically added in rpmbuild itself.
%prep
Should only contain %setup -q. Though, due to a bug, the data part of the gem does not get extracted automatically. You may need to add tar xmf data.tar.gz otherwise your build will fail
%build
You are encouraged to use the ruby macro %gem_build to build the package.
%install
You are encouraged to use the ruby macro %gem_install
%check
This section is not mandatory, because ruby modules often have circular dependencies that make it impossible to run the %check for every module out there. Though, whenever you can, you are encouraged to add this section. Otherwise, you can do a -devel subpackage that will allow to run the tests once the module is installed and the dependencies resolved (requires a change in gem_helper.rb at the moment)
Samples
%define oname rspec-core Name: ruby-%{oname} Version: 2.0.1 Release: %mkrel 1 Summary: rspec-core-2.0.1 Group: Development/Ruby License: GPLv2+ or Ruby License URL: http://github.com/rspec/rspec-core Source0: http://rubygems.org/downloads/%{oname}-%{version}.gem BuildRequires: rubygems BuildArch: noarch %description RSpec runner and example groups %files %dir %{gem_instdir} %{gem_instdir}/lib #------------------------------------------------------------------------------- %package doc Summary: Documentation for %{name} Group: Development/Ruby Requires: %{name} = %{version}-%{release} %description doc Documents, Rdoc & RI documentation for %{name}. %files doc %doc %{gem_docdir} #------------------------------------------------------------------------------- %prep %setup -q tar xmf data.tar.gz %build %gem_build %install %gem_install
You can also use gem2rpm from ruby-gem2rpm package to generate a spec file.
Policy in other distributions
Missing packages
This might not be the best place but is here to list missing packages in Mageia that could be included :
- shapado
- mongo_mapper -> can be used by ruby-database_cleaner
- webrat -> needed for ruby-cucumber’s test-suite
- ramaze -> same as above
- spork -> same as above
- prawn -> same as above
- capybara >= 0.4.1 -> same as above -> conflict with teambox’s requires