[Rubygems-developers] gem2rpm script

Marcus Rueckert darix at web.de
Mon Jul 3 15:49:09 EDT 2006

On 2006-07-03 12:35:53 -0700, Gil wrote:
> Yesterday I hacked together a script that takes a gem file and
> builds an rpm out of it.  I did it because I manage a pile of
> servers and they already have rpm-based auto-update, freshness
> checks, and a network-local repository.  I didn't want to
> reimplement and monitor all of that for gems and to be honest I
> don't feel comfortable with multiple package managers running around
> lights-out systems.
> I think my implementation is cheating a little bit because the RPM
> folks go on and on about pristine sources and all and I'm just
> starting from the gem.  However, the script seemed to build gems for
> rake, rails etc and will make my life much easier in administering
> said machines.

cool :)

i already have tons of rpms here: http://en.opensuse.org/Ruby
i just enabled sles9 support. next will be fedora 4/5.

> The script lives here:
>     http://www.fooplanet.com/projects/gem2rpm/gem2rpm.gz

will look at it:)

>   - gem appeared to place the wrapper scripts in different
>     directories when running with uid = 0 than under another uid.  I
>     don't build rpms as root so this meant that I couldn't get the
>     wrappers into $RPM_BUILD_ROOT/usr/bin without moving them
>     myself.  Is there a better way to get gem to pretend that an
>     unusual directory is the root of the filesystem (like make
>     DESTDIR=foo install usually does)?

see my patch send to the mailinglist a few days ago. it adds a 
"gem install --build-root %{buildroot}"

>   - RPM has several fields that GEM doesn't appear to have including
>     BuildArch, License, and Group.  Group appears to be an RPM thing
>     so I expect it to be missing.  Did I overlook some way to
>     get at the other two?

buildarch doesnt need to be set from the spec file.
license could be passed as a commandline parameter.

>   - I'm unhappy with the contents of the changelog since the rpm
>     changelog usually reflects the packaging history rather than the
>     actual package history.  Implementing something else seemed like
>     it would cost more than it was worth.  Anyone have any better
>     ideas?

you could popup an editor so the packager could add some notes. i
usually combine the gem changelog + packager notes.

>   - Some Linux distributions have an idea of prefixing or suffixing
>     package names based on the language they come from, usually when
>     the thing being packaged is a library.  For example, Fedora has
>     names like perl-Compress-Zlib for the Compres::Zlib perl
>     library.  Is anyone aware of such a convention for ruby packages
>     other than just "ruby-"?

i use "rubygem-" so i can optionally provide a "ruby-" package.
rubygem- - packaged from gem
ruby-    - packaged from tarball

>   - I couldn't find any easy way of extracting package metadata
>     concerning rubygems itself prior to having rake installed.  Even
>     then, the data mostly concerned the update package rather than
>     rubygems proper.

i have a small gemunpack script. gem files are basically tarballs.
not too much magic involved.

you can catch me on irc (darix on freenode or quakenet).

so long ...


           openSUSE - SUSE Linux is my linux
               openSUSE is good for you

More information about the Rubygems-developers mailing list