diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-03-03 15:56:46 -0600 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-03-03 15:56:46 -0600 |
commit | 8478e5b5ec2d9db5bdba05dde89245e12e690608 (patch) | |
tree | fcab88b7b3e60343f92ed8ebd662c3bef17f9ade /lib/bundler/vendor | |
parent | 390127b6b4313f74c868b4e3e14fc6dbca4b0f05 (diff) | |
download | bundler-8478e5b5ec2d9db5bdba05dde89245e12e690608.tar.gz |
Update vendored Molinillo to 0.5.7seg-molinillo-0.5.7
Diffstat (limited to 'lib/bundler/vendor')
4 files changed, 28 insertions, 18 deletions
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb index e147ded7b8..76e84ab7e6 100644 --- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb @@ -132,7 +132,8 @@ module Bundler::Molinillo vertices.each do |name, vertex| other_vertex = other.vertex_named(name) return false unless other_vertex - return false unless other_vertex.successors.map(&:name).to_set == vertex.successors.map(&:name).to_set + return false unless vertex.payload == other_vertex.payload + return false unless other_vertex.successors.to_set == vertex.successors.to_set end end diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb index 7881c087c9..eab989e7bc 100644 --- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb @@ -10,7 +10,7 @@ module Bundler::Molinillo # @return [Object] the payload the vertex holds attr_accessor :payload - # @return [Arrary<Object>] the explicit requirements that required + # @return [Array<Object>] the explicit requirements that required # this vertex attr_reader :explicit_requirements diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb b/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb index 49ab4492fb..a4fb6dd68e 100644 --- a/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +++ b/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Bundler::Molinillo # The version of Bundler::Molinillo. - VERSION = '0.5.6'.freeze + VERSION = '0.5.7'.freeze end diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb b/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb index 02431dd869..1845966a75 100644 --- a/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +++ b/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb @@ -52,7 +52,7 @@ module Bundler::Molinillo @base = base @states = [] @iteration_counter = 0 - @parent_of = {} + @parents_of = Hash.new { |h, k| h[k] = [] } end # Resolves the {#original_requested} dependencies into a full dependency @@ -105,7 +105,7 @@ module Bundler::Molinillo handle_missing_or_push_dependency_state(initial_state) - debug { "Starting resolution (#{@started_at})" } + debug { "Starting resolution (#{@started_at})\nUser-requested dependencies: #{original_requested}" } resolver_ui.before_resolution end @@ -178,14 +178,14 @@ module Bundler::Molinillo # Unwinds the states stack because a conflict has been encountered # @return [void] def unwind_for_conflict - debug(depth) { "Unwinding for conflict: #{requirement}" } + debug(depth) { "Unwinding for conflict: #{requirement} to #{state_index_for_unwind / 2}" } conflicts.tap do |c| sliced_states = states.slice!((state_index_for_unwind + 1)..-1) raise VersionConflict.new(c) unless state activated.rewind_to(sliced_states.first || :initial_state) if sliced_states state.conflicts = c index = states.size - 1 - @parent_of.reject! { |_, i| i >= index } + @parents_of.each { |_, a| a.reject! { |i| i >= index } } end end @@ -214,7 +214,7 @@ module Bundler::Molinillo # to the list of requirements. def parent_of(requirement) return unless requirement - return unless index = @parent_of[requirement] + return unless index = @parents_of[requirement].last return unless parent_state = @states[index] parent_state.requirement end @@ -361,18 +361,20 @@ module Bundler::Molinillo deps = dependencies_for(payload).group_by(&method(:name_for)) vertex.outgoing_edges.each do |outgoing_edge| requirement = outgoing_edge.requirement - parent_index = @parent_of[requirement] + parent_index = @parents_of[requirement].last succ = outgoing_edge.destination matching_deps = Array(deps[succ.name]) dep_matched = matching_deps.include?(requirement) - # only reset the parent index when it was originally required by the + # only push the current index when it was originally required by the # same named spec - @parent_of[requirement] = states.size - 1 if parent_index && states[parent_index].name == name + if parent_index && states[parent_index].name == name + @parents_of[requirement].push(states.size - 1) + end if matching_deps.empty? && !succ.root? && succ.predecessors.to_a == [vertex] debug(depth) { "Removing orphaned spec #{succ.name} after swapping #{name}" } - succ.requirements.each { |r| @parent_of.delete(r) } + succ.requirements.each { |r| @parents_of.delete(r) } removed_names = activated.detach_vertex_named(succ.name).map(&:name) requirements.delete_if do |r| @@ -381,9 +383,10 @@ module Bundler::Molinillo removed_names.include?(name_for(r)) end elsif !dep_matched + debug(depth) { "Removing orphaned dependency #{requirement} after swapping #{name}" } # also reset if we're removing the edge, but only if its parent has # already been fixed up - @parent_of[requirement] = states.size - 1 if @parent_of[requirement].nil? + @parents_of[requirement].push(states.size - 1) if @parents_of[requirement].empty? activated.delete_edge(outgoing_edge) requirements.delete(requirement) @@ -406,13 +409,18 @@ module Bundler::Molinillo # @return [Boolean] whether the current spec is satisfied as a new # possibility. def new_spec_satisfied? + unless requirement_satisfied_by?(requirement, activated, possibility) + debug(depth) { 'Unsatisfied by requested spec' } + return false + end + locked_requirement = locked_requirement_named(name) - requested_spec_satisfied = requirement_satisfied_by?(requirement, activated, possibility) + locked_spec_satisfied = !locked_requirement || requirement_satisfied_by?(locked_requirement, activated, possibility) - debug(depth) { 'Unsatisfied by requested spec' } unless requested_spec_satisfied debug(depth) { 'Unsatisfied by locked spec' } unless locked_spec_satisfied - requested_spec_satisfied && locked_spec_satisfied + + locked_spec_satisfied end # @param [String] requirement_name the spec name to search for @@ -428,7 +436,7 @@ module Bundler::Molinillo # @return [void] def activate_spec conflicts.delete(name) - debug(depth) { 'Activated ' + name + ' at ' + possibility.to_s } + debug(depth) { "Activated #{name} at #{possibility}" } activated.set_payload(name, possibility) require_nested_dependencies_for(possibility) end @@ -443,7 +451,8 @@ module Bundler::Molinillo nested_dependencies.each do |d| activated.add_child_vertex(name_for(d), nil, [name_for(activated_spec)], d) parent_index = states.size - 1 - @parent_of[d] ||= parent_index + parents = @parents_of[d] + parents << parent_index if parents.empty? end push_state_for_requirements(requirements + nested_dependencies, !nested_dependencies.empty?) |