Adam Spiers
2014-04-29 22:40:59 UTC
I think I found a bug in our current rubygems automatic dependency
system[0]. It's similar to the problem darix mentioned almost 3 years
ago[1], and I can demonstrate with the real world example I just
found ...
vagrant's upstream .gemspec file contains this dependency range:
s.add_dependency "net-ssh", ">= 2.6.6", "< 2.8.0"
This translates to the following rpm Requires:
auto: rubygem(1.9.1:net-ssh) >= 2.6.6
auto: rubygem(1.9.1:net-ssh) < 2.8.0
Unfortunately the only versions available on 12.3 from d:l:r:e and the
base OS are as follows:
S | Name | Type | Version | Arch | Repository
--+---------------------+---------+-------------+--------+--------------------------------
i | rubygem-net-ssh | package | 2.8.0-26.1 | x86_64 | Ruby Extensions (openSUSE_12.3)
v | rubygem-net-ssh | package | 2.6.1-2.1.1 | x86_64 | openSUSE-12.3-Oss
| rubygem-net-ssh-2_1 | package | 2.1.4-2.7 | x86_64 | Ruby Extensions (openSUSE_12.3)
| rubygem-net-ssh-2_2 | package | 2.2.2-3.7 | x86_64 | Ruby Extensions (openSUSE_12.3)
So in this situation, if I zypper install my vagrant package, I end up
with the following simultaneously installed:
rubygem-net-ssh-2_1-2.1.4-2.7.x86_64
rubygem-net-ssh-2.8.0-26.1.x86_64
The first satisfies the < 2.8.0 requirement, and the second satisfies
the >= 2.6.6 requirement, but neither of them give vagrant what it
really wants. So when I run it, I get:
/usr/lib64/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find net-ssh (< 2.8.0, >= 2.6.6) amongst [RedCloth-4.2.9, [...snipped...], net-ssh-2.8.0, net-ssh-2.1.4, [...snipped...], vagrant-1.5.4, [...snipped...]] (Gem::LoadError)
from /usr/lib64/ruby/1.9.1/rubygems/specification.rb:777:in `block in activate_dependencies'
from /usr/lib64/ruby/1.9.1/rubygems/specification.rb:766:in `each'
from /usr/lib64/ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
from /usr/lib64/ruby/1.9.1/rubygems/specification.rb:750:in `activate'
from /usr/lib64/ruby/1.9.1/rubygems.rb:1232:in `gem'
from /usr/bin/vagrant:22:in `<main>'
This looks like a fundamental limitation of rpm's version requirement
system, and I can't think of a good workaround right now :-/
Does anyone have a good idea how to fix this? The upstream docs seem
blissfully unaware of the problem[2].
[0] as described by https://en.opensuse.org/openSUSE:Packaging_Ruby#How_gem_dependencies_are_automatically_handled
[1] http://lists.opensuse.org/opensuse-ruby/2011-07/msg00000.html
[2] http://www.rpm.org/wiki/PackagerDocs/MultipleVersions
system[0]. It's similar to the problem darix mentioned almost 3 years
ago[1], and I can demonstrate with the real world example I just
found ...
vagrant's upstream .gemspec file contains this dependency range:
s.add_dependency "net-ssh", ">= 2.6.6", "< 2.8.0"
This translates to the following rpm Requires:
auto: rubygem(1.9.1:net-ssh) >= 2.6.6
auto: rubygem(1.9.1:net-ssh) < 2.8.0
Unfortunately the only versions available on 12.3 from d:l:r:e and the
base OS are as follows:
S | Name | Type | Version | Arch | Repository
--+---------------------+---------+-------------+--------+--------------------------------
i | rubygem-net-ssh | package | 2.8.0-26.1 | x86_64 | Ruby Extensions (openSUSE_12.3)
v | rubygem-net-ssh | package | 2.6.1-2.1.1 | x86_64 | openSUSE-12.3-Oss
| rubygem-net-ssh-2_1 | package | 2.1.4-2.7 | x86_64 | Ruby Extensions (openSUSE_12.3)
| rubygem-net-ssh-2_2 | package | 2.2.2-3.7 | x86_64 | Ruby Extensions (openSUSE_12.3)
So in this situation, if I zypper install my vagrant package, I end up
with the following simultaneously installed:
rubygem-net-ssh-2_1-2.1.4-2.7.x86_64
rubygem-net-ssh-2.8.0-26.1.x86_64
The first satisfies the < 2.8.0 requirement, and the second satisfies
the >= 2.6.6 requirement, but neither of them give vagrant what it
really wants. So when I run it, I get:
/usr/lib64/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find net-ssh (< 2.8.0, >= 2.6.6) amongst [RedCloth-4.2.9, [...snipped...], net-ssh-2.8.0, net-ssh-2.1.4, [...snipped...], vagrant-1.5.4, [...snipped...]] (Gem::LoadError)
from /usr/lib64/ruby/1.9.1/rubygems/specification.rb:777:in `block in activate_dependencies'
from /usr/lib64/ruby/1.9.1/rubygems/specification.rb:766:in `each'
from /usr/lib64/ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
from /usr/lib64/ruby/1.9.1/rubygems/specification.rb:750:in `activate'
from /usr/lib64/ruby/1.9.1/rubygems.rb:1232:in `gem'
from /usr/bin/vagrant:22:in `<main>'
This looks like a fundamental limitation of rpm's version requirement
system, and I can't think of a good workaround right now :-/
Does anyone have a good idea how to fix this? The upstream docs seem
blissfully unaware of the problem[2].
[0] as described by https://en.opensuse.org/openSUSE:Packaging_Ruby#How_gem_dependencies_are_automatically_handled
[1] http://lists.opensuse.org/opensuse-ruby/2011-07/msg00000.html
[2] http://www.rpm.org/wiki/PackagerDocs/MultipleVersions