ruby-changes:30065
From: nagachika <ko1@a...>
Date: Tue, 23 Jul 2013 01:33:42 +0900 (JST)
Subject: [ruby-changes:30065] nagachika:r42117 (ruby_2_0_0): * lib/rubygems: Update to RubyGems 2.0.5.
nagachika 2013-07-23 01:33:18 +0900 (Tue, 23 Jul 2013) New Revision: 42117 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42117 Log: * lib/rubygems: Update to RubyGems 2.0.5. The patch provided by drbrain (Eric Hodel). [ruby-core:55896] [Backport #8617] * test/rubygems: Tests for the above. Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/lib/rubygems/commands/help_command.rb branches/ruby_2_0_0/lib/rubygems/commands/list_command.rb branches/ruby_2_0_0/lib/rubygems/commands/owner_command.rb branches/ruby_2_0_0/lib/rubygems/commands/pristine_command.rb branches/ruby_2_0_0/lib/rubygems/commands/push_command.rb branches/ruby_2_0_0/lib/rubygems/commands/search_command.rb branches/ruby_2_0_0/lib/rubygems/commands/setup_command.rb branches/ruby_2_0_0/lib/rubygems/commands/specification_command.rb branches/ruby_2_0_0/lib/rubygems/commands/update_command.rb branches/ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb branches/ruby_2_0_0/lib/rubygems/defaults.rb branches/ruby_2_0_0/lib/rubygems/dependency_installer.rb branches/ruby_2_0_0/lib/rubygems/dependency_resolver.rb branches/ruby_2_0_0/lib/rubygems/errors.rb branches/ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb branches/ruby_2_0_0/lib/rubygems/gemcutter_utilities.rb branches/ruby_2_0_0/lib/rubygems/installer.rb branches/ruby_2_0_0/lib/rubygems/package/old.rb branches/ruby_2_0_0/lib/rubygems/package.rb branches/ruby_2_0_0/lib/rubygems/platform.rb branches/ruby_2_0_0/lib/rubygems/psych_tree.rb branches/ruby_2_0_0/lib/rubygems/specification.rb branches/ruby_2_0_0/lib/rubygems.rb branches/ruby_2_0_0/test/rubygems/test_gem.rb branches/ruby_2_0_0/test/rubygems/test_gem_commands_help_command.rb branches/ruby_2_0_0/test/rubygems/test_gem_commands_owner_command.rb branches/ruby_2_0_0/test/rubygems/test_gem_commands_push_command.rb branches/ruby_2_0_0/test/rubygems/test_gem_commands_search_command.rb branches/ruby_2_0_0/test/rubygems/test_gem_commands_setup_command.rb branches/ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb branches/ruby_2_0_0/test/rubygems/test_gem_gemcutter_utilities.rb branches/ruby_2_0_0/test/rubygems/test_gem_installer.rb branches/ruby_2_0_0/test/rubygems/test_gem_package.rb branches/ruby_2_0_0/test/rubygems/test_gem_spec_fetcher.rb branches/ruby_2_0_0/test/rubygems/test_gem_specification.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 42116) +++ ruby_2_0_0/ChangeLog (revision 42117) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Tue Jul 23 01:28:54 2013 CHIKANAGA Tomoyuki <nagachika@r...> + + * lib/rubygems: Update to RubyGems 2.0.5. + The patch provided by drbrain (Eric Hodel). [ruby-core:55896] + [Backport #8617] + + * test/rubygems: Tests for the above. + Tue Jul 23 00:00:27 2013 Nobuyoshi Nakada <nobu@r...> * vm_eval.c (eval_string_with_cref): use the given file name unless Index: ruby_2_0_0/lib/rubygems/gemcutter_utilities.rb =================================================================== --- ruby_2_0_0/lib/rubygems/gemcutter_utilities.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/gemcutter_utilities.rb (revision 42117) @@ -38,7 +38,7 @@ module Gem::GemcutterUtilities https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/gemcutter_utilities.rb#L38 say "Enter your #{pretty_host} credentials." say "Don't have an account yet? " + - "Create one at https://#{sign_in_host}/sign_up" + "Create one at #{sign_in_host}/sign_up" email = ask " Email: " password = ask_for_password "Password: " @@ -60,7 +60,14 @@ module Gem::GemcutterUtilities https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/gemcutter_utilities.rb#L60 configured_host = Gem.host unless Gem.configuration.disable_default_gem_server - @host ||= ENV['RUBYGEMS_HOST'] || configured_host + @host ||= + begin + env_rubygems_host = ENV['RUBYGEMS_HOST'] + env_rubygems_host = nil if + env_rubygems_host and env_rubygems_host.empty? + + env_rubygems_host|| configured_host + end end def rubygems_api_request(method, path, host = nil, &block) @@ -79,7 +86,7 @@ module Gem::GemcutterUtilities https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/gemcutter_utilities.rb#L86 Gem::RemoteFetcher.fetcher.request(uri, request_method, &block) end - def with_response(resp) + def with_response resp, error_prefix = nil case resp when Net::HTTPSuccess then if block_given? then @@ -88,7 +95,10 @@ module Gem::GemcutterUtilities https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/gemcutter_utilities.rb#L95 say resp.body end else - say resp.body + message = resp.body + message = "#{error_prefix}: #{message}" if error_prefix + + say message terminate_interaction 1 # TODO: question this end end Index: ruby_2_0_0/lib/rubygems/dependency_installer.rb =================================================================== --- ruby_2_0_0/lib/rubygems/dependency_installer.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/dependency_installer.rb (revision 42117) @@ -63,7 +63,6 @@ class Gem::DependencyInstaller https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/dependency_installer.rb#L63 # HACK shouldn't change the global settings, needed for -i behavior # maybe move to the install command? See also github #442 Gem::Specification.dirs = @install_dir - Gem.ensure_gem_subdirectories @install_dir end options = DEFAULT_OPTIONS.merge options Index: ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb =================================================================== --- ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb (revision 42117) @@ -15,7 +15,9 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb#L15 def self.build(extension, directory, dest_path, results, args=[]) tmp_dest = Dir.mktmpdir(".gem.", ".") + t = nil Tempfile.open %w"siteconf .rb", "." do |siteconf| + t = siteconf siteconf.puts "require 'rbconfig'" siteconf.puts "dest_path = #{(tmp_dest || dest_path).dump}" %w[sitearchdir sitelibdir].each do |dir| @@ -37,6 +39,8 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb#L39 run cmd, results ENV["DESTDIR"] = nil + ENV["RUBYOPT"] = rubyopt + siteconf.unlink make dest_path, results @@ -53,6 +57,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb#L57 ENV["DESTDIR"] = destdir end end + t.unlink if t and t.path ensure FileUtils.rm_rf tmp_dest if tmp_dest end Index: ruby_2_0_0/lib/rubygems/dependency_resolver.rb =================================================================== --- ruby_2_0_0/lib/rubygems/dependency_resolver.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/dependency_resolver.rb (revision 42117) @@ -349,7 +349,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/dependency_resolver.rb#L349 when Dependency @dependency == other when DependencyRequest - @dependency == other.dep && @requester == other.requester + @dependency == other.dependency && @requester == other.requester else false end Index: ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb =================================================================== --- ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb (revision 42117) @@ -4,6 +4,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb#L4 # See LICENSE.txt for permissions. #++ +require 'monitor' + module Kernel if defined?(gem_original_require) then @@ -31,7 +33,11 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb#L33 # The normal <tt>require</tt> functionality of returning false if # that file has already been loaded is preserved. + ACTIVATION_MONITOR = Monitor.new + def require path + ACTIVATION_MONITOR.enter + spec = Gem.find_unresolved_default_spec(path) if spec Gem.remove_unresolved_default_spec(spec) @@ -111,6 +117,8 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb#L117 end raise load_error + ensure + ACTIVATION_MONITOR.exit end private :require Index: ruby_2_0_0/lib/rubygems/errors.rb =================================================================== --- ruby_2_0_0/lib/rubygems/errors.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/errors.rb (revision 42117) @@ -62,10 +62,10 @@ module Gem https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/errors.rb#L62 ## # A wordy description of the error. def wordy - "Found %s (%), but was for platform%s %s" % + "Found %s (%s), but was for platform%s %s" % [@name, @version, - @platforms.size == 1 ? 's' : '', + @platforms.size == 1 ? '' : 's', @platforms.join(' ,')] end end Index: ruby_2_0_0/lib/rubygems/specification.rb =================================================================== --- ruby_2_0_0/lib/rubygems/specification.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/specification.rb (revision 42117) @@ -5,6 +5,17 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L5 # See LICENSE.txt for permissions. #++ +require 'rubygems/version' +require 'rubygems/requirement' +require 'rubygems/platform' +require 'rubygems/deprecate' + +# :stopdoc: +# date.rb can't be loaded for `make install` due to miniruby +# Date is needed for old gems that stored #date as Date instead of Time. +class Date; end +# :startdoc: + ## # The Specification class contains the information for a Gem. Typically # defined in a .gemspec file or a Rakefile, and looks like this: @@ -20,32 +31,19 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L31 # s.homepage = 'https://rubygems.org/gems/example' # end # -# Starting in RubyGems 1.9.0, a Specification can hold arbitrary -# metadata. This metadata is accessed via Specification#metadata -# and has the following restrictions: +# Starting in RubyGems 1.9.0, a Specification can hold arbitrary +# metadata. This metadata is accessed via Specification#metadata +# and has the following restrictions: # -# * Must be a Hash object -# * All keys and values must be Strings -# * Keys can be a maximum of 128 bytes and values can be a -# maximum of 1024 bytes -# * All strings must be UTF8, no binary data is allowed +# * Must be a Hash object +# * All keys and values must be Strings +# * Keys can be a maximum of 128 bytes and values can be a +# maximum of 1024 bytes +# * All strings must be UTF8, no binary data is allowed # -# For example, to add metadata for the location of a bugtracker: +# For example, to add metadata for the location of a bugtracker: # # s.metadata = { "bugtracker" => "http://somewhere.com/blah" } -# - - -require 'rubygems/version' -require 'rubygems/requirement' -require 'rubygems/platform' -require 'rubygems/deprecate' - -# :stopdoc: -# date.rb can't be loaded for `make install` due to miniruby -# Date is needed for old gems that stored #date as Date instead of Time. -class Date; end -# :startdoc: class Gem::Specification @@ -918,7 +916,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L916 result = Hash.new { |h,k| h[k] = {} } native = {} - Gem::Specification._all.reverse_each do |spec| + Gem::Specification.reverse_each do |spec| next if spec.version.prerelease? unless prerelease native[spec.name] = spec.version if spec.platform == Gem::Platform::RUBY @@ -995,7 +993,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L993 # TODO: maybe we should switch to rubygems' version service? fetcher = Gem::SpecFetcher.fetcher - latest_specs.each do |local| + latest_specs(true).each do |local| dependency = Gem::Dependency.new local.name, ">= #{local.version}" remotes, _ = fetcher.search_for_dependency dependency remotes = remotes.map { |n, _| n.version } @@ -1236,7 +1234,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L1234 unless dependency.respond_to?(:name) && dependency.respond_to?(:version_requirements) - dependency = Gem::Dependency.new(dependency, requirements, type) + dependency = Gem::Dependency.new(dependency.to_s, requirements, type) end dependencies << dependency @@ -2270,7 +2268,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L2268 require 'rubygems/psych_tree' end - builder = Gem::NoAliasYAMLTree.new({}) + builder = Gem::NoAliasYAMLTree.create builder << self ast = builder.tree Index: ruby_2_0_0/lib/rubygems/platform.rb =================================================================== --- ruby_2_0_0/lib/rubygems/platform.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/platform.rb (revision 42117) @@ -74,6 +74,7 @@ class Gem::Platform https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/platform.rb#L74 when /hpux(\d+)?/ then [ 'hpux', $1 ] when /^java$/, /^jruby$/ then [ 'java', nil ] when /^java([\d.]*)/ then [ 'java', $1 ] + when /^dalvik(\d+)?$/ then [ 'dalvik', $1 ] when /^dotnet$/ then [ 'dotnet', nil ] when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ] when /linux/ then [ 'linux', $1 ] @@ -155,6 +156,7 @@ class Gem::Platform https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/platform.rb#L156 when /^i686-darwin(\d)/ then ['x86', 'darwin', $1 ] when /^i\d86-linux/ then ['x86', 'linux', nil ] when 'java', 'jruby' then [nil, 'java', nil ] + when /^dalvik(\d+)?$/ then [nil, 'dalvik', $1 ] when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet', $2 ] when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2 ] when 'powerpc-darwin' then ['powerpc', 'darwin', nil ] Index: ruby_2_0_0/lib/rubygems/package/old.rb =================================================================== --- ruby_2_0_0/lib/rubygems/package/old.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/package/old.rb (revision 42117) @@ -23,9 +23,10 @@ class Gem::Package::Old < Gem::Package https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/package/old.rb#L23 require 'zlib' Gem.load_yaml - @gem = gem - @contents = nil - @spec = nil + @contents = nil + @gem = gem + @security_policy = nil + @spec = nil end ## @@ -142,7 +143,7 @@ class Gem::Package::Old < Gem::Package https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/package/old.rb#L143 end end - yaml_error = if RUBY_VERSION < '1.8' then + yaml_error = if RUBY_VERSION < '1.9' then YAML::ParseError elsif YAML::ENGINE.yamler == 'syck' then YAML::ParseError Index: ruby_2_0_0/lib/rubygems/package.rb =================================================================== --- ruby_2_0_0/lib/rubygems/package.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/package.rb (revision 42117) @@ -336,7 +336,6 @@ EOM https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/package.rb#L336 open destination, 'wb', entry.header.mode do |out| out.write entry.read - out.fsync rescue nil # for filesystems without fsync(2) end say destination if Gem.configuration.really_verbose Index: ruby_2_0_0/lib/rubygems/installer.rb =================================================================== --- ruby_2_0_0/lib/rubygems/installer.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/installer.rb (revision 42117) @@ -331,8 +331,9 @@ class Gem::Installer https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/installer.rb#L331 # specifications directory. def write_spec - File.open(spec_file, "w") do |file| + open spec_file, 'w' do |file| file.puts spec.to_ruby_for_cache + file.fsync rescue nil # for filesystems without fsync(2) end end @@ -773,7 +774,13 @@ EOF https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/installer.rb#L774 def write_build_info_file return if @build_args.empty? - open spec.build_info_file, 'w' do |io| + build_info_dir = File.join gem_home, 'build_info' + + FileUtils.mkdir_p build_info_dir + + build_info_file = File.join build_info_dir, "#{spec.full_name}.info" + + open build_info_file, 'w' do |io| @build_args.each do |arg| io.puts arg end Index: ruby_2_0_0/lib/rubygems/commands/push_command.rb =================================================================== --- ruby_2_0_0/lib/rubygems/commands/push_command.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/commands/push_command.rb (revision 42117) @@ -20,7 +20,8 @@ class Gem::Commands::PushCommand < Gem:: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/push_command.rb#L20 end def initialize - super 'push', description + super 'push', description, :host => self.host + add_proxy_option add_key_option Index: ruby_2_0_0/lib/rubygems/commands/specification_command.rb =================================================================== --- ruby_2_0_0/lib/rubygems/commands/specification_command.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/commands/specification_command.rb (revision 42117) @@ -28,7 +28,7 @@ class Gem::Commands::SpecificationComman https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/specification_command.rb#L28 options[:format] = :ruby end - add_option('--yaml', 'Output RUBY format') do |value, options| + add_option('--yaml', 'Output YAML format') do |value, options| options[:format] = :yaml end Index: ruby_2_0_0/lib/rubygems/commands/update_command.rb =================================================================== --- ruby_2_0_0/lib/rubygems/commands/update_command.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/commands/update_command.rb (revision 42117) @@ -94,7 +94,7 @@ class Gem::Commands::UpdateCommand < Gem https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/update_command.rb#L94 say "Updating #{name}" begin - @installer.install name, version + @installer.install name, Gem::Requirement.new(version) success = true rescue Gem::InstallError => e alert_error "Error installing #{name}:\n\t#{e.message}" Index: ruby_2_0_0/lib/rubygems/commands/help_command.rb =================================================================== --- ruby_2_0_0/lib/rubygems/commands/help_command.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/commands/help_command.rb (revision 42117) @@ -113,7 +113,15 @@ platform. https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/help_command.rb#L113 format = "#{' ' * margin_width}%-#{desc_width}s%s" command_manager.command_names.each do |cmd_name| - summary = command_manager[cmd_name].summary + command = command_manager[cmd_name] + + summary = + if command then + command.summary + else + "[No command found for #{cmd_name}, bug?]" + end + summary = wrap(summary, summary_width).split "\n" out << sprintf(format, cmd_name, summary.shift) until summary.empty? do Index: ruby_2_0_0/lib/rubygems/commands/owner_command.rb =================================================================== --- ruby_2_0_0/lib/rubygems/commands/owner_command.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/commands/owner_command.rb (revision 42117) @@ -73,7 +73,7 @@ class Gem::Commands::OwnerCommand < Gem: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/owner_command.rb#L73 request.add_field "Authorization", api_key end - with_response response + with_response response, "Removing #{owner}" rescue # ignore end Index: ruby_2_0_0/lib/rubygems/commands/pristine_command.rb =================================================================== --- ruby_2_0_0/lib/rubygems/commands/pristine_command.rb (revision 42116) +++ ruby_2_0_0/lib/rubygems/commands/pristine_command.rb (revision 42117) @@ -10,7 +10,8 @@ class Gem::Commands::PristineCommand < G https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/pristine_command.rb#L10 def initialize super 'pristine', 'Restores installed gems to pristine condition from files located in the gem cache', - :version => Gem::Requirement.default, :extensions => true, + :version => Gem::Requirement.default, + :extensions => true, :all => false add_option('--all', @@ -37,7 +38,7 @@ class Gem::Commands::PristineCommand < G https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/pristine_command.rb#L38 end def defaults_str # :nodoc: - "--all --extensions" + (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/