summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-02-13 17:34:47 -0600
committerSamuel Giddins <segiddins@segiddins.me>2017-02-13 17:34:47 -0600
commit573d6f8ac64d604d71e78933117716b4ca77833f (patch)
tree87068e2ba6b1c79f602c08051405638fd97cf888
parent986a2ea581edfd70cd1a2a6936c981fd4c92f6d0 (diff)
downloadbundler-573d6f8ac64d604d71e78933117716b4ca77833f.tar.gz
Compare deps in a manner compatible with old RGs
-rw-r--r--lib/bundler/endpoint_specification.rb4
-rw-r--r--lib/bundler/remote_specification.rb4
-rw-r--r--spec/install/gems/compact_index_spec.rb7
3 files changed, 10 insertions, 5 deletions
diff --git a/lib/bundler/endpoint_specification.rb b/lib/bundler/endpoint_specification.rb
index 65f6b6fbcf..5e14f03265 100644
--- a/lib/bundler/endpoint_specification.rb
+++ b/lib/bundler/endpoint_specification.rb
@@ -91,9 +91,9 @@ module Bundler
end
def __swap__(spec)
- without_type = proc {|d| Gem::Dependency.new(d.name, d.requirements_list) }
+ without_type = proc {|d| Gem::Dependency.new(d.name, d.requirements_list.sort) }
if (extra_deps = spec.runtime_dependencies.map(&without_type).-(dependencies.map(&without_type))) && extra_deps.any?
- Bundler.ui.debug "#{full_name} from #{remote} has corrupted API dependencies"
+ Bundler.ui.debug "#{full_name} from #{remote} has corrupted API dependencies (API returned #{dependencies}, real spec has (#{spec.runtime_dependencies}))"
raise APIResponseMismatchError,
"Downloading #{full_name} revealed dependencies not in the API (#{extra_deps.map(&:to_s).join(", ")})." \
"\nInstalling with `--full-index` should fix the problem."
diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb
index 3d201fbf16..a77e5aae30 100644
--- a/lib/bundler/remote_specification.rb
+++ b/lib/bundler/remote_specification.rb
@@ -52,9 +52,9 @@ module Bundler
def __swap__(spec)
without_type = proc {|d| Gem::Dependency.new(d.name, d.requirements_list) }
if (extra_deps = spec.runtime_dependencies.map(&without_type).-(dependencies.map(&without_type))) && extra_deps.any?
- Bundler.ui.debug "#{full_name} from #{remote} has corrupted API dependencies"
+ Bundler.ui.debug "#{full_name} from #{remote} has corrupted API dependencies (API returned #{dependencies}, real spec has (#{spec.runtime_dependencies}))"
raise APIResponseMismatchError,
- "Downloading #{full_name} revealed dependencies not in the API (#{extra_deps.map(&:to_s).join(", ")})." \
+ "Downloading #{full_name} revealed dependencies not in the API (#{extra_deps.map(&without_type).map(&:to_s).join(", ")})." \
"\nInstalling with `--full-index` should fix the problem."
end
@_remote_specification = spec
diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb
index 66e643e978..bdcb56d71e 100644
--- a/spec/install/gems/compact_index_spec.rb
+++ b/spec/install/gems/compact_index_spec.rb
@@ -759,8 +759,13 @@ The checksum of /versions does not match the checksum provided by the server! So
source "#{source_uri}"
gem "rails"
G
+ deps = [Gem::Dependency.new("rake", "= 10.0.2"),
+ Gem::Dependency.new("actionpack", "= 2.3.2"),
+ Gem::Dependency.new("activerecord", "= 2.3.2"),
+ Gem::Dependency.new("actionmailer", "= 2.3.2"),
+ Gem::Dependency.new("activeresource", "= 2.3.2")]
expect(out).to include(<<-E.strip).and include("rails-2.3.2 from rubygems remote at #{source_uri}/ has corrupted API dependencies")
-Downloading rails-2.3.2 revealed dependencies not in the API (rake (= 10.0.2), actionpack (= 2.3.2), activerecord (= 2.3.2), actionmailer (= 2.3.2), activeresource (= 2.3.2)).
+Downloading rails-2.3.2 revealed dependencies not in the API (#{deps.join(", ")}).
Installing with `--full-index` should fix the problem.
E
end