ruby-changes:30508
From: nagachika <ko1@a...>
Date: Sat, 17 Aug 2013 00:35:32 +0900 (JST)
Subject: [ruby-changes:30508] nagachika:r42587 (ruby_2_0_0): * lib/rubygems: update to RubyGems 2.0.6. the patch by drbrain.
nagachika 2013-08-17 00:35:06 +0900 (Sat, 17 Aug 2013) New Revision: 42587 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42587 Log: * lib/rubygems: update to RubyGems 2.0.6. the patch by drbrain. [ruby-core:56633] [Backport #8787] Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/lib/rubygems/commands/pristine_command.rb branches/ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb branches/ruby_2_0_0/lib/rubygems/installer.rb branches/ruby_2_0_0/lib/rubygems/package_task.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_commands_install_command.rb branches/ruby_2_0_0/test/rubygems/test_gem_package.rb branches/ruby_2_0_0/test/rubygems/test_gem_package_task.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 42586) +++ ruby_2_0_0/ChangeLog (revision 42587) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Sat Aug 17 00:32:17 2013 CHIKANAGA Tomoyuki <nagachika@r...> + + * lib/rubygems: update to RubyGems 2.0.6. the patch by drbrain. + [ruby-core:56633] [Backport #8787] + Sat Aug 10 23:59:47 2013 NAKAMURA Usaku <usa@r...> * test/coverage/test_coverage.rb (TestCoverage#test_big_code): use `1' Index: ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb =================================================================== --- ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb (revision 42586) +++ ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb (revision 42587) @@ -8,6 +8,8 @@ require 'monitor' https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb#L8 module Kernel + RUBYGEMS_ACTIVATION_MONITOR = Monitor.new # :nodoc: + if defined?(gem_original_require) then # Ruby ships with a custom_require, override its require remove_method :require @@ -33,10 +35,8 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb#L35 # 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 + RUBYGEMS_ACTIVATION_MONITOR.enter spec = Gem.find_unresolved_default_spec(path) if spec @@ -118,7 +118,7 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/core_ext/kernel_require.rb#L118 raise load_error ensure - ACTIVATION_MONITOR.exit + RUBYGEMS_ACTIVATION_MONITOR.exit end private :require Index: ruby_2_0_0/lib/rubygems/package_task.rb =================================================================== --- ruby_2_0_0/lib/rubygems/package_task.rb (revision 42586) +++ ruby_2_0_0/lib/rubygems/package_task.rb (revision 42587) @@ -96,12 +96,15 @@ class Gem::PackageTask < Rake::PackageTa https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/package_task.rb#L96 def define super - task :package => [:gem] - gem_file = File.basename gem_spec.cache_file gem_path = File.join package_dir, gem_file gem_dir = File.join package_dir, gem_spec.full_name + task :package => [:gem] + + directory package_dir + directory gem_dir + desc "Build the gem file #{gem_file}" task :gem => [gem_path] Index: ruby_2_0_0/lib/rubygems/specification.rb =================================================================== --- ruby_2_0_0/lib/rubygems/specification.rb (revision 42586) +++ ruby_2_0_0/lib/rubygems/specification.rb (revision 42587) @@ -188,15 +188,19 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L188 attr_reader :version ## - # Paths in the gem to add to <tt>$LOAD_PATH</tt> when this gem is activated. + # Paths in the gem to add to <code>$LOAD_PATH</code> when this gem is + # activated. + # + # If you have an extension you do not need to add <code>"ext"</code> to the + # require path, the extension build process will copy the extension files + # into "lib" for you. + # + # The default value is <code>"lib"</code> # # Usage: # # # If all library files are in the root directory... # spec.require_path = '.' - # - # # If you have 'lib' and 'ext' directories... - # spec.require_paths << 'ext' attr_accessor :require_paths @@ -210,7 +214,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L214 ## # A short summary of this gem's description. Displayed in `gem list -d`. # - # The description should be more detailed than the summary. + # The #description should be more detailed than the summary. # # Usage: # @@ -223,21 +227,23 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L227 # # This is usually Gem::Platform::RUBY or Gem::Platform::CURRENT. # - # Most gems contain pure Ruby code; they should simply leave the default value - # in place. Some gems contain C (or other) code to be compiled into a Ruby - # xtension The should leave the default value in place unless their code - # will only compile on a certain type of system. Some gems consist of - # pre-compiled code (inary gems. It especially important that they set - # the platform attribute appropriately. A shortcut is to set the platform to - # Gem::Platform::CURRENT, which will cause the gem builder to set the platform - # to the appropriate value for the system on which the build is being performed. - # - # If this attribute is set to a non-default value, it will be included in the - # filename of the gem when it is built, e.g. fxruby-1.2.0-win32.gem. + # Most gems contain pure Ruby code; they should simply leave the default + # value in place. Some gems contain C (or other) code to be compiled into a + # Ruby "extension". The should leave the default value in place unless + # their code will only compile on a certain type of system. Some gems + # consist of pre-compiled code ("binary gems"). It's especially important + # that they set the platform attribute appropriately. A shortcut is to set + # the platform to Gem::Platform::CURRENT, which will cause the gem builder + # to set the platform to the appropriate value for the system on which the + # build is being performed. + # + # If this attribute is set to a non-default value, it will be included in + # the filename of the gem when it is built such as: + # nokogiri-1.6.0-x86-mingw32.gem # # Usage: # - # spec.platform = Gem::Platform::Win32 + # spec.platform = Gem::Platform.local def platform= platform if @original_platform.nil? or @@ -339,7 +345,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L345 attr_reader :description ## - # A contact email for this gem + # A contact email address (or addresses) for this gem # # Usage: # @@ -455,6 +461,8 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L461 # Usage: # # spec.extensions << 'ext/rmagic/extconf.rb' + # + # See Gem::Ext::Builder for information about writing extensions for gems. def extensions @extensions ||= [] @@ -484,6 +492,8 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L492 # This should just be the name of your license. The full # text of the license should be inside of the gem when you build it. # + # You can set multiple licenses with #licenses= + # # Usage: # spec.license = 'MIT' @@ -520,15 +530,20 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L530 end ## - # The version of ruby required by this gem + # The version of Ruby required by this gem. The ruby version can be + # specified to the patch-level: + # + # $ ruby -v -e 'p Gem.ruby_version' + # ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0] + # #<Gem::Version "2.0.0.247"> # # Usage: # - # # If it will work with 1.8.6 or greater... + # # This gem will work with 1.8.6 or greater... # spec.required_ruby_version = '>= 1.8.6' # - # # Hopefully by now: - # spec.required_ruby_version = '>= 1.9.2' + # # Only with ruby 2.0.x + # spec.required_ruby_version = '~> 2.0' def required_ruby_version= req @required_ruby_version = Gem::Requirement.create req @@ -536,7 +551,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L551 ## # Lists the external (to RubyGems) requirements that must be met for this gem - # to work. It simply information for the user. + # to work. It's simply information for the user. # # Usage: # @@ -548,7 +563,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L563 end ## - # A collection of unit test files. They will be loaded as unit tests when + # A collection of unit test files. They will be loaded as unit tests when # the user requests a gem to be unit tested. # # Usage: @@ -574,7 +589,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L589 # # Deprecated: It is neither supported nor functional. - attr_accessor :autorequire + attr_accessor :autorequire # :nodoc: ## # Sets the default executable for this gem. @@ -602,9 +617,12 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L617 # The RubyGems version required by this gem attr_reader :required_rubygems_version + ## # The rubyforge project this gem lives under. i.e. RubyGems' # rubyforge_project is "rubygems". + # + # This option is deprecated. attr_accessor :rubyforge_project @@ -1267,7 +1285,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L1285 end ## - # Singular reader for #authors + # Singular reader for #authors. Returns the first author in the list def author val = authors and val.first @@ -1275,6 +1293,8 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L1293 ## # The list of author names who wrote this gem. + # + # spec.authors = ['Chad Fowler', 'Jim Weirich', 'Rich Kilmer'] def authors @authors ||= [] @@ -1381,7 +1401,9 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L1401 end ## - # The date this gem was created. Lazily defaults to TODAY. + # The date this gem was created. Lazily defaults to the current UTC date. + # + # There is no need to set this in your gem specification. def date @date ||= TODAY @@ -1428,7 +1450,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L1450 # Deprecated: The name of the gem is assumed to be the name of the # executable now. See Gem.bin_path. - def default_executable + def default_executable # :nodoc: if defined?(@default_executable) and @default_executable result = @default_executable elsif @executables and @executables.size == 1 @@ -1487,7 +1509,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L1509 end ## - # A long description of this gem + # A detailed description of this gem. See also #summary def description= str @description = str.to_s @@ -1676,7 +1698,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L1698 # # Formerly used to indicate this gem was RDoc-capable. - def has_rdoc + def has_rdoc # :nodoc: true end @@ -1685,11 +1707,11 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/specification.rb#L1707 # # Formerly used to indicate this gem was RDoc-capable. - def has_rdoc= ignored + def has_rdoc= ignored # :nodoc: @has_rdoc = true end - alias :has_rdoc? :has_rdoc + alias :has_rdoc? :has_rdoc # :nodoc: ## # True if this gem has files in test_files Index: ruby_2_0_0/lib/rubygems/installer.rb =================================================================== --- ruby_2_0_0/lib/rubygems/installer.rb (revision 42586) +++ ruby_2_0_0/lib/rubygems/installer.rb (revision 42587) @@ -9,6 +9,7 @@ require 'rubygems/package' https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/installer.rb#L9 require 'rubygems/ext' require 'rubygems/user_interaction' require 'fileutils' +require 'thread' ## # The installer installs the files contained in the .gem into the Gem.home. @@ -32,6 +33,14 @@ class Gem::Installer https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/installer.rb#L33 ENV_PATHS = %w[/usr/bin/env /bin/env] ## + # The builder shells-out to run various commands after changing the + # directory. This means multiple installations cannot be allowed to build + # extensions in parallel as they may change each other's directories leading + # to broken extensions or failed installations. + + CHDIR_MUTEX = Mutex.new # :nodoc: + + ## # Raised when there is an error while building extensions. # class ExtensionBuildError < Gem::InstallError; end @@ -675,11 +684,13 @@ TEXT https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/installer.rb#L684 begin FileUtils.mkdir_p dest_path - Dir.chdir extension_dir do - results = builder.build(extension, gem_dir, dest_path, - results, @build_args) + CHDIR_MUTEX.synchronize do + Dir.chdir extension_dir do + results = builder.build(extension, gem_dir, dest_path, + results, @build_args) - say results.join("\n") if Gem.configuration.really_verbose + say results.join("\n") if Gem.configuration.really_verbose + end end rescue extension_build_error(extension_dir, results.join("\n"), $@) Index: ruby_2_0_0/lib/rubygems/commands/pristine_command.rb =================================================================== --- ruby_2_0_0/lib/rubygems/commands/pristine_command.rb (revision 42586) +++ ruby_2_0_0/lib/rubygems/commands/pristine_command.rb (revision 42587) @@ -21,7 +21,8 @@ class Gem::Commands::PristineCommand < G https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/pristine_command.rb#L21 end add_option('--[no-]extensions', - 'Restore gems with extensions') do |value, options| + 'Restore gems with extensions', + 'in addition to regular gems') do |value, options| options[:extensions] = value end @@ -43,23 +44,23 @@ class Gem::Commands::PristineCommand < G https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/pristine_command.rb#L44 def description # :nodoc: <<-EOF -The pristine command compares the installed gems with the contents of the -cached gem and restores any files that don't match the cached gem's copy. +The pristine command compares an installed gem with the contents of its +cached .gem file and restores any files that don't match the cached .gem's +copy. + +If you have made modifications to an installed gem, the pristine command +will revert them. All extensions are rebuilt and all bin stubs for the gem +are regenerated after checking for modifications. -If you have made modifications to your installed gems, the pristine command -will revert them. After all the gem's files have been checked all bin stubs -for the gem are regenerated. +If the cached gem cannot be found it will be downloaded. -If the cached gem cannot be found, you will need to use `gem install` to -revert the gem. - -If --no-extensions is provided pristine will not attempt to restore gems -with extensions. +If --no-extensions is provided pristine will not attempt to restore a gem +with an extension. EOF end def usage # :nodoc: - "#{program_name} [args]" + "#{program_name} [GEMNAME ...]" end def execute Index: ruby_2_0_0/lib/rubygems.rb =================================================================== --- ruby_2_0_0/lib/rubygems.rb (revision 42586) +++ ruby_2_0_0/lib/rubygems.rb (revision 42587) @@ -8,7 +8,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems.rb#L8 require 'rbconfig' module Gem - VERSION = '2.0.6' + VERSION = '2.0.7' end # Must be first since it unloads the prelude from 1.9.2 @@ -36,9 +36,9 @@ require 'rubygems/errors' https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems.rb#L36 # # Further RubyGems documentation can be found at: # +# * {RubyGems Guides}[http://guides.rubygems.org] # * {RubyGems API}[http://rubygems.rubyforge.org/rdoc] (also available from # <tt>gem server</tt>) -# * {RubyGems Bookshelf}[http://rubygem.org] # # == RubyGems Plugins # Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 42586) +++ ruby_2_0_0/version.h (revision 42587) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" -#define RUBY_RELEASE_DATE "2013-08-11" -#define RUBY_PATCHLEVEL 291 +#define RUBY_RELEASE_DATE "2013-08-17" +#define RUBY_PATCHLEVEL 292 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 8 -#define RUBY_RELEASE_DAY 11 +#define RUBY_RELEASE_DAY 17 #include "ruby/version.h" Index: ruby_2_0_0/test/rubygems/test_gem_package.rb =================================================================== --- ruby_2_0_0/test/rubygems/test_gem_package.rb (revision 42586) +++ ruby_2_0_0/test/rubygems/test_gem_package.rb (revision 42587) @@ -64,13 +64,16 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_package.rb#L64 reader = Gem::Package::TarReader.new gem_io checksums = nil + tar = nil reader.each_entry do |entry| case entry.full_name - when 'checksums.yaml.gz' + when 'checksums.yaml.gz' then Zlib::GzipReader.wrap entry do |io| checksums = io.read end + when 'data.tar.gz' then + tar = entry.read end end @@ -83,19 +86,14 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_package.rb#L86 metadata_sha1 = Digest::SHA1.hexdigest s.string metadata_sha512 = Digest::SHA512.hexdigest s.string - data_digests = nil - util_tar do |tar| - data_digests = package.add_contents tar - end - expected = { 'SHA1' => { 'metadata.gz' => metadata_sha1, - 'data.tar.gz' => data_digests['SHA1'].hexdigest, + 'data.tar.gz' => Digest::SHA1.hexdigest(tar), }, 'SHA512' => { 'metadata.gz' => metadata_sha512, - 'data.tar.gz' => data_digests['SHA512'].hexdigest, + 'data.tar.gz' => Digest::SHA512.hexdigest(tar), } } Index: ruby_2_0_0/test/rubygems/test_gem_package_task.rb =================================================================== --- ruby_2_0_0/test/rubygems/test_gem_package_task.rb (revision 42586) +++ ruby_2_0_0/test/rubygems/test_gem_package_task.rb (revision 42587) @@ -4,16 +4,37 @@ require 'rubygems/package_task' https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_package_task.rb#L4 class TestGemPackageTask < Gem::TestCase + def setup + super + + Rake.application = Rake::Application.new + RakeFileUtils.verbose_flag = false + end + def test_gem_package gem = Gem::Specification.new do |g| g.name = "pkgr" g.version = "1.2.3" - g.files = Rake::FileList["x"].resolve + + g.authors = %w[author] + g.files = %w[x] + g.summary = 'summary' end + pkg = Gem::PackageTask.new(gem) do |p| p.package_files << "y" end - assert_equal ["x", "y"], pkg.package_files + + assert_equal %w[x y], pkg.package_files + + Dir.chdir @tempdir do + FileUtils.touch 'x' + FileUtils.touch 'y' + + Rake.application['package'].invoke + + assert_path_exists 'pkg/pkgr-1.2.3.gem' + end end def test_gem_package (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/