Copr - Rubygems

28. 05. 2016 | Jakub Kadlčík | en

Recently clime implemented support for building a RPM package directly from PyPI and Mirek performed very cool experiment of building the whole 79k packages on our dev servers. Today we have similar feature, but for the Ruby people. I hope that you are excited.

So what exactly have been done? There is a service called RubyGems.org which hosts community gems. Also there is a tool called gem2rpm for converting Gemfile to .spec or alternatively the whole gem to .src.rpm package. Based on this we have created feature which allows you to submit a Copr build directly from your Gem.

Web interface

As you may expect, the build form is located at Builds > New Build > RubyGems. The only thing that you have to specify is just a gem name. Please see the following screenshot.

Just provide gem name

CLI support

Since copr-cli-1.51 and python-copr-1.69 you can submit a build via command line.

copr-cli buildgem <username>/<project> --gem=<name>

For all the possible options please see copr-cli buildgem --help or manual page man copr.

How it works

When you submit a build, the Copr dist-git service downloads specified gem, builds the .src.rpm file and then the build process continues exactly same as for other methods. So the interesting part is how gem is converted to source package.

Copr runs exactly this command.

gem2rpm --fetch --srpm -C <OUTPUT_DIR> <GEM>

So in case that you want to debug your gem locally, you can use this tool and get the exact result as Copr would. If you want to enhance converting capabilities, you should do it on gem2rpm side.