mirror of
https://github.com/ruby/ruby.git
synced 2025-09-19 18:43:59 +02:00
merge revision(s) 57412: [Backport #13308]
Update Rubygems 2.6.10 *2ee5bf9fd3
*be510dd409
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
94e70ce869
commit
b85d2e8a5a
23 changed files with 236 additions and 57 deletions
|
@ -119,6 +119,7 @@ module Gem::Resolver::Molinillo
|
|||
# {Vertex#successors}
|
||||
def ==(other)
|
||||
return false unless other
|
||||
return true if equal?(other)
|
||||
vertices.each do |name, vertex|
|
||||
other_vertex = other.vertex_named(name)
|
||||
return false unless other_vertex
|
||||
|
@ -134,6 +135,7 @@ module Gem::Resolver::Molinillo
|
|||
def add_child_vertex(name, payload, parent_names, requirement)
|
||||
root = !parent_names.delete(nil) { true }
|
||||
vertex = add_vertex(name, payload, root)
|
||||
vertex.explicit_requirements << requirement if root
|
||||
parent_names.each do |parent_name|
|
||||
parent_node = vertex_named(parent_name)
|
||||
add_edge(parent_node, vertex, requirement)
|
||||
|
@ -152,7 +154,7 @@ module Gem::Resolver::Molinillo
|
|||
# Detaches the {#vertex_named} `name` {Vertex} from the graph, recursively
|
||||
# removing any non-root vertices that were orphaned in the process
|
||||
# @param [String] name
|
||||
# @return [void]
|
||||
# @return [Array<Vertex>] the vertices which have been detached
|
||||
def detach_vertex_named(name)
|
||||
log.detach_vertex_named(self, name)
|
||||
end
|
||||
|
|
|
@ -14,16 +14,23 @@ module Gem::Resolver::Molinillo
|
|||
|
||||
# (see Action#up)
|
||||
def up(graph)
|
||||
return unless @vertex = graph.vertices.delete(name)
|
||||
return [] unless @vertex = graph.vertices.delete(name)
|
||||
|
||||
removed_vertices = [@vertex]
|
||||
@vertex.outgoing_edges.each do |e|
|
||||
v = e.destination
|
||||
v.incoming_edges.delete(e)
|
||||
graph.detach_vertex_named(v.name) unless v.root? || v.predecessors.any?
|
||||
if !v.root? && v.incoming_edges.empty?
|
||||
removed_vertices.concat graph.detach_vertex_named(v.name)
|
||||
end
|
||||
end
|
||||
|
||||
@vertex.incoming_edges.each do |e|
|
||||
v = e.origin
|
||||
v.outgoing_edges.delete(e)
|
||||
end
|
||||
|
||||
removed_vertices
|
||||
end
|
||||
|
||||
# (see Action#down)
|
||||
|
|
|
@ -81,6 +81,7 @@ module Gem::Resolver::Molinillo
|
|||
# @return [Boolean] whether the two vertices are equal, determined
|
||||
# by a recursive traversal of each {Vertex#successors}
|
||||
def ==(other)
|
||||
return true if equal?(other)
|
||||
shallow_eql?(other) &&
|
||||
successors.to_set == other.successors.to_set
|
||||
end
|
||||
|
@ -89,6 +90,7 @@ module Gem::Resolver::Molinillo
|
|||
# @return [Boolean] whether the two vertices are equal, determined
|
||||
# solely by {#name} and {#payload} equality
|
||||
def shallow_eql?(other)
|
||||
return true if equal?(other)
|
||||
other &&
|
||||
name == other.name &&
|
||||
payload == other.payload
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
module Gem::Resolver::Molinillo
|
||||
# The version of Gem::Resolver::Molinillo.
|
||||
VERSION = '0.5.3'.freeze
|
||||
VERSION = '0.5.5'.freeze
|
||||
end
|
||||
|
|
|
@ -194,18 +194,20 @@ module Gem::Resolver::Molinillo
|
|||
def state_index_for_unwind
|
||||
current_requirement = requirement
|
||||
existing_requirement = requirement_for_existing_name(name)
|
||||
until current_requirement.nil?
|
||||
current_state = find_state_for(current_requirement)
|
||||
return states.index(current_state) if state_any?(current_state)
|
||||
current_requirement = parent_of(current_requirement)
|
||||
index = -1
|
||||
[current_requirement, existing_requirement].each do |r|
|
||||
until r.nil?
|
||||
current_state = find_state_for(r)
|
||||
if state_any?(current_state)
|
||||
current_index = states.index(current_state)
|
||||
index = current_index if current_index > index
|
||||
break
|
||||
end
|
||||
r = parent_of(r)
|
||||
end
|
||||
end
|
||||
|
||||
until existing_requirement.nil?
|
||||
existing_state = find_state_for(existing_requirement)
|
||||
return states.index(existing_state) if state_any?(existing_state)
|
||||
existing_requirement = parent_of(existing_requirement)
|
||||
end
|
||||
-1
|
||||
index
|
||||
end
|
||||
|
||||
# @return [Object] the requirement that led to `requirement` being added
|
||||
|
@ -364,19 +366,17 @@ module Gem::Resolver::Molinillo
|
|||
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) }
|
||||
activated.detach_vertex_named(succ.name)
|
||||
|
||||
all_successor_names = succ.recursive_successors.map(&:name)
|
||||
|
||||
requirements.delete_if do |requirement|
|
||||
requirement_name = name_for(requirement)
|
||||
(requirement_name == succ.name) || all_successor_names.include?(requirement_name)
|
||||
removed_names = activated.detach_vertex_named(succ.name).map(&:name)
|
||||
requirements.delete_if do |r|
|
||||
# the only removed vertices are those with no other requirements,
|
||||
# so it's safe to delete only based upon name here
|
||||
removed_names.include?(name_for(r))
|
||||
end
|
||||
elsif !matching_deps.include?(outgoing_edge.requirement)
|
||||
activated.delete_edge(outgoing_edge)
|
||||
requirements.delete(outgoing_edge.requirement)
|
||||
end
|
||||
matching_deps.delete(outgoing_edge.requirement)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue