rubygems/bundler

Attempts to install dependencies with platform :rbx on MRI

Closed this issue · 14 comments

mvz commented

On Rubinius, (parts of) the ruby standard library need to be specified in the Gemfile (see rubinius/rubinius#2827). However, I can't get bunder to ignore the gem using the platform option. A minimal Gemfile that illustrates the problem looks like this:

source 'https://rubygems.org'
gem 'rubysl', platform: :rbx

Calling bundle install --local with this Gemfile on MRI causes Bundler to complain that the rubysl gem is not installed.

I have made a reproduction script:

https://gist.github.com/mvz/8099820

I have heard from @brixen that this is working fine for many people. I'm not sure what's different in your particular case, and I'm not super familiar with using rubysl because I don't use Rubinius on a daily basis.

I created the following repo to help debug Bundler + RubySL issues:

https://github.com/rubinius/bundler-canary

On eg Ubuntu 10.04 64bit, I get the following result:

vagrant@lucid64:~/devel/bundler-canary$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
vagrant@lucid64:~/devel/bundler-canary$ bundle -v
Bundler version 1.3.5
vagrant@lucid64:~/devel/bundler-canary$ bundle install --local
Resolving dependencies...
Could not find gem 'rubysl (>= 0) ruby' in the gems available on this machine.
vagrant@lucid64:~/devel/bundler-canary$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake (10.1.1)
Using bundler (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

As seen above, bundle install under MRI succeeds, but bundle install --local does not.

I can try with a different version of MRI if that would help.

mvz commented

@brixen thanks for looking into this. My results are indeed the same as yours: bundle install turns out to work fine, and bundle exec works fine thereafter. It is just with --local, and running bundle exec before bundle install that problems occur.

zzak commented

Might this be related to #2791

mvz commented

@zzak not likely. I'm experiencing this both in Bundler 1.3.5, which should be from before the change that introduced #2791, and in 1.5.1, which is from after that change.

I'm experiencing what seems to be the same issue. I'm trying to bundle the sshkit gem for development.

It's Gemfile includes:

platforms :rbx do
  gem 'rubysl', '~> 2.0'
  gem 'rubysl-json'
end

And running either bundle or bundle install results in:

Fetching gem metadata from https://rubygems.org/.......
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Could not find gem 'rubysl-json (>= 0) ruby' in the gems available on this machine.

This is with bundler version 1.5.1 with MRI 2.0.0p247.

@thomasfedb please use gem 'json'. The rubysl-json gem was a mistake before I realized the code was being imported to MRI from the existing json gem. Once you change that, you'll need to clear the .lock file.

The other issue here is also that the .lock file doesn't include enough platform information to know to not even look for that gem when running MRI.

@brixen There was no lock file present.

I will change the gemfile and submit a PR to sshkit.

mvz commented

I just found out this problem does not occur if, e.g., :jruby is specified as the platform.

mvz commented

Note that the problem only occurs if the gem in question (in this case, rubysl) is not installed for the currently running ruby.

oh! I bet the remote gemspec standin doesn't have proper platform information, and we aren't fetching it because it's expensive. It will slow things down, but we probably need to do it. :/ (Or wait for the new index format that includes it without any additional requests).

On Sun, May 11, 2014 at 5:27 PM, Matijs van Zuijlen
notifications@github.com wrote:

Note that the problem only occurs if the gem in question (in this case, rubysl) is not installed for the currently running ruby.

Reply to this email directly or view it on GitHub:
#2774 (comment)

mvz commented

@indirect it works fine when I allow Bundler to fetch remote data. It is only when running with --local that it fails. And yes, I want to use --local because I don't want to wait for Bundler to fetch info from rubygems.

Oh. So, when you use --local, you are explicitly forbidding Bundler from downloading information about the gem's platform... but that shouldn't stop us from being able to check if the platform we are on matches the platform that the Gemfile puts the gem in. I understand now. Thanks for explaining!

I think this one can now be closed.