Merge rubygems-2.6.11
This version fixed regression of rubygems-2.6.10.
https://github.com/rubygems/rubygems/pull/1856
See details of changelogs for 2.6.11 release:
adfcf40502/History.txt (L3)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9eb94b4dc1
commit
fa59a2ea80
@ -10,7 +10,7 @@ require 'rbconfig'
|
|||||||
require 'thread'
|
require 'thread'
|
||||||
|
|
||||||
module Gem
|
module Gem
|
||||||
VERSION = "2.6.10"
|
VERSION = "2.6.11"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Must be first since it unloads the prelude from 1.9.2
|
# Must be first since it unloads the prelude from 1.9.2
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'strscan'
|
|
||||||
require 'rubygems/request_set/lockfile/parser'
|
require 'rubygems/request_set/lockfile/parser'
|
||||||
|
|
||||||
class Gem::RequestSet::Lockfile::Tokenizer
|
class Gem::RequestSet::Lockfile::Tokenizer
|
||||||
@ -58,6 +57,7 @@ class Gem::RequestSet::Lockfile::Tokenizer
|
|||||||
private
|
private
|
||||||
|
|
||||||
def tokenize input
|
def tokenize input
|
||||||
|
require 'strscan'
|
||||||
s = StringScanner.new input
|
s = StringScanner.new input
|
||||||
|
|
||||||
until s.eos? do
|
until s.eos? do
|
||||||
|
@ -4,9 +4,6 @@ require 'rubygems/exceptions'
|
|||||||
require 'rubygems/util'
|
require 'rubygems/util'
|
||||||
require 'rubygems/util/list'
|
require 'rubygems/util/list'
|
||||||
|
|
||||||
require 'uri'
|
|
||||||
require 'net/http'
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Given a set of Gem::Dependency objects as +needed+ and a way to query the
|
# Given a set of Gem::Dependency objects as +needed+ and a way to query the
|
||||||
# set of available specs via +set+, calculates a set of ActivationRequest
|
# set of available specs via +set+, calculates a set of ActivationRequest
|
||||||
@ -256,6 +253,44 @@ class Gem::Resolver
|
|||||||
@soft_missing
|
@soft_missing
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sort_dependencies(dependencies, activated, conflicts)
|
||||||
|
dependencies.sort_by do |dependency|
|
||||||
|
name = name_for(dependency)
|
||||||
|
[
|
||||||
|
activated.vertex_named(name).payload ? 0 : 1,
|
||||||
|
amount_constrained(dependency),
|
||||||
|
conflicts[name] ? 0 : 1,
|
||||||
|
activated.vertex_named(name).payload ? 0 : search_for(dependency).count,
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
SINGLE_POSSIBILITY_CONSTRAINT_PENALTY = 1_000_000
|
||||||
|
private_constant :SINGLE_POSSIBILITY_CONSTRAINT_PENALTY if defined?(private_constant)
|
||||||
|
|
||||||
|
# returns an integer \in (-\infty, 0]
|
||||||
|
# a number closer to 0 means the dependency is less constraining
|
||||||
|
#
|
||||||
|
# dependencies w/ 0 or 1 possibilities (ignoring version requirements)
|
||||||
|
# are given very negative values, so they _always_ sort first,
|
||||||
|
# before dependencies that are unconstrained
|
||||||
|
def amount_constrained(dependency)
|
||||||
|
@amount_constrained ||= {}
|
||||||
|
@amount_constrained[dependency.name] ||= begin
|
||||||
|
name_dependency = Gem::Dependency.new(dependency.name)
|
||||||
|
dependency_request_for_name = Gem::Resolver::DependencyRequest.new(name_dependency, dependency.requester)
|
||||||
|
all = @set.find_all(dependency_request_for_name).size
|
||||||
|
|
||||||
|
if all <= 1
|
||||||
|
all - SINGLE_POSSIBILITY_CONSTRAINT_PENALTY
|
||||||
|
else
|
||||||
|
search = search_for(dependency).size
|
||||||
|
search - all
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
private :amount_constrained
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -98,18 +98,27 @@ module Gem::Resolver::Molinillo
|
|||||||
"#{self.class}:#{vertices.values.inspect}"
|
"#{self.class}:#{vertices.values.inspect}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @param [Hash] options options for dot output.
|
||||||
# @return [String] Returns a dot format representation of the graph
|
# @return [String] Returns a dot format representation of the graph
|
||||||
def to_dot
|
def to_dot(options = {})
|
||||||
|
edge_label = options.delete(:edge_label)
|
||||||
|
raise ArgumentError, "Unknown options: #{options.keys}" unless options.empty?
|
||||||
|
|
||||||
dot_vertices = []
|
dot_vertices = []
|
||||||
dot_edges = []
|
dot_edges = []
|
||||||
vertices.each do |n, v|
|
vertices.each do |n, v|
|
||||||
dot_vertices << " #{n} [label=\"{#{n}|#{v.payload}}\"]"
|
dot_vertices << " #{n} [label=\"{#{n}|#{v.payload}}\"]"
|
||||||
v.outgoing_edges.each do |e|
|
v.outgoing_edges.each do |e|
|
||||||
dot_edges << " #{e.origin.name} -> #{e.destination.name} [label=\"#{e.requirement}\"]"
|
label = edge_label ? edge_label.call(e) : e.requirement
|
||||||
|
dot_edges << " #{e.origin.name} -> #{e.destination.name} [label=#{label.to_s.dump}]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
dot_vertices.uniq!
|
||||||
dot_vertices.sort!
|
dot_vertices.sort!
|
||||||
|
dot_edges.uniq!
|
||||||
dot_edges.sort!
|
dot_edges.sort!
|
||||||
|
|
||||||
dot = dot_vertices.unshift('digraph G {').push('') + dot_edges.push('}')
|
dot = dot_vertices.unshift('digraph G {').push('') + dot_edges.push('}')
|
||||||
dot.join("\n")
|
dot.join("\n")
|
||||||
end
|
end
|
||||||
@ -123,7 +132,8 @@ module Gem::Resolver::Molinillo
|
|||||||
vertices.each do |name, vertex|
|
vertices.each do |name, vertex|
|
||||||
other_vertex = other.vertex_named(name)
|
other_vertex = other.vertex_named(name)
|
||||||
return false unless other_vertex
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ module Gem::Resolver::Molinillo
|
|||||||
# (see Action#down)
|
# (see Action#down)
|
||||||
def down(graph)
|
def down(graph)
|
||||||
edge = make_edge(graph)
|
edge = make_edge(graph)
|
||||||
edge.origin.outgoing_edges.delete(edge)
|
delete_first(edge.origin.outgoing_edges, edge)
|
||||||
edge.destination.incoming_edges.delete(edge)
|
delete_first(edge.destination.incoming_edges, edge)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @!group AddEdgeNoCircular
|
# @!group AddEdgeNoCircular
|
||||||
@ -53,6 +53,13 @@ module Gem::Resolver::Molinillo
|
|||||||
@destination = destination
|
@destination = destination
|
||||||
@requirement = requirement
|
@requirement = requirement
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def delete_first(array, item)
|
||||||
|
return unless index = array.index(item)
|
||||||
|
array.delete_at(index)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -10,7 +10,7 @@ module Gem::Resolver::Molinillo
|
|||||||
# @return [Object] the payload the vertex holds
|
# @return [Object] the payload the vertex holds
|
||||||
attr_accessor :payload
|
attr_accessor :payload
|
||||||
|
|
||||||
# @return [Arrary<Object>] the explicit requirements that required
|
# @return [Array<Object>] the explicit requirements that required
|
||||||
# this vertex
|
# this vertex
|
||||||
attr_reader :explicit_requirements
|
attr_reader :explicit_requirements
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
module Gem::Resolver::Molinillo
|
module Gem::Resolver::Molinillo
|
||||||
# The version of Gem::Resolver::Molinillo.
|
# The version of Gem::Resolver::Molinillo.
|
||||||
VERSION = '0.5.5'.freeze
|
VERSION = '0.5.7'.freeze
|
||||||
end
|
end
|
||||||
|
@ -48,7 +48,7 @@ module Gem::Resolver::Molinillo
|
|||||||
if debug?
|
if debug?
|
||||||
debug_info = yield
|
debug_info = yield
|
||||||
debug_info = debug_info.inspect unless debug_info.is_a?(String)
|
debug_info = debug_info.inspect unless debug_info.is_a?(String)
|
||||||
output.puts debug_info.split("\n").map { |s| ' ' * depth + s }
|
output.puts debug_info.split("\n").map { |s| ' ' * depth + s }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ module Gem::Resolver::Molinillo
|
|||||||
@base = base
|
@base = base
|
||||||
@states = []
|
@states = []
|
||||||
@iteration_counter = 0
|
@iteration_counter = 0
|
||||||
@parent_of = {}
|
@parents_of = Hash.new { |h, k| h[k] = [] }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Resolves the {#original_requested} dependencies into a full dependency
|
# Resolves the {#original_requested} dependencies into a full dependency
|
||||||
@ -105,7 +105,7 @@ module Gem::Resolver::Molinillo
|
|||||||
|
|
||||||
handle_missing_or_push_dependency_state(initial_state)
|
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
|
resolver_ui.before_resolution
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -178,14 +178,14 @@ module Gem::Resolver::Molinillo
|
|||||||
# Unwinds the states stack because a conflict has been encountered
|
# Unwinds the states stack because a conflict has been encountered
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def unwind_for_conflict
|
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|
|
conflicts.tap do |c|
|
||||||
sliced_states = states.slice!((state_index_for_unwind + 1)..-1)
|
sliced_states = states.slice!((state_index_for_unwind + 1)..-1)
|
||||||
raise VersionConflict.new(c) unless state
|
raise VersionConflict.new(c) unless state
|
||||||
activated.rewind_to(sliced_states.first || :initial_state) if sliced_states
|
activated.rewind_to(sliced_states.first || :initial_state) if sliced_states
|
||||||
state.conflicts = c
|
state.conflicts = c
|
||||||
index = states.size - 1
|
index = states.size - 1
|
||||||
@parent_of.reject! { |_, i| i >= index }
|
@parents_of.each { |_, a| a.reject! { |i| i >= index } }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ module Gem::Resolver::Molinillo
|
|||||||
# to the list of requirements.
|
# to the list of requirements.
|
||||||
def parent_of(requirement)
|
def parent_of(requirement)
|
||||||
return unless requirement
|
return unless requirement
|
||||||
return unless index = @parent_of[requirement]
|
return unless index = @parents_of[requirement].last
|
||||||
return unless parent_state = @states[index]
|
return unless parent_state = @states[index]
|
||||||
parent_state.requirement
|
parent_state.requirement
|
||||||
end
|
end
|
||||||
@ -356,16 +356,25 @@ module Gem::Resolver::Molinillo
|
|||||||
# Ensures there are no orphaned successors to the given {vertex}.
|
# Ensures there are no orphaned successors to the given {vertex}.
|
||||||
# @param [DependencyGraph::Vertex] vertex the vertex to fix up.
|
# @param [DependencyGraph::Vertex] vertex the vertex to fix up.
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def fixup_swapped_children(vertex)
|
def fixup_swapped_children(vertex) # rubocop:disable Metrics/CyclomaticComplexity
|
||||||
payload = vertex.payload
|
payload = vertex.payload
|
||||||
deps = dependencies_for(payload).group_by(&method(:name_for))
|
deps = dependencies_for(payload).group_by(&method(:name_for))
|
||||||
vertex.outgoing_edges.each do |outgoing_edge|
|
vertex.outgoing_edges.each do |outgoing_edge|
|
||||||
@parent_of[outgoing_edge.requirement] = states.size - 1
|
requirement = outgoing_edge.requirement
|
||||||
|
parent_index = @parents_of[requirement].last
|
||||||
succ = outgoing_edge.destination
|
succ = outgoing_edge.destination
|
||||||
matching_deps = Array(deps[succ.name])
|
matching_deps = Array(deps[succ.name])
|
||||||
|
dep_matched = matching_deps.include?(requirement)
|
||||||
|
|
||||||
|
# only push the current index when it was originally required by the
|
||||||
|
# same named spec
|
||||||
|
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]
|
if matching_deps.empty? && !succ.root? && succ.predecessors.to_a == [vertex]
|
||||||
debug(depth) { "Removing orphaned spec #{succ.name} after swapping #{name}" }
|
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)
|
removed_names = activated.detach_vertex_named(succ.name).map(&:name)
|
||||||
requirements.delete_if do |r|
|
requirements.delete_if do |r|
|
||||||
@ -373,9 +382,14 @@ module Gem::Resolver::Molinillo
|
|||||||
# so it's safe to delete only based upon name here
|
# so it's safe to delete only based upon name here
|
||||||
removed_names.include?(name_for(r))
|
removed_names.include?(name_for(r))
|
||||||
end
|
end
|
||||||
elsif !matching_deps.include?(outgoing_edge.requirement)
|
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
|
||||||
|
@parents_of[requirement].push(states.size - 1) if @parents_of[requirement].empty?
|
||||||
|
|
||||||
activated.delete_edge(outgoing_edge)
|
activated.delete_edge(outgoing_edge)
|
||||||
requirements.delete(outgoing_edge.requirement)
|
requirements.delete(requirement)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -395,13 +409,18 @@ module Gem::Resolver::Molinillo
|
|||||||
# @return [Boolean] whether the current spec is satisfied as a new
|
# @return [Boolean] whether the current spec is satisfied as a new
|
||||||
# possibility.
|
# possibility.
|
||||||
def new_spec_satisfied?
|
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)
|
locked_requirement = locked_requirement_named(name)
|
||||||
requested_spec_satisfied = requirement_satisfied_by?(requirement, activated, possibility)
|
|
||||||
locked_spec_satisfied = !locked_requirement ||
|
locked_spec_satisfied = !locked_requirement ||
|
||||||
requirement_satisfied_by?(locked_requirement, activated, possibility)
|
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
|
debug(depth) { 'Unsatisfied by locked spec' } unless locked_spec_satisfied
|
||||||
requested_spec_satisfied && locked_spec_satisfied
|
|
||||||
|
locked_spec_satisfied
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param [String] requirement_name the spec name to search for
|
# @param [String] requirement_name the spec name to search for
|
||||||
@ -417,7 +436,7 @@ module Gem::Resolver::Molinillo
|
|||||||
# @return [void]
|
# @return [void]
|
||||||
def activate_spec
|
def activate_spec
|
||||||
conflicts.delete(name)
|
conflicts.delete(name)
|
||||||
debug(depth) { 'Activated ' + name + ' at ' + possibility.to_s }
|
debug(depth) { "Activated #{name} at #{possibility}" }
|
||||||
activated.set_payload(name, possibility)
|
activated.set_payload(name, possibility)
|
||||||
require_nested_dependencies_for(possibility)
|
require_nested_dependencies_for(possibility)
|
||||||
end
|
end
|
||||||
@ -432,7 +451,8 @@ module Gem::Resolver::Molinillo
|
|||||||
nested_dependencies.each do |d|
|
nested_dependencies.each do |d|
|
||||||
activated.add_child_vertex(name_for(d), nil, [name_for(activated_spec)], d)
|
activated.add_child_vertex(name_for(d), nil, [name_for(activated_spec)], d)
|
||||||
parent_index = states.size - 1
|
parent_index = states.size - 1
|
||||||
@parent_of[d] ||= parent_index
|
parents = @parents_of[d]
|
||||||
|
parents << parent_index if parents.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
push_state_for_requirements(requirements + nested_dependencies, !nested_dependencies.empty?)
|
push_state_for_requirements(requirements + nested_dependencies, !nested_dependencies.empty?)
|
||||||
|
@ -21,6 +21,7 @@ class Gem::Resolver::Set
|
|||||||
attr_accessor :prerelease
|
attr_accessor :prerelease
|
||||||
|
|
||||||
def initialize # :nodoc:
|
def initialize # :nodoc:
|
||||||
|
require 'uri'
|
||||||
@prerelease = false
|
@prerelease = false
|
||||||
@remote = true
|
@remote = true
|
||||||
@errors = []
|
@errors = []
|
||||||
@ -54,4 +55,3 @@ class Gem::Resolver::Set
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1128,9 +1128,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|||||||
native = {}
|
native = {}
|
||||||
|
|
||||||
specs.reverse_each do |spec|
|
specs.reverse_each do |spec|
|
||||||
unless spec
|
|
||||||
raise Gem::Exception, "unexpectedly spec is nil: #{specs}"
|
|
||||||
end
|
|
||||||
next if spec.version.prerelease? unless prerelease
|
next if spec.version.prerelease? unless prerelease
|
||||||
|
|
||||||
native[spec.name] = spec.version if spec.platform == Gem::Platform::RUBY
|
native[spec.name] = spec.version if spec.platform == Gem::Platform::RUBY
|
||||||
|
@ -1334,7 +1334,7 @@ Also, a list:
|
|||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# create_gemspec creates gem specification in given +direcotry+ or '.'
|
# create_gemspec creates gem specification in given +directory+ or '.'
|
||||||
# for the given +name+ and +version+.
|
# for the given +name+ and +version+.
|
||||||
#
|
#
|
||||||
# Yields the +specification+ to the block, if given
|
# Yields the +specification+ to the block, if given
|
||||||
|
@ -1443,21 +1443,24 @@ class TestGem < Gem::TestCase
|
|||||||
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
||||||
|
|
||||||
path = File.join @tempdir, "gem.deps.rb"
|
path = File.join @tempdir, "gem.deps.rb"
|
||||||
|
cmd = [Gem.ruby.dup.untaint, "-I#{LIB_PATH.untaint}", "-rubygems"]
|
||||||
|
if RUBY_VERSION < '1.9'
|
||||||
|
cmd << "-e 'puts Gem.loaded_specs.values.map(&:full_name).sort'"
|
||||||
|
cmd = cmd.join(' ')
|
||||||
|
else
|
||||||
|
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
||||||
|
end
|
||||||
|
|
||||||
File.open path, "w" do |f|
|
File.open path, "w" do |f|
|
||||||
f.puts "gem 'a'"
|
f.puts "gem 'a'"
|
||||||
end
|
end
|
||||||
out0 = IO.popen([Gem.ruby.dup.untaint, "-I#{LIB_PATH}", "-rubygems",
|
out0 = IO.popen(cmd, &:read).split(/\n/)
|
||||||
"-eputs Gem.loaded_specs.values.map(&:full_name).sort"],
|
|
||||||
&:read).split(/\n/)
|
|
||||||
|
|
||||||
File.open path, "a" do |f|
|
File.open path, "a" do |f|
|
||||||
f.puts "gem 'b'"
|
f.puts "gem 'b'"
|
||||||
f.puts "gem 'c'"
|
f.puts "gem 'c'"
|
||||||
end
|
end
|
||||||
out = IO.popen([Gem.ruby.dup.untaint, "-I#{LIB_PATH}", "-rubygems",
|
out = IO.popen(cmd, &:read).split(/\n/)
|
||||||
"-eputs Gem.loaded_specs.values.map(&:full_name).sort"],
|
|
||||||
&:read).split(/\n/)
|
|
||||||
|
|
||||||
assert_equal ["b-1", "c-1"], out - out0
|
assert_equal ["b-1", "c-1"], out - out0
|
||||||
end
|
end
|
||||||
@ -1482,21 +1485,24 @@ class TestGem < Gem::TestCase
|
|||||||
Dir.mkdir "sub1"
|
Dir.mkdir "sub1"
|
||||||
|
|
||||||
path = File.join @tempdir, "gem.deps.rb"
|
path = File.join @tempdir, "gem.deps.rb"
|
||||||
|
cmd = [Gem.ruby.dup.untaint, "-Csub1", "-I#{LIB_PATH.untaint}", "-rubygems"]
|
||||||
|
if RUBY_VERSION < '1.9'
|
||||||
|
cmd << "-e 'puts Gem.loaded_specs.values.map(&:full_name).sort'"
|
||||||
|
cmd = cmd.join(' ')
|
||||||
|
else
|
||||||
|
cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
|
||||||
|
end
|
||||||
|
|
||||||
File.open path, "w" do |f|
|
File.open path, "w" do |f|
|
||||||
f.puts "gem 'a'"
|
f.puts "gem 'a'"
|
||||||
end
|
end
|
||||||
out0 = IO.popen([Gem.ruby.dup.untaint, "-Csub1", "-I#{LIB_PATH}", "-rubygems",
|
out0 = IO.popen(cmd, &:read).split(/\n/)
|
||||||
"-eputs Gem.loaded_specs.values.map(&:full_name).sort"],
|
|
||||||
&:read).split(/\n/)
|
|
||||||
|
|
||||||
File.open path, "a" do |f|
|
File.open path, "a" do |f|
|
||||||
f.puts "gem 'b'"
|
f.puts "gem 'b'"
|
||||||
f.puts "gem 'c'"
|
f.puts "gem 'c'"
|
||||||
end
|
end
|
||||||
out = IO.popen([Gem.ruby.dup.untaint, "-Csub1", "-I#{LIB_PATH}", "-rubygems",
|
out = IO.popen(cmd, &:read).split(/\n/)
|
||||||
"-eputs Gem.loaded_specs.values.map(&:full_name).sort"],
|
|
||||||
&:read).split(/\n/)
|
|
||||||
|
|
||||||
Dir.rmdir "sub1"
|
Dir.rmdir "sub1"
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class TestGemExtRakeBuilder < Gem::TestCase
|
|||||||
assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, output
|
assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, output
|
||||||
assert_match %r%^#{Regexp.escape rake} RUBYARCHDIR=#{Regexp.escape @dest_path} RUBYLIBDIR=#{Regexp.escape @dest_path}%, output
|
assert_match %r%^#{Regexp.escape rake} RUBYARCHDIR=#{Regexp.escape @dest_path} RUBYLIBDIR=#{Regexp.escape @dest_path}%, output
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_class_build_fail
|
def test_class_build_fail
|
||||||
create_temp_mkrf_file("task :default do abort 'fail' end")
|
create_temp_mkrf_file("task :default do abort 'fail' end")
|
||||||
@ -69,7 +69,7 @@ class TestGemExtRakeBuilder < Gem::TestCase
|
|||||||
assert_match %r%^rake failed%, error.message
|
assert_match %r%^rake failed%, error.message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_temp_mkrf_file(rakefile_content)
|
def create_temp_mkrf_file(rakefile_content)
|
||||||
File.open File.join(@ext, 'mkrf_conf.rb'), 'w' do |mkrf_conf|
|
File.open File.join(@ext, 'mkrf_conf.rb'), 'w' do |mkrf_conf|
|
||||||
mkrf_conf.puts <<-EO_MKRF
|
mkrf_conf.puts <<-EO_MKRF
|
||||||
|
@ -521,11 +521,11 @@ class TestGemResolver < Gem::TestCase
|
|||||||
assert_equal req('>= 0'), dependency.requirement
|
assert_equal req('>= 0'), dependency.requirement
|
||||||
|
|
||||||
activated = e.conflict.activated
|
activated = e.conflict.activated
|
||||||
assert_equal 'c-2', activated.full_name
|
assert_equal 'c-1', activated.full_name
|
||||||
|
|
||||||
assert_equal dep('c', '>= 2'), activated.request.dependency
|
assert_equal dep('c', '= 1'), activated.request.dependency
|
||||||
|
|
||||||
assert_equal [dep('c', '= 1'), dep('c', '>= 2')],
|
assert_equal [dep('c', '>= 2'), dep('c', '= 1')],
|
||||||
e.conflict.conflicting_dependencies
|
e.conflict.conflicting_dependencies
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user