Mailinglist Archive: opensuse-ruby (16 mails)

< Previous Next >
Re: [opensuse-ruby] how to make gem package depend on specific Ruby version?
  • From: Adam Spiers <aspiers@xxxxxxxx>
  • Date: Fri, 2 May 2014 13:05:27 +0100
  • Message-id: <20140502120526.GD19138@pacific.linksys.moosehall>
Klaus Kaempf (kkaempf@xxxxxxx) wrote:
* Adam Spiers <aspiers@xxxxxxxx> [Apr 30. 2014 18:18]:
Vagrant 1.5.4 depends on Ruby >= 2.0.0:

What's the correct way to ensure that rubygem-vagrant builds against
ruby20 on openSUSE 12.3 and 13.1?

Why would you want it to build against ruby == 2.0 if the requirement
is for >= 2.0.0 ?

Because ruby20 is the only way to get 2.0.0 on 12.3. OK, on 13.1 I'd
prefer it to work with the default Ruby, but if it works with ruby20
also or instead then that's fine too. To put it simply, I want one
rubygem-vagrant which works on both 12.3 and 13.1.

But I think, with your hint below, I now have this working:

So as long as I have the devel_languages_ruby_openSUSE_x.y repo added
via zypper, it should install correctly for x.y.

On 12.3, by default (i.e. without any explicit dependencies on a Ruby
version) it builds against 1.9 and then fails as soon as it encounters
use of ** keyword parameters.

If I use the dependencies suggested by gem2rpm via the .spec template:

BuildRequires: ruby-macros >= 3
Requires: ruby >= 2.0.0
BuildRequires: ruby >= 2.0.0

(I guess the >= 2.0.0 might have come from my patch in the above pull

then I get:

$ osc build openSUSE_13.1
Building rubygem-vagrant.spec for openSUSE_13.1/x86_64
Getting buildinfo from server and store to
Getting buildconfig from server and store to
buildinfo is broken... it says:
unresolvable: nothing provides ruby >= 2.0.0

That's how RPM version comparison works. 2.0.0 is greater than 2.0 iirc.

Yeah :-/

Looking at openSUSE:13.1, I see

ruby (providing ruby = 2.0-5.1.2, requiring ruby20 >= 2.0.0.p247)
ruby19 (not providing ruby, but ruby(abi) = 1.9.1)
ruby20 (not providing ruby, but ruby(abi) = 2.0.0)

Try to change your package's requirements to

Requires: ruby(abi) >= 2.0.0
BuildRequires: ruby(abi) >= 2.0.0

I already tried that. IIRC it created other problems, but I can't
remember what :-/

and the same for 12.3.

Weirdly, if I drop the patch-level from the dependencies, i.e.

Requires: ruby >= 2.0
BuildRequires: ruby >= 2.0

then it builds fine. I'm guessing that this is because Ruby on
vanilla 13.1 was packaged with version 2.0 rather than version 2.0.0.
What was the reason for that decision?

Anyone want to comment on this?

If instead I try building against d:l:r ...

$ osc build devel_languages_ruby_openSUSE_12.3


$ osc build devel_languages_ruby_openSUSE_13.1

then it builds against 2.1.0 and fails to install:

To be expected if you don't add devel_languages_ruby_openSUSE_13.1
to zypper.

Thanks - I think that last repo was indeed the missing piece.

But doing so will install ruby 2.1 on your openSUSE 13.1 system.

Right :)

Thanks for the reply!
To unsubscribe, e-mail: opensuse-ruby+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-ruby+owner@xxxxxxxxxxxx

< Previous Next >
List Navigation