weixin_39643679
weixin_39643679
2021-01-12 05:50

--local does not work

In Fedora, we are using bundle install --local to use system gem. But it does not work with bundler 1.5.2 anymore.


# rpm -q rubygem-bundler
rubygem-bundler-1.5.2-1.fc21.noarch

# bundle install --local --verbose
Using rake (10.0.4)
0:  rake (10.0.4) from /usr/share/gems/specifications/rake-10.0.4.gemspec
Using i18n (0.6.9)
0:  i18n (0.6.9) from /usr/share/gems/specifications/i18n-0.6.9.gemspec
Using minitest (4.7.0)
0:  minitest (4.7.0) from /usr/share/gems/specifications/minitest-4.7.0.gemspec
Using multi_json (1.7.7)
0:  multi_json (1.7.7) from /usr/share/gems/specifications/multi_json-1.7.7.gemspec
Using atomic (1.1.9)
0:  atomic (1.1.9) from /usr/share/gems/specifications/atomic-1.1.9.gemspec
Using thread_safe (0.1.3)
0:  thread_safe (0.1.3) from /usr/share/gems/specifications/thread_safe-0.1.3.gemspec
Using tzinfo (0.3.37)
0:  tzinfo (0.3.37) from /usr/share/gems/specifications/tzinfo-0.3.37.gemspec
Using activesupport (4.0.2)
0:  activesupport (4.0.2) from /usr/share/gems/specifications/activesupport-4.0.2.gemspec
Using builder (3.1.4)
0:  builder (3.1.4) from /usr/share/gems/specifications/builder-3.1.4.gemspec
Using erubis (2.7.0)
0:  erubis (2.7.0) from /usr/share/gems/specifications/erubis-2.7.0.gemspec
Using rack (1.5.2)
0:  rack (1.5.2) from /usr/share/gems/specifications/rack-1.5.2.gemspec
Using rack-test (0.6.2)
0:  rack-test (0.6.2) from /usr/share/gems/specifications/rack-test-0.6.2.gemspec
Using actionpack (4.0.2)
0:  actionpack (4.0.2) from /usr/share/gems/specifications/actionpack-4.0.2.gemspec
Using mime-types (1.19)
0:  mime-types (1.19) from /usr/share/gems/specifications/mime-types-1.19.gemspec
Using polyglot (0.3.3)
0:  polyglot (0.3.3) from /usr/share/gems/specifications/polyglot-0.3.3.gemspec
Using treetop (1.4.14)
0:  treetop (1.4.14) from /usr/share/gems/specifications/treetop-1.4.14.gemspec
Using mail (2.5.4)
0:  mail (2.5.4) from /usr/share/gems/specifications/mail-2.5.4.gemspec
Using actionmailer (4.0.2)
0:  actionmailer (4.0.2) from /usr/share/gems/specifications/actionmailer-4.0.2.gemspec
Using activemodel (4.0.2)
0:  activemodel (4.0.2) from /usr/share/gems/specifications/activemodel-4.0.2.gemspec
Using activerecord-deprecated_finders (1.0.3)
0:  activerecord-deprecated_finders (1.0.3) from /usr/share/gems/specifications/activerecord-deprecated_finders-1.0.3.gemspec
Using arel (4.0.0)
0:  arel (4.0.0) from /usr/share/gems/specifications/arel-4.0.0.gemspec
Using activerecord (4.0.2)
0:  activerecord (4.0.2) from /usr/share/gems/specifications/activerecord-4.0.2.gemspec
Using coffee-script-source (1.6.1)
0:  coffee-script-source (1.6.1) from /usr/share/gems/specifications/coffee-script-source-1.6.1.gemspec
Using execjs (1.4.0)
0:  execjs (1.4.0) from /usr/share/gems/specifications/execjs-1.4.0.gemspec
Using coffee-script (2.2.0)
0:  coffee-script (2.2.0) from /usr/share/gems/specifications/coffee-script-2.2.0.gemspec
Using thor (0.18.1)
0:  thor (0.18.1) from /usr/share/gems/specifications/thor-0.18.1.gemspec
Using railties (4.0.2)
0:  railties (4.0.2) from /usr/share/gems/specifications/railties-4.0.2.gemspec
Using coffee-rails (4.0.0)
0:  coffee-rails (4.0.0) from /usr/share/gems/specifications/coffee-rails-4.0.0.gemspec
Using hike (1.2.1)
0:  hike (1.2.1) from /usr/share/gems/specifications/hike-1.2.1.gemspec
Using jbuilder (1.5.0)
0:  jbuilder (1.5.0) from /usr/share/gems/specifications/jbuilder-1.5.0.gemspec
Using jquery-rails (3.0.4)
0:  jquery-rails (3.0.4) from /usr/share/gems/specifications/jquery-rails-3.0.4.gemspec
Using json (1.8.1)
0:  json (1.8.1) from /usr/local/share/gems/specifications/json-1.8.1.gemspec
Using bundler (1.5.2)
0:  bundler (1.5.2) from /usr/share/gems/specifications/bundler-1.5.2.gemspec
Using tilt (1.3.7)
0:  tilt (1.3.7) from /usr/share/gems/specifications/tilt-1.3.7.gemspec
Using sprockets (2.8.2)
0:  sprockets (2.8.2) from /usr/share/gems/specifications/sprockets-2.8.2.gemspec
Using sprockets-rails (2.0.0)
0:  sprockets-rails (2.0.0) from /usr/share/gems/specifications/sprockets-rails-2.0.0.gemspec

Bundler::GemNotFound: Could not find rails-4.0.2.gem for installation
/usr/share/gems/gems/bundler-1.5.2/lib/bundler/source/rubygems.rb:149:in `cached_gem'
/usr/share/gems/gems/bundler-1.5.2/lib/bundler/source/rubygems.rb:84:in `install'
/usr/share/gems/gems/bundler-1.5.2/lib/bundler/installer.rb:111:in `block in install_gem_from_spec'
/usr/share/gems/gems/bundler-1.5.2/lib/bundler/rubygems_integration.rb:150:in `with_build_args'
/usr/share/gems/gems/bundler-1.5.2/lib/bundler/installer.rb:110:in `install_gem_from_spec'
/usr/share/gems/gems/bundler-1.5.2/lib/bundler/installer.rb:265:in `block in install_sequentially'
/usr/share/ruby/forwardable.rb:171:in `each'
/usr/share/ruby/forwardable.rb:171:in `each'
/usr/share/gems/gems/bundler-1.5.2/lib/bundler/installer.rb:264:in `install_sequentially'
/usr/share/gems/gems/bundler-1.5.2/lib/bundler/installer.rb:97:in `run'
/usr/share/gems/gems/bundler-1.5.2/lib/bundler/installer.rb:15:in `install'
/usr/share/gems/gems/bundler-1.5.2/lib/bundler/cli.rb:255:in `install'
/usr/share/gems/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
/usr/share/gems/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
/usr/share/gems/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
/usr/share/gems/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
/usr/share/gems/gems/bundler-1.5.2/lib/bundler/cli.rb:10:in `start'
/usr/share/gems/gems/bundler-1.5.2/bin/bundle:20:in `block in <top>'
/usr/share/gems/gems/bundler-1.5.2/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
/usr/share/gems/gems/bundler-1.5.2/bin/bundle:20:in `<top>'
/usr/bin/bundle:23:in `load'
/usr/bin/bundle:23:in `<main>'
An error occurred while installing rails (4.0.2), and Bundler cannot continue.
Make sure that `gem install rails -v '4.0.2'` succeeds before bundling.
</main></top></top>

Here is the list of gems I have available on my system:


# gem list

*** LOCAL GEMS ***

actionmailer (4.0.2)
actionpack (4.0.2)
activemodel (4.0.2)
activerecord (4.0.2)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.2)
arel (4.0.0)
atomic (1.1.9)
bigdecimal (1.2.0)
builder (3.1.4)
bundler (1.5.2)
coffee-rails (4.0.0)
coffee-script (2.2.0)
coffee-script-source (1.6.1)
dalli (2.6.4)
erubis (2.7.0)
execjs (1.4.0)
hike (1.2.1)
i18n (0.6.9)
io-console (0.4.2)
jbuilder (1.5.0)
journey (1.0.4)
jquery-rails (3.0.4)
json (1.8.1, 1.7.7)
listen (0.4.7)
mail (2.5.4)
mime-types (1.19)
minitest (4.7.0)
multi_json (1.7.7)
net-http-persistent (2.9)
polyglot (0.3.3)
psych (2.0.0)
rack (1.5.2)
rack-cache (1.2)
rack-test (0.6.2)
rails (4.0.2)
railties (4.0.2)
rake (10.0.4)
rdoc (4.0.1)
ref (1.0.0)
sass (3.2.6)
sass-rails (4.0.0)
sdoc (0.4.0.rc1)
sprockets (2.8.2)
sprockets-rails (2.0.0)
sqlite3 (1.3.7)
therubyracer (0.11.0)
thor (0.18.1)
thread_safe (0.1.3)
tilt (1.3.7)
treetop (1.4.14)
turbolinks (1.1.1)
tzinfo (0.3.37)
uglifier (2.3.0)

The truth is that we don't carry cached gems, because they are useless on Fedora and they might be insecure. But it worked with Bundler 1.3.x so why Bundler 1.5.2 tries to install the gem, when it is already installed? It seems to be regression.

该提问来源于开源项目:rubygems/bundler

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

9条回答

  • weixin_39801475 weixin_39801475 4月前

    Thanks for the report . I'll look into this.

    点赞 评论 复制链接分享
  • weixin_39598941 weixin_39598941 4月前

    Please paste the output from bundle env.

    点赞 评论 复制链接分享
  • weixin_39520204 weixin_39520204 4月前

    Can you check if this was caused by 0d15cefd0022136de663d6542f079268137c26f1 ?

    I'm seeing similar behaviour on Debian sid.

    点赞 评论 复制链接分享
  • weixin_39520204 weixin_39520204 4月前

    What happens on Debian for system gems:

    Gem::Specification.full_gem_path points to a path that does not exist, mostly because there is no single folder in which all gem files are put into. Causes Bundler::Source::Rubygems::gem_dir_exists?(spec) to return false -> all Gems are considered not installed (while Rubygems sees the Gem just fine).

    点赞 评论 复制链接分享
  • weixin_39856208 weixin_39856208 4月前

    It should be possible to find the correct installed directory even for gems installed into places other than GEM_HOME. I'd be very happy with a path that either fixed Specification#full_gem_path or used #loaded_from to find the installed directory.

    点赞 评论 复制链接分享
  • weixin_39643679 weixin_39643679 4月前
    
    # bundler env
    It's recommended to use Bundler through 'bundle' binary instead of 'bundler'
    Bundler 1.5.2
    Ruby 2.0.0 (2013-06-27 patchlevel 247) [x86_64-linux]
    Rubygems 2.1.11
    GEM_HOME 
    
    
    Gemfile
    source 'https://rubygems.org'
    
    # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
    gem 'rails', '4.0.2'
    
    # Use sqlite3 as the database for Active Record
    gem 'sqlite3'
    
    # Use SCSS for stylesheets
    gem 'sass-rails', '~> 4.0.0'
    
    # Use Uglifier as compressor for JavaScript assets
    gem 'uglifier', '>= 1.3.0'
    
    # Use CoffeeScript for .js.coffee assets and views
    gem 'coffee-rails', '~> 4.0.0'
    
    # See https://github.com/sstephenson/execjs#readme for more supported runtimes
    # gem 'therubyracer', platforms: :ruby
    
    # Use jquery as the JavaScript library
    gem 'jquery-rails'
    
    # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
    gem 'turbolinks'
    
    # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
    gem 'jbuilder', '~> 1.2'
    
    group :doc do
      # bundle exec rake doc:rails generates the API under doc/api.
      gem 'sdoc', require: false
    end
    
    # Use ActiveModel has_secure_password
    # gem 'bcrypt-ruby', '~> 3.1.2'
    
    # Use unicorn as the app server
    # gem 'unicorn'
    
    # Use Capistrano for deployment
    # gem 'capistrano', group: :development
    
    # Use debugger
    # gem 'debugger', group: [:development, :test]
    
    
    Gemfile.lock
    <no gemfile.lock found>
    </no>
    点赞 评论 复制链接分享
  • weixin_39643679 weixin_39643679 4月前

    When I revert to the line [1], Bundler succeeds.

    [1] https://github.com/bundler/bundler/commit/0d15cefd0022136de663d6542f079268137c26f1#diff-68bd939cd3589d8fdda08a12433659ebL71

    点赞 评论 复制链接分享
  • weixin_39520204 weixin_39520204 4月前

    Alright, that's basically what I've done for bundler 1.5.2 in Debian until we have a better fix.

    点赞 评论 复制链接分享
  • weixin_39598941 weixin_39598941 4月前

    Looks like this was fixed in 1.5.3.

    点赞 评论 复制链接分享

相关推荐