ruby-changes:51255
From: hsbt <ko1@a...>
Date: Fri, 18 May 2018 10:39:21 +0900 (JST)
Subject: [ruby-changes:51255] hsbt:r63461 (trunk): Merge RubyGems 2.7.7
hsbt 2018-05-18 10:39:13 +0900 (Fri, 18 May 2018) New Revision: 63461 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63461 Log: Merge RubyGems 2.7.7 see release details here: https://blog.rubygems.org/2018/05/18/2.7.7-released.html Modified files: trunk/lib/rubygems/bundler_version_finder.rb trunk/lib/rubygems/commands/push_command.rb trunk/lib/rubygems/commands/setup_command.rb trunk/lib/rubygems/commands/unpack_command.rb trunk/lib/rubygems/dependency.rb trunk/lib/rubygems/dependency_installer.rb trunk/lib/rubygems/exceptions.rb trunk/lib/rubygems/indexer.rb trunk/lib/rubygems/installer.rb trunk/lib/rubygems/package.rb trunk/lib/rubygems/remote_fetcher.rb trunk/lib/rubygems/request_set.rb trunk/lib/rubygems/server.rb trunk/lib/rubygems/source.rb trunk/lib/rubygems/specification.rb trunk/lib/rubygems/test_case.rb trunk/lib/rubygems/test_utilities.rb trunk/lib/rubygems/user_interaction.rb trunk/lib/rubygems/version.rb trunk/lib/rubygems.rb trunk/test/rubygems/test_gem.rb trunk/test/rubygems/test_gem_commands_setup_command.rb trunk/test/rubygems/test_gem_package.rb trunk/test/rubygems/test_gem_package_tar_header.rb trunk/test/rubygems/test_gem_remote_fetcher.rb trunk/test/rubygems/test_gem_security_policy.rb trunk/test/rubygems/test_gem_server.rb trunk/test/rubygems/test_gem_specification.rb trunk/test/rubygems/test_gem_version.rb Index: lib/rubygems/remote_fetcher.rb =================================================================== --- lib/rubygems/remote_fetcher.rb (revision 63460) +++ lib/rubygems/remote_fetcher.rb (revision 63461) @@ -293,7 +293,7 @@ class Gem::RemoteFetcher https://github.com/ruby/ruby/blob/trunk/lib/rubygems/remote_fetcher.rb#L293 if data and !head and uri.to_s =~ /\.gz$/ begin - data = Gem.gunzip data + data = Gem::Util.gunzip data rescue Zlib::GzipFile::Error raise FetchError.new("server did not return a valid file", uri.to_s) end Index: lib/rubygems/test_utilities.rb =================================================================== --- lib/rubygems/test_utilities.rb (revision 63460) +++ lib/rubygems/test_utilities.rb (revision 63461) @@ -64,7 +64,7 @@ class Gem::FakeFetcher https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_utilities.rb#L64 data.call else if path.to_s =~ /gz$/ and not data.nil? and not data.empty? then - data = Gem.gunzip data + data = Gem::Util.gunzip data end data Index: test/rubygems/test_gem_version.rb =================================================================== --- test/rubygems/test_gem_version.rb (revision 63460) +++ test/rubygems/test_gem_version.rb (revision 63461) @@ -46,6 +46,7 @@ class TestGemVersion < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_version.rb#L46 def test_class_correct assert_equal true, Gem::Version.correct?("5.1") assert_equal false, Gem::Version.correct?("an incorrect version") + assert_equal false, Gem::Version.correct?(nil) end def test_class_new_subclass Index: test/rubygems/test_gem_security_policy.rb =================================================================== --- test/rubygems/test_gem_security_policy.rb (revision 63460) +++ test/rubygems/test_gem_security_policy.rb (revision 63461) @@ -450,7 +450,7 @@ class TestGemSecurityPolicy < Gem::TestC https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_security_policy.rb#L450 @spec.cert_chain = [PUBLIC_CERT.to_s] - metadata_gz = Gem.gzip @spec.to_yaml + metadata_gz = Gem::Util.gzip @spec.to_yaml package = Gem::Package.new 'nonexistent.gem' package.checksums[Gem::Security::DIGEST_NAME] = {} @@ -473,7 +473,7 @@ class TestGemSecurityPolicy < Gem::TestC https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_security_policy.rb#L473 @spec.cert_chain = [PUBLIC_CERT.to_s] - metadata_gz = Gem.gzip @spec.to_yaml + metadata_gz = Gem::Util.gzip @spec.to_yaml package = Gem::Package.new 'nonexistent.gem' package.checksums[Gem::Security::DIGEST_NAME] = {} @@ -502,7 +502,7 @@ class TestGemSecurityPolicy < Gem::TestC https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_security_policy.rb#L502 @spec.cert_chain = [PUBLIC_CERT.to_s] - metadata_gz = Gem.gzip @spec.to_yaml + metadata_gz = Gem::Util.gzip @spec.to_yaml package = Gem::Package.new 'nonexistent.gem' package.checksums[Gem::Security::DIGEST_NAME] = {} Index: test/rubygems/test_gem_server.rb =================================================================== --- test/rubygems/test_gem_server.rb (revision 63460) +++ test/rubygems/test_gem_server.rb (revision 63461) @@ -127,7 +127,7 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_server.rb#L127 assert_match %r| \d\d:\d\d:\d\d |, @res['date'] assert_equal 'application/x-gzip', @res['content-type'] assert_equal [['a', Gem::Version.new(2), Gem::Platform::RUBY]], - Marshal.load(Gem.gunzip(@res.body)) + Marshal.load(Gem::Util.gunzip(@res.body)) end def test_listen @@ -177,7 +177,7 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_server.rb#L177 assert_match %r| \d\d:\d\d:\d\d |, @res['date'] assert_equal 'application/x-gzip', @res['content-type'] assert_equal [['a', v('3.a'), Gem::Platform::RUBY]], - Marshal.load(Gem.gunzip(@res.body)) + Marshal.load(Gem::Util.gunzip(@res.body)) end def test_quick_gemdirs @@ -236,7 +236,7 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_server.rb#L236 assert @res['date'] assert_equal 'application/x-deflate', @res['content-type'] - spec = Marshal.load Gem.inflate(@res.body) + spec = Marshal.load Gem::Util.inflate(@res.body) assert_equal 'a', spec.name assert_equal Gem::Version.new(1), spec.version end @@ -253,7 +253,7 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_server.rb#L253 assert @res['date'] assert_equal 'application/x-deflate', @res['content-type'] - spec = Marshal.load Gem.inflate(@res.body) + spec = Marshal.load Gem::Util.inflate(@res.body) assert_equal 'a', spec.name assert_equal Gem::Version.new(1), spec.version assert_equal Gem::Platform.local, spec.platform @@ -269,7 +269,7 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_server.rb#L269 assert @res['date'] assert_equal 'application/x-deflate', @res['content-type'] - spec = Marshal.load Gem.inflate(@res.body) + spec = Marshal.load Gem::Util.inflate(@res.body) assert_equal 'a', spec.name assert_equal v('3.a'), spec.version end @@ -286,7 +286,7 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_server.rb#L286 assert @res['date'] assert_equal 'application/x-deflate', @res['content-type'] - spec = Marshal.load Gem.inflate(@res.body) + spec = Marshal.load Gem::Util.inflate(@res.body) assert_equal 'a-b', spec.name assert_equal v('3.a'), spec.version end @@ -303,7 +303,7 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_server.rb#L303 assert @res['date'] assert_equal 'application/x-deflate', @res['content-type'] - spec = Marshal.load Gem.inflate(@res.body) + spec = Marshal.load Gem::Util.inflate(@res.body) assert_equal 'a-b-1', spec.name assert_equal v('3.a'), spec.version end @@ -571,7 +571,7 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_server.rb#L571 assert_equal [['a', Gem::Version.new(1), Gem::Platform::RUBY], ['a', Gem::Version.new(2), Gem::Platform::RUBY], ['a', v('3.a'), Gem::Platform::RUBY]], - Marshal.load(Gem.gunzip(@res.body)) + Marshal.load(Gem::Util.gunzip(@res.body)) end def test_uri_encode Index: test/rubygems/test_gem_remote_fetcher.rb =================================================================== --- test/rubygems/test_gem_remote_fetcher.rb (revision 63460) +++ test/rubygems/test_gem_remote_fetcher.rb (revision 63461) @@ -541,7 +541,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_remote_fetcher.rb#L541 @fetcher = fetcher def fetcher.fetch_http(uri, mtime, head = nil) - Gem.gzip 'foo' + Gem::Util.gzip 'foo' end assert_equal 'foo', fetcher.fetch_path(@uri + 'foo.gz') Index: test/rubygems/test_gem_specification.rb =================================================================== --- test/rubygems/test_gem_specification.rb (revision 63460) +++ test/rubygems/test_gem_specification.rb (revision 63461) @@ -1133,7 +1133,7 @@ dependencies: [] https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_specification.rb#L1133 def test_handles_private_null_type path = File.join DATA_PATH, "null-type.gemspec.rz" - data = Marshal.load Gem.inflate(Gem.read_binary(path)) + data = Marshal.load Gem::Util.inflate(Gem.read_binary(path)) assert_equal nil, data.rubyforge_project end Index: test/rubygems/test_gem_package.rb =================================================================== --- test/rubygems/test_gem_package.rb (revision 63460) +++ test/rubygems/test_gem_package.rb (revision 63461) @@ -524,6 +524,21 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package.rb#L524 assert_path_exists extracted end + if Gem.win_platform? + def test_extract_tar_gz_case_insensitive + package = Gem::Package.new @gem + + tgz_io = util_tar_gz do |tar| + tar.add_file 'foo/file.rb', 0644 do |io| io.write 'hi' end + end + + package.extract_tar_gz tgz_io, @destination.upcase + + extracted = File.join @destination, 'foo/file.rb' + assert_path_exists extracted + end + end + def test_install_location package = Gem::Package.new @gem @@ -607,7 +622,7 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package.rb#L622 end def test_load_spec - entry = StringIO.new Gem.gzip @spec.to_yaml + entry = StringIO.new Gem::Util.gzip @spec.to_yaml def entry.full_name() 'metadata.gz' end package = Gem::Package.new 'nonexistent.gem' @@ -637,7 +652,7 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package.rb#L652 data_tgz = data_tgz.string gem = util_tar do |tar| - metadata_gz = Gem.gzip @spec.to_yaml + metadata_gz = Gem::Util.gzip @spec.to_yaml tar.add_file 'metadata.gz', 0444 do |io| io.write metadata_gz @@ -684,7 +699,7 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package.rb#L699 data_tgz = data_tgz.string gem = util_tar do |tar| - metadata_gz = Gem.gzip @spec.to_yaml + metadata_gz = Gem::Util.gzip @spec.to_yaml tar.add_file 'metadata.gz', 0444 do |io| io.write metadata_gz @@ -721,7 +736,7 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package.rb#L736 def test_verify_corrupt tf = Tempfile.open 'corrupt' do |io| - data = Gem.gzip 'a' * 10 + data = Gem::Util.gzip 'a' * 10 io.write \ tar_file_header('metadata.gz', "\000x", 0644, data.length, Time.now) io.write data @@ -845,7 +860,7 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package.rb#L860 build.add_contents gem # write bogus data.tar.gz to foil signature - bogus_data = Gem.gzip 'hello' + bogus_data = Gem::Util.gzip 'hello' fake_signer = Class.new do def digest_name; 'SHA512'; end def digest_algorithm; Digest(:SHA512); end @@ -903,6 +918,40 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package.rb#L918 end assert_equal "package is corrupt, exception while verifying: whatever (ArgumentError) in #{@gem}", e.message + + valid_metadata = ["metadata", "metadata.gz"] + valid_metadata.each do |vm| + $spec_loaded = false + $good_name = vm + + entry = Object.new + def entry.full_name() $good_name end + + package = Gem::Package.new(@gem) + package.instance_variable_set(:@files, []) + def package.load_spec(entry) $spec_loaded = true end + + package.verify_entry(entry) + + assert $spec_loaded + end + + invalid_metadata = ["metadataxgz", "foobar\nmetadata", "metadata\nfoobar"] + invalid_metadata.each do |vm| + $spec_loaded = false + $bad_name = vm + + entry = Object.new + def entry.full_name() $bad_name end + + package = Gem::Package.new(@gem) + package.instance_variable_set(:@files, []) + def package.load_spec(entry) $spec_loaded = true end + + package.verify_entry(entry) + + refute $spec_loaded + end end def test_spec Index: test/rubygems/test_gem_commands_setup_command.rb =================================================================== --- test/rubygems/test_gem_commands_setup_command.rb (revision 63460) +++ test/rubygems/test_gem_commands_setup_command.rb (revision 63461) @@ -10,7 +10,7 @@ class TestGemCommandsSetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_setup_command.rb#L10 if File.exist?(bundler_gemspec) BUNDLER_VERS = File.read(bundler_gemspec).match(/VERSION = "(#{Gem::Version::VERSION_PATTERN})"/)[1] else - BUNDLER_VERS = "1.16.1" + BUNDLER_VERS = "1.16.2" end def setup Index: test/rubygems/test_gem.rb =================================================================== --- test/rubygems/test_gem.rb (revision 63460) +++ test/rubygems/test_gem.rb (revision 63461) @@ -387,7 +387,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L387 assert_equal %w[https://rubygems.org/], Gem.default_sources end - def test_self_detect_gemdeps + def test_self_use_gemdeps skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7" rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-' @@ -399,7 +399,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L399 begin Dir.chdir 'detect/a/b' - assert_equal add_bundler_full_name([]), Gem.detect_gemdeps.map(&:full_name) + assert_equal add_bundler_full_name([]), Gem.use_gemdeps.map(&:full_name) ensure Dir.chdir @tempdir end @@ -1214,7 +1214,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1214 input = "\x1F\x8B\b\0\xED\xA3\x1AQ\0\x03\xCBH" + "\xCD\xC9\xC9\a\0\x86\xA6\x106\x05\0\0\0" - output = Gem.gunzip input + output = Gem::Util.gunzip input assert_equal 'hello', output @@ -1226,7 +1226,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1226 def test_self_gzip input = 'hello' - output = Gem.gzip input + output = Gem::Util.gzip input zipped = StringIO.new output @@ -1450,12 +1450,12 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1450 ENV['RUBYGEMS_GEMDEPS'] = path - Gem.detect_gemdeps + Gem.use_gemdeps assert_equal add_bundler_full_name(%W(a-1 b-1 c-1)), loaded_spec_names end - def test_auto_activation_of_detected_gemdeps_file + def test_auto_activation_of_used_gemdeps_file skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7" util_clear_gems @@ -1476,7 +1476,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1476 ENV['RUBYGEMS_GEMDEPS'] = "-" expected_specs = [a, b, (Gem::USE_BUNDLER_FOR_GEMDEPS || nil) && util_spec("bundler", Bundler::VERSION), c].compact - assert_equal expected_specs, Gem.detect_gemdeps.sort_by { |s| s.name } + assert_equal expected_specs, Gem.use_gemdeps.sort_by { |s| s.name } end LIB_PATH = File.expand_path "../../../lib".dup.untaint, __FILE__.dup.untaint Index: test/rubygems/test_gem_package_tar_header.rb =================================================================== --- test/rubygems/test_gem_package_tar_header.rb (revision 63460) +++ test/rubygems/test_gem_package_tar_header.rb (revision 63461) @@ -158,7 +158,7 @@ group\000\000\000\000\000\000\000\000\00 https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package_tar_header.rb#L158 header_s[124, 12] = val io = TempIO.new header_s assert_raises ArgumentError do - new_header = Gem::Package::TarHeader.from io + Gem::Package::TarHeader.from io end io.close! if io.respond_to? :close! end Index: lib/rubygems/user_interaction.rb =================================================================== --- lib/rubygems/user_interaction.rb (revision 63460) +++ lib/rubygems/user_interaction.rb (revision 63461) @@ -6,6 +6,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/user_interaction.rb#L6 #++ require 'rubygems/util' +require 'rubygems/deprecate' ## # Module that defines the default UserInteraction. Any class including this @@ -170,6 +171,8 @@ end https://github.com/ruby/ruby/blob/trunk/lib/rubygems/user_interaction.rb#L171 class Gem::StreamUI + extend Gem::Deprecate + ## # The input stream @@ -384,6 +387,7 @@ class Gem::StreamUI https://github.com/ruby/ruby/blob/trunk/lib/rubygems/user_interaction.rb#L387 def debug(statement) @errs.puts statement end + deprecate :debug, :none, 2018, 12 ## # Terminate the application with exit code +status+, running any exit Index: lib/rubygems/specification.rb =================================================================== --- lib/rubygems/specification.rb (revision 63460) +++ lib/rubygems/specification.rb (revision 63461) @@ -40,6 +40,8 @@ require 'uri' https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L40 class Gem::Specification < Gem::BasicSpecification + extend Gem::Deprecate + # REFACTOR: Consider breaking out this version stuff into a separate # module. There's enough special stuff around it that it may justify # a separate class. @@ -715,6 +717,7 @@ class Gem::Specification < Gem::BasicSpe https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L717 # Deprecated: You must now specify the executable name to Gem.bin_path. attr_writer :default_executable + deprecate :default_executable=, :none, 2018, 12 ## # Allows deinstallation of gems with legacy platforms. @@ -1810,6 +1813,7 @@ class Gem::Specification < Gem::BasicSpe https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1813 end result end + deprecate :default_executable, :none, 2018, 12 ## # The default value for specification attribute +name+ @@ -2018,6 +2022,7 @@ class Gem::Specification < Gem::BasicSpe https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L2022 def has_rdoc # :nodoc: true end + deprecate :has_rdoc, :none, 2018, 12 ## # Deprecated and ignored. @@ -2027,8 +2032,10 @@ class Gem::Specification < Gem::BasicSpe https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L2032 def has_rdoc= ignored # :nodoc: @has_rdoc = true end + deprecate :has_rdoc=, :none, 2018, 12 alias :has_rdoc? :has_rdoc # :nodoc: + deprecate :has_rdoc?, :none, 2018, 12 ## # True if this gem has files in test_files @@ -3074,16 +3081,6 @@ open-ended dependency on #{dep} is not r https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L3081 @require_paths end - extend Gem::Deprecate - - # TODO: - # deprecate :has_rdoc, :none, 2011, 10 - # deprecate :has_rdoc?, :none, 2011, 10 - # deprecate :has_rdoc=, :none, 2011, 10 - # deprecate :default_executable, :none, 2011, 10 - # deprecate :default_executable=, :none, 2011, 10 - # deprecate :file_name, :cache_file, 2011, 10 - # deprecate :full_gem_path, :cache_file, 2011, 10 end # DOC: What is this and why is it here, randomly, at the end of this file? Index: lib/rubygems/version.rb =================================================================== --- lib/rubygems/version.rb (revision 63460) +++ lib/rubygems/version.rb (revision 63461) @@ -170,6 +170,7 @@ class Gem::Version https://github.com/ruby/ruby/blob/trunk/lib/rubygems/version.rb#L170 # True if the +version+ string matches RubyGems' requirements. def self.correct? version + return false if version.nil? !!(version.to_s =~ AN (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/