aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-03-30 21:58:12 +0100
committerAndre Arko <andre@arko.net>2015-03-30 21:58:12 +0100
commit7e0ffb06b666c08337635cba522c543af782b090 (patch)
tree3f1190572404f13449a2aae39738e3bf1dcac45b
parentf880ba4d7422cafe315066dacd12f9d82e4a290e (diff)
parent52625b1a1e25d3145cbe6f6ed19799f55c4049ae (diff)
downloadbundler-7e0ffb06b666c08337635cba522c543af782b090.tar.gz
Merge tag 'v1.8.6' into 1-9-stable
Version 1.8.6 Conflicts: CHANGELOG.md lib/bundler/version.rb
-rw-r--r--CHANGELOG.md7
-rw-r--r--lib/bundler/definition.rb9
-rw-r--r--lib/bundler/installer.rb30
-rw-r--r--lib/bundler/rubygems_integration.rb14
-rw-r--r--lib/bundler/shared_helpers.rb19
-rw-r--r--lib/bundler/source.rb5
-rw-r--r--lib/bundler/source/rubygems.rb14
-rw-r--r--spec/bundler/bundler_spec.rb8
-rw-r--r--spec/install/gems/sources_spec.rb60
-rw-r--r--spec/support/builders.rb13
10 files changed, 131 insertions, 48 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ff61c8a..d0c19f9f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,6 +31,13 @@ Features:
- Molinillo resolver, shared with CocoaPods (@segiddins)
- updated Thor to v0.19.1 (@segiddins)
+## 1.8.6 (2015-03-30)
+
+Bugfixes:
+
+ - keep gems locked when updating another gem from the same source (#3250, @indirect)
+ - resolve race that could build gems without saved arguments (#3404, @indirect)
+
## 1.8.5 (2015-03-11)
Bugfixes:
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 4c158665..e9d5d0b6 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -272,7 +272,7 @@ module Bundler
each do |spec|
next if spec.name == 'bundler'
out << spec.to_lock
- end
+ end
out << "\n"
end
@@ -561,8 +561,11 @@ module Bundler
resolve
end
- def in_locked_deps?(dep, d)
- d && dep.source == d.source
+ def in_locked_deps?(dep, locked_dep)
+ # Because the lockfile can't link a dep to a specific remote, we need to
+ # treat sources as equivalent anytime the locked dep has all the remotes
+ # that the Gemfile dep does.
+ locked_dep && locked_dep.source && dep.source && locked_dep.source.include?(dep.source)
end
def satisfies_locked_spec?(dep)
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 10526115..0654d91f 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -96,20 +96,26 @@ module Bundler
def install_gem_from_spec(spec, standalone = false, worker = 0)
# Fetch the build settings, if there are any
- settings = Bundler.settings["build.#{spec.name}"]
- install_message = nil
- post_install_message = nil
- debug_message = nil
- Bundler.rubygems.with_build_args [settings] do
- install_message, post_install_message, debug_message = spec.source.install(spec)
- if install_message.include? 'Installing'
- Bundler.ui.confirm install_message
- else
- Bundler.ui.info install_message
+ settings = Bundler.settings["build.#{spec.name}"]
+ messages = nil
+
+ if settings
+ Bundler.rubygems.with_build_args [settings] do
+ messages = spec.source.install(spec)
end
- Bundler.ui.debug debug_message if debug_message
- Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
+ else
+ messages = spec.source.install(spec)
+ end
+
+ install_message, post_install_message, debug_message = *messages
+
+ if install_message.include? 'Installing'
+ Bundler.ui.confirm install_message
+ else
+ Bundler.ui.info install_message
end
+ Bundler.ui.debug debug_message if debug_message
+ Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
if Bundler.settings[:bin] && standalone
generate_standalone_bundler_executable_stubs(spec)
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index d32bbb36..ef9ac0a2 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -161,12 +161,14 @@ module Bundler
end
def with_build_args(args)
- old_args = self.build_args
- begin
- self.build_args = args
- yield
- ensure
- self.build_args = old_args
+ ext_lock.synchronize do
+ old_args = self.build_args
+ begin
+ self.build_args = args
+ yield
+ ensure
+ self.build_args = old_args
+ end
end
end
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index 0087f078..cd4ad717 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -35,32 +35,27 @@ module Bundler
end
def default_bundle_dir
- global_bundle_dir = File.join(Bundler.rubygems.user_home, ".bundle")
bundle_dir = find_directory(".bundle")
+ return nil unless bundle_dir
- if bundle_dir && bundle_dir != global_bundle_dir
- Pathname.new(bundle_dir)
- else
- nil
- end
+ global_bundle_dir = File.join(Bundler.rubygems.user_home, ".bundle")
+ return nil if bundle_dir == global_bundle_dir
+
+ Pathname.new(bundle_dir)
end
def in_bundle?
find_gemfile
end
- def chdir_monitor
- Bundler.rubygems.ext_lock
- end
-
def chdir(dir, &blk)
- chdir_monitor.synchronize do
+ Bundler.rubygems.ext_lock.synchronize do
Dir.chdir dir, &blk
end
end
def pwd
- chdir_monitor.synchronize do
+ Bundler.rubygems.ext_lock.synchronize do
Dir.pwd
end
end
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index d1fd35a3..b544451d 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -37,5 +37,10 @@ module Bundler
def can_lock?(spec)
spec.source == self
end
+
+ def include?(other)
+ other == self
+ end
+
end
end
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index b29d1ad0..404853a5 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -36,11 +36,15 @@ module Bundler
end
def eql?(o)
- o.is_a?(Rubygems) && remotes_equal?(o.remotes)
+ o.is_a?(Rubygems) && o.credless_remotes == credless_remotes
end
alias == eql?
+ def include?(o)
+ o.is_a?(Rubygems) && (o.credless_remotes - credless_remotes).empty?
+ end
+
def can_lock?(spec)
spec.source.is_a?(Rubygems)
end
@@ -200,6 +204,10 @@ module Bundler
protected
+ def credless_remotes
+ remotes.map(&method(:suppress_configured_credentials))
+ end
+
def source_uris_for_spec(spec)
specs.search_all(spec.name).inject([]) do |uris, s|
uris << s.source_uri.without_credentials if s.source_uri
@@ -370,10 +378,6 @@ module Bundler
spec.loaded_from && spec.loaded_from.include?("specifications/default/")
end
- def remotes_equal?(other_remotes)
- remotes.map(&method(:suppress_configured_credentials)) == other_remotes.map(&method(:suppress_configured_credentials))
- end
-
end
end
end
diff --git a/spec/bundler/bundler_spec.rb b/spec/bundler/bundler_spec.rb
index f26183e0..fa226002 100644
--- a/spec/bundler/bundler_spec.rb
+++ b/spec/bundler/bundler_spec.rb
@@ -17,13 +17,11 @@ describe Bundler do
end
end
- context "on Ruby 1.8", :ruby => "1.8" do
- it "catches YAML syntax errors" do
- expect { subject }.to raise_error(Bundler::GemspecError)
- end
+ it "catches YAML syntax errors" do
+ expect { subject }.to raise_error(Bundler::GemspecError)
end
- context "on Ruby 1.9", :ruby => "1.9", :if => defined?(YAML::ENGINE) do
+ context "on Rubies with a settable YAML engine", :if => defined?(YAML::ENGINE) do
context "with Syck as YAML::Engine" do
it "raises a GemspecError after YAML load throws ArgumentError" do
orig_yamler, YAML::ENGINE.yamler = YAML::ENGINE.yamler, 'syck'
diff --git a/spec/install/gems/sources_spec.rb b/spec/install/gems/sources_spec.rb
index cca00a91..45e3a43e 100644
--- a/spec/install/gems/sources_spec.rb
+++ b/spec/install/gems/sources_spec.rb
@@ -319,4 +319,64 @@ describe "bundle install with gems on multiple sources" do
should_be_installed("rack 1.0.0")
end
end
+
+ context "when a single source contains multiple locked gems" do
+ before do
+ # 1. With these gems,
+ build_repo4 do
+ build_gem "foo", "0.1"
+ build_gem "bar", "0.1"
+ end
+
+ # 2. Installing this gemfile will produce...
+ gemfile <<-G
+ source 'file://#{gem_repo1}'
+ gem 'rack'
+ gem 'foo', '~> 0.1', :source => 'file://#{gem_repo4}'
+ gem 'bar', '~> 0.1', :source => 'file://#{gem_repo4}'
+ G
+
+ # 3. this lockfile.
+ lockfile <<-L
+ GEM
+ remote: file:/Users/andre/src/bundler/bundler/tmp/gems/remote1/
+ remote: file:/Users/andre/src/bundler/bundler/tmp/gems/remote4/
+ specs:
+ bar (0.1)
+ foo (0.1)
+ rack (1.0.0)
+
+ PLATFORMS
+ ruby
+
+ DEPENDENCIES
+ bar (~> 0.1)!
+ foo (~> 0.1)!
+ rack
+ L
+
+ bundle "install --path ../gems/system"
+
+ # 4. Then we add some new versions...
+ update_repo4 do
+ build_gem "foo", "0.2"
+ build_gem "bar", "0.3"
+ end
+ end
+
+ it "allows them to be unlocked separately" do
+ # 5. and install this gemfile, updating only foo.
+ install_gemfile <<-G
+ source 'file://#{gem_repo1}'
+ gem 'rack'
+ gem 'foo', '~> 0.2', :source => 'file://#{gem_repo4}'
+ gem 'bar', '~> 0.1', :source => 'file://#{gem_repo4}'
+ G
+
+ # 6. Which should update foo to 0.2, but not the (locked) bar 0.1
+ should_be_installed("foo 0.2")
+ should_be_installed("bar 0.1")
+ end
+ end
+
end
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index 5490a2b9..1a1c9167 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -260,12 +260,15 @@ module Spec
FileUtils.rm_rf Dir[gem_repo3("prerelease*")]
end
- # A repo that has no pre-installed gems included. (The caller completely determines the contents with the block)
- def build_repo4(&blk)
+ # A repo that has no pre-installed gems included. (The caller completely
+ # determines the contents with the block.)
+ def build_repo4
FileUtils.rm_rf gem_repo4
- build_repo(gem_repo4) do
- yield if block_given?
- end
+ build_repo(gem_repo4) { yield }
+ end
+
+ def update_repo4
+ update_repo(gem_repo4) { yield }
end
def update_repo2