1 [PATCH] bump rubygems to 2.6.12
3 Downloaded from upstream:
4 https://bugs.ruby-lang.org/attachments/download/6692/rubygems-2612-ruby24.patch
6 And converted to patch-p1.
8 Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
9 diff --git a/lib/rubygems.rb b/lib/rubygems.rb
10 index 5cd1a4c47a..bc5bf9b4c2 100644
21 # Must be first since it unloads the prelude from 1.9.2
22 @@ -234,6 +234,7 @@ def self.needs
24 def self.finish_resolve(request_set=Gem::RequestSet.new)
25 request_set.import Gem::Specification.unresolved_deps.values
26 + request_set.import Gem.loaded_specs.values.map {|s| Gem::Dependency.new(s.name, s.version) }
28 request_set.resolve_current.each do |s|
30 diff --git a/lib/rubygems/commands/open_command.rb b/lib/rubygems/commands/open_command.rb
31 index a89b7421e3..059635e835 100644
32 --- a/lib/rubygems/commands/open_command.rb
33 +++ b/lib/rubygems/commands/open_command.rb
34 @@ -72,7 +72,7 @@ def open_editor path
38 - spec = Gem::Specification.find_all_by_name(name, @version).last
39 + spec = Gem::Specification.find_all_by_name(name, @version).first
43 diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
44 index f25d120b88..70f8127292 100644
45 --- a/lib/rubygems/commands/query_command.rb
46 +++ b/lib/rubygems/commands/query_command.rb
47 @@ -86,7 +86,7 @@ def execute
48 name = Array(options[:name])
50 args = options[:args].to_a
51 - name = options[:exact] ? args : args.map{|arg| /#{arg}/i }
52 + name = options[:exact] ? args.map{|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map{|arg| /#{arg}/i }
55 prerelease = options[:prerelease]
56 diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb
57 index 9832afd214..7e46963a4c 100644
58 --- a/lib/rubygems/commands/sources_command.rb
59 +++ b/lib/rubygems/commands/sources_command.rb
60 @@ -44,7 +44,7 @@ def add_source source_uri # :nodoc:
61 source = Gem::Source.new source_uri
64 - if Gem.sources.include? source_uri then
65 + if Gem.sources.include? source then
66 say "source #{source_uri} already present in the cache"
68 source.load_specs :released
69 diff --git a/lib/rubygems/dependency_list.rb b/lib/rubygems/dependency_list.rb
70 index 35fe7c4c1a..d8314eaf60 100644
71 --- a/lib/rubygems/dependency_list.rb
72 +++ b/lib/rubygems/dependency_list.rb
73 @@ -104,7 +104,7 @@ def find_name(full_name)
77 - "#<%s:0x%x %p>" % [self.class, object_id, map { |s| s.full_name }]
78 + "%s %p>" % [super[0..-2], map { |s| s.full_name }]
82 diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
83 index f4d3e728de..967543c2d1 100644
84 --- a/lib/rubygems/installer.rb
85 +++ b/lib/rubygems/installer.rb
86 @@ -214,7 +214,7 @@ def check_executable_overwrite filename # :nodoc:
88 ruby_executable = true
89 existing = io.read.slice(%r{
93 load \s Gem\.bin_path\( |
94 load \s Gem\.activate_bin_path\(
95 @@ -701,6 +701,8 @@ def verify_gem_home(unpack = false) # :nodoc:
96 # Return the text for an application file.
98 def app_script_text(bin_file_name)
99 + # note that the `load` lines cannot be indented, as old RG versions match
100 + # against the beginning of the line
102 #{shebang bin_file_name}
104 @@ -723,7 +725,12 @@ def app_script_text(bin_file_name)
108 +if Gem.respond_to?(:activate_bin_path)
109 load Gem.activate_bin_path('#{spec.name}', '#{bin_file_name}', version)
111 +gem #{spec.name.dump}, version
112 +load Gem.bin_path(#{spec.name.dump}, #{bin_file_name.dump}, version)
117 diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
118 index d22d91ae54..2dd9ed5782 100644
119 --- a/lib/rubygems/platform.rb
120 +++ b/lib/rubygems/platform.rb
121 @@ -112,7 +112,7 @@ def initialize(arch)
125 - "#<%s:0x%x @cpu=%p, @os=%p, @version=%p>" % [self.class, object_id, *to_a]
126 + "%s @cpu=%p, @os=%p, @version=%p>" % [super[0..-2], *to_a]
130 diff --git a/lib/rubygems/security.rb b/lib/rubygems/security.rb
131 index 119d6d56f7..6963ca156f 100644
132 --- a/lib/rubygems/security.rb
133 +++ b/lib/rubygems/security.rb
134 @@ -455,7 +455,7 @@ def self.create_cert_self_signed subject, key, age = ONE_YEAR,
137 # Creates a new key pair of the specified +length+ and +algorithm+. The
138 - # default is a 2048 bit RSA key.
139 + # default is a 3072 bit RSA key.
141 def self.create_key length = KEY_LENGTH, algorithm = KEY_ALGORITHM
143 diff --git a/lib/rubygems/server.rb b/lib/rubygems/server.rb
144 index 81df0e608e..df4eb566d3 100644
145 --- a/lib/rubygems/server.rb
146 +++ b/lib/rubygems/server.rb
147 @@ -657,7 +657,7 @@ def root(req, res)
148 "only_one_executable" => true,
149 "full_name" => "rubygems-#{Gem::VERSION}",
151 - "homepage" => "http://docs.rubygems.org/",
152 + "homepage" => "http://guides.rubygems.org/",
153 "name" => 'rubygems',
154 "ri_installed" => true,
155 "summary" => "RubyGems itself",
156 diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
157 index a2f289d162..500f0af768 100644
158 --- a/lib/rubygems/specification.rb
159 +++ b/lib/rubygems/specification.rb
160 @@ -2105,7 +2105,7 @@ def inspect # :nodoc:
164 - "#<#{self.class}:0x#{__id__.to_s(16)} #{full_name}>"
165 + "#{super[0..-2]} #{full_name}>"
169 diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
170 index 86b68e1efb..4e48f1eb4c 100644
171 --- a/lib/rubygems/test_case.rb
172 +++ b/lib/rubygems/test_case.rb
173 @@ -484,7 +484,7 @@ def git_gem name = 'a', version = 1
175 system @git, 'add', gemspec
176 system @git, 'commit', '-a', '-m', 'a non-empty commit message', '--quiet'
177 - head = Gem::Util.popen('git', 'rev-parse', 'master').strip
178 + head = Gem::Util.popen(@git, 'rev-parse', 'master').strip
181 return name, git_spec.version, directory, head
182 @@ -1498,6 +1498,8 @@ def self.key_path key_name
187 + require 'rubygems/rdoc'
188 rescue LoadError, Gem::LoadError
191 @@ -1514,3 +1516,4 @@ def self.key_path key_name
193 END {tmpdirs.each {|dir| Dir.rmdir(dir)} if $$ == pid}
195 +Gem.loaded_specs.clear
196 diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
197 index a605f9cdfe..62b36dfd41 100644
198 --- a/test/rubygems/test_gem.rb
199 +++ b/test/rubygems/test_gem.rb
200 @@ -75,6 +75,29 @@ def test_self_finish_resolve_wtf
204 + def test_self_finish_resolve_respects_loaded_specs
205 + save_loaded_features do
206 + a1 = new_spec "a", "1", "b" => "> 0"
207 + b1 = new_spec "b", "1", "c" => ">= 1"
208 + b2 = new_spec "b", "2", "c" => ">= 2"
209 + c1 = new_spec "c", "1"
210 + c2 = new_spec "c", "2"
212 + install_specs c1, c2, b1, b2, a1
217 + assert_equal %w(a-1 c-1), loaded_spec_names
218 + assert_equal ["b (> 0)"], unresolved_names
222 + assert_equal %w(a-1 b-1 c-1), loaded_spec_names
223 + assert_equal [], unresolved_names
227 def test_self_install
230 @@ -492,7 +515,7 @@ def test_self_find_files_with_gemfile
231 skip if RUBY_VERSION <= "1.8.7"
233 cwd = File.expand_path("test/rubygems", @@project_dir)
234 - $LOAD_PATH.unshift cwd
235 + actual_load_path = $LOAD_PATH.unshift(cwd).dup
237 discover_path = File.join 'lib', 'sff', 'discover.rb'
239 @@ -518,12 +541,12 @@ def test_self_find_files_with_gemfile
241 File.expand_path('test/rubygems/sff/discover.rb', @@project_dir),
242 File.join(foo1.full_gem_path, discover_path)
246 - assert_equal expected, Gem.find_files('sff/discover')
247 - assert_equal expected, Gem.find_files('sff/**.rb'), '[ruby-core:31730]'
248 + assert_equal expected, Gem.find_files('sff/discover').sort
249 + assert_equal expected, Gem.find_files('sff/**.rb').sort, '[ruby-core:31730]'
251 - assert_equal cwd, $LOAD_PATH.shift unless RUBY_VERSION <= "1.8.7"
252 + assert_equal cwd, actual_load_path.shift unless RUBY_VERSION <= "1.8.7"
255 def test_self_find_latest_files
256 diff --git a/test/rubygems/test_gem_commands_open_command.rb b/test/rubygems/test_gem_commands_open_command.rb
257 index 3ec38972e6..a96fa6ea23 100644
258 --- a/test/rubygems/test_gem_commands_open_command.rb
259 +++ b/test/rubygems/test_gem_commands_open_command.rb
260 @@ -24,7 +24,8 @@ def test_execute
261 @cmd.options[:args] = %w[foo]
262 @cmd.options[:editor] = "#{Gem.ruby} -e0 --"
266 + spec = gem 'foo', '1.0.1'
267 mock = MiniTest::Mock.new
268 mock.expect(:call, true, [spec.full_gem_path])
270 diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb
271 index 223f205b2d..d8d682b136 100644
272 --- a/test/rubygems/test_gem_commands_query_command.rb
273 +++ b/test/rubygems/test_gem_commands_query_command.rb
274 @@ -642,7 +642,7 @@ def test_execute_local_details
275 assert_equal expected, @ui.output
278 - def test_execute_exact
279 + def test_execute_exact_remote
280 spec_fetcher do |fetcher|
281 fetcher.spec 'coolgem-omg', 3
282 fetcher.spec 'coolgem', '4.2.1'
283 @@ -665,6 +665,60 @@ def test_execute_exact
284 assert_equal expected, @ui.output
287 + def test_execute_exact_local
288 + spec_fetcher do |fetcher|
289 + fetcher.spec 'coolgem-omg', 3
290 + fetcher.spec 'coolgem', '4.2.1'
291 + fetcher.spec 'wow_coolgem', 1
294 + @cmd.handle_options %w[--exact coolgem]
307 + assert_equal expected, @ui.output
310 + def test_execute_exact_multiple
311 + spec_fetcher do |fetcher|
312 + fetcher.spec 'coolgem-omg', 3
313 + fetcher.spec 'coolgem', '4.2.1'
314 + fetcher.spec 'wow_coolgem', 1
316 + fetcher.spec 'othergem-omg', 3
317 + fetcher.spec 'othergem', '1.2.3'
318 + fetcher.spec 'wow_othergem', 1
321 + @cmd.handle_options %w[--exact coolgem othergem]
338 + assert_equal expected, @ui.output
343 def add_gems_to_fetcher
344 diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb
345 index 014b4b4c12..d5b6d99419 100644
346 --- a/test/rubygems/test_gem_commands_sources_command.rb
347 +++ b/test/rubygems/test_gem_commands_sources_command.rb
348 @@ -108,6 +108,58 @@ def test_execute_add_redundant_source
349 assert_equal '', @ui.error
352 + def test_execute_add_redundant_source_trailing_slash
353 + # Remove pre-existing gem source (w/ slash)
354 + repo_with_slash = "http://gems.example.com/"
355 + @cmd.handle_options %W[--remove #{repo_with_slash}]
359 + source = Gem::Source.new repo_with_slash
360 + assert_equal false, Gem.sources.include?(source)
363 +#{repo_with_slash} removed from sources
366 + assert_equal expected, @ui.output
367 + assert_equal '', @ui.error
369 + # Re-add pre-existing gem source (w/o slash)
370 + repo_without_slash = "http://gems.example.com"
371 + @cmd.handle_options %W[--add #{repo_without_slash}]
375 + source = Gem::Source.new repo_without_slash
376 + assert_equal true, Gem.sources.include?(source)
379 +http://gems.example.com/ removed from sources
380 +http://gems.example.com added to sources
383 + assert_equal expected, @ui.output
384 + assert_equal '', @ui.error
386 + # Re-add original gem source (w/ slash)
387 + @cmd.handle_options %W[--add #{repo_with_slash}]
391 + source = Gem::Source.new repo_with_slash
392 + assert_equal true, Gem.sources.include?(source)
395 +http://gems.example.com/ removed from sources
396 +http://gems.example.com added to sources
397 +source http://gems.example.com/ already present in the cache
400 + assert_equal expected, @ui.output
401 + assert_equal '', @ui.error
404 def test_execute_add_http_rubygems_org
405 http_rubygems_org = 'http://rubygems.org'
407 diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
408 index 6ceb2c6dfc..882981d344 100644
409 --- a/test/rubygems/test_gem_installer.rb
410 +++ b/test/rubygems/test_gem_installer.rb
411 @@ -62,7 +62,12 @@ def test_app_script_text
415 +if Gem.respond_to?(:activate_bin_path)
416 load Gem.activate_bin_path('a', 'executable', version)
419 +load Gem.bin_path("a", "executable", version)
423 wrapper = @installer.app_script_text 'executable'
424 diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb
425 index dd606e44d4..936f78fb2a 100644
426 --- a/test/rubygems/test_require.rb
427 +++ b/test/rubygems/test_require.rb
428 @@ -301,6 +301,17 @@ def test_default_gem_only
429 assert_equal %w(default-2.0.0.0), loaded_spec_names
432 + def test_realworld_default_gem
433 + skip "no default gems on ruby < 2.0" unless RUBY_VERSION >= "2"
437 + puts Gem.loaded_specs["json"].default_gem?
439 + output = Gem::Util.popen(Gem.ruby, "-e", cmd).strip
440 + assert_equal "true", output
443 def test_default_gem_and_normal_gem
444 default_gem_spec = new_default_spec("default", "2.0.0.0",
445 nil, "default/gem.rb")