Skip to content

Packaging GEMs

David Kang edited this page Jun 11, 2020 · 24 revisions

In releases <= 2.10 we distribute the OBS gems as individual RPM packages. All packages are located in the OBS:Server:$VERSION:Staging project and are prefixed with rubygem-. Our GEM packages are usually branches from packages in devel:languages:ruby:extensions with a fixed revision.

Bots

We have several bots which help us to keep our dependencies up to date.

Factory auto bot

Coolo runs a bot (factory-auto) every hour that updates the packages and submits them to devel:languages:ruby:extensions. The same bot accepts the submit requests the request 24 hours later, if the build was successful. Of course you can also manually accept the submit request if needed.

Packaging

Sometimes it is still necessary to package manually (e.g. when you add a new dependency which is not yet packaged). This section covers how to do it.

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 and check it out.

      osc branch devel:languages:ruby:extensions rubygem-foo
      osc co home:YOU:branches: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 --fetch foo
    
  3. Add the new gem and remove the old one.

      rm foo-OLDVERSION.gem
      osc addremove
    
  4. Update the spec file.

      gem2rpm foo-1.2.3.gem --config gem2rpm.yml > rubygem-foo.spec
    
  5. Try a local build to see if it works

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

      osc vc
    
  7. Submit the changes to the server

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

      osc submitrequest
    

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

Creating a new package

  1. Setup a project branch of devel:languages:ruby:extensions.

    Each OBS project has it's own project configuration. To build our package against the right project conf, we need to branch from devel:languages:ruby:extensions first. This can be done with any existing package.

      osc branch devel:languages:ruby:extensions rubygem-aasm
    
  2. Create a new package. The name should be rubygem-$gem_name.

      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
    

Upstream packaging guide

Further guides and in-depth information about anything around packaging can be found in the openSUSE WIKI.

Clone this wiki locally