Skip to content

Packaging GEMs

Björn Geuken edited this page Sep 22, 2017 · 24 revisions

Installing gem2rpm

In case that you don't have gem2rpm installed, you can find an up to date version in devel:languages:ruby.

Update an existing package

  1. Branch the package you want to update and check it out via osc.

      osc bco devel:languages:ruby:extensions rubygem-foo
    
  2. Fetch the new gem from rubygems.org. If you want to get the newest version, you can run this command:

      gem2rpm -o rubygem-foo.spec --fetch foo
    
  3. Add the new gem and remove the old one.

      rm foo-OLDVERSION.gem
      osc addremove
    
  4. Try a local build to see if it works

      osc build
    
  5. Update the changelog. The upstream changelog can usually be found in the gem sources ('Source Code' link in rubygems.org).

      osc vc
    
  6. Commit/push the changes to the server

      osc commit
    
  7. Submit the updated package to devel:languages:ruby:extensions.

      osc sr
    

    This can also be done in the webui by clicking the 'Submit package' link.

Creating a new package

  1. Branch an existing package from devel:languages:ruby:extensions to have a branch project with the right setup.

      osc bco devel:languages:ruby:extensions rubygem-aasm
    
  2. Create a new package in your branch project checkout

      cd home:YOU:branches:devel:languages:ruby:extensions
      osc mkpac rubygem-foo
    
  3. Follow the 'Patching an existing package' guide.

  4. Ensure that the license of the GEM allows us to package and distribute the gem. Also make sure the license and all relevant metadata (eg. project url) appear in the spec file.

Editing the spec file through gem2rpm

When working with gem2rpm, all changes of the spec file should be done via the gem2rpm configuration file. Usually this file is named gem2rpm.yml.

When packaging GEMs it might happen that you need to adjust the spec file, eg. to add missing dependencies or update the license. This short guide will show you how to do this.

  1. Make sure there is a gem2rpm configuration file.

    Check the sources of your package. If there isn't a configuration file yet, copy it over:

      cp /usr/share/doc/packages/ruby$VERSION-rubygem-gem2rpm/gem2rpm.yml .
    
  2. Enable the section you want to adjust and edit it.

      :license:
        Apache
  3. Update the spec file.

      gem2rpm foo-1.2.3.gem --config gem2rpm.yml > rubygem-foo.spec
    
Clone this wiki locally