[前][次][番号順一覧][スレッド一覧]

ruby-changes:30848

From: drbrain <ko1@a...>
Date: Fri, 13 Sep 2013 10:40:52 +0900 (JST)
Subject: [ruby-changes:30848] drbrain:r42927 (trunk): * lib/rubygems: Update to RubyGems 2.1.3

drbrain	2013-09-13 10:40:42 +0900 (Fri, 13 Sep 2013)

  New Revision: 42927

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42927

  Log:
    * lib/rubygems:  Update to RubyGems 2.1.3
    
      Fixed installing platform gems
    
      Restored concurrent requires
    
      Fixed installing gems with extensions with --install-dir
    
      Fixed `gem fetch -v` to install the latest version
    
      Fixed installing gems with "./" in their files entries
    
    * test/rubygems/test_gem_package.rb:  Tests for the above.
    
    * NEWS:  Updated for RubyGems 2.1.3

  Modified files:
    trunk/ChangeLog
    trunk/NEWS
    trunk/lib/rubygems/commands/fetch_command.rb
    trunk/lib/rubygems/core_ext/kernel_require.rb
    trunk/lib/rubygems/dependency_resolver/index_specification.rb
    trunk/lib/rubygems/dependency_resolver.rb
    trunk/lib/rubygems/installer.rb
    trunk/lib/rubygems/package.rb
    trunk/lib/rubygems.rb
    trunk/test/rubygems/test_gem_commands_fetch_command.rb
    trunk/test/rubygems/test_gem_dependency_resolver.rb
    trunk/test/rubygems/test_gem_installer.rb
    trunk/test/rubygems/test_gem_package.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42926)
+++ ChangeLog	(revision 42927)
@@ -1,3 +1,21 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Sep 13 10:40:28 2013  Eric Hodel  <drbrain@s...>
+
+	* lib/rubygems:  Update to RubyGems 2.1.3
+
+	  Fixed installing platform gems
+
+	  Restored concurrent requires
+
+	  Fixed installing gems with extensions with --install-dir
+
+	  Fixed `gem fetch -v` to install the latest version
+
+	  Fixed installing gems with "./" in their files entries
+
+	* test/rubygems/test_gem_package.rb:  Tests for the above.
+
+	* NEWS:  Updated for RubyGems 2.1.3
+
 Thu Sep 12 22:40:03 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (RUBY_CHECK_SIGNEDNESS): macro to check signedness of a
Index: lib/rubygems/dependency_resolver/index_specification.rb
===================================================================
--- lib/rubygems/dependency_resolver/index_specification.rb	(revision 42926)
+++ lib/rubygems/dependency_resolver/index_specification.rb	(revision 42927)
@@ -43,7 +43,7 @@ class Gem::DependencyResolver::IndexSpec https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_resolver/index_specification.rb#L43
 
       unless Gem::Platform::RUBY == @platform then
         q.breakable
-        q.text @platform
+        q.text @platform.to_s
       end
 
       q.breakable
Index: lib/rubygems/commands/fetch_command.rb
===================================================================
--- lib/rubygems/commands/fetch_command.rb	(revision 42926)
+++ lib/rubygems/commands/fetch_command.rb	(revision 42927)
@@ -52,13 +52,15 @@ then repackaging it. https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/fetch_command.rb#L52
       dep = Gem::Dependency.new gem_name, version
       dep.prerelease = options[:prerelease]
 
-      specs_and_sources, errors = Gem::SpecFetcher.fetcher.spec_for_dependency dep
+      specs_and_sources, errors =
+        Gem::SpecFetcher.fetcher.spec_for_dependency dep
+
       if platform then
         filtered = specs_and_sources.select { |s,| s.platform == platform }
         specs_and_sources = filtered unless filtered.empty?
       end
 
-      spec, source = specs_and_sources.sort_by { |s,| s.version }.first
+      spec, source = specs_and_sources.max_by { |s,| s.version }
 
       if spec.nil? then
         show_lookup_failure gem_name, version, errors, options[:domain]
Index: lib/rubygems/dependency_resolver.rb
===================================================================
--- lib/rubygems/dependency_resolver.rb	(revision 42926)
+++ lib/rubygems/dependency_resolver.rb	(revision 42927)
@@ -131,8 +131,9 @@ class Gem::DependencyResolver https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_resolver.rb#L131
         return conflict
       end
 
-      # Get a list of all specs that satisfy dep
+      # Get a list of all specs that satisfy dep and platform
       possible = @set.find_all dep
+      possible = select_local_platforms possible
 
       case possible.size
       when 0
@@ -228,6 +229,15 @@ class Gem::DependencyResolver https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_resolver.rb#L229
     specs
   end
 
+  ##
+  # Returns the gems in +specs+ that match the local platform.
+
+  def select_local_platforms specs # :nodoc:
+    specs.select do |spec|
+      Gem::Platform.match spec.platform
+    end
+  end
+
 end
 
 require 'rubygems/dependency_resolver/api_set'
Index: lib/rubygems/core_ext/kernel_require.rb
===================================================================
--- lib/rubygems/core_ext/kernel_require.rb	(revision 42926)
+++ lib/rubygems/core_ext/kernel_require.rb	(revision 42927)
@@ -48,7 +48,12 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/lib/rubygems/core_ext/kernel_require.rb#L48
     # normal require handle loading a gem from the rescue below.
 
     if Gem::Specification.unresolved_deps.empty? then
-      return gem_original_require(path)
+      begin
+        RUBYGEMS_ACTIVATION_MONITOR.exit
+        return gem_original_require(path)
+      ensure
+        RUBYGEMS_ACTIVATION_MONITOR.enter
+      end
     end
 
     # If +path+ is for a gem that has already been loaded, don't
@@ -61,7 +66,12 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/lib/rubygems/core_ext/kernel_require.rb#L66
       s.activated? and s.contains_requirable_file? path
     }
 
-    return gem_original_require(path) if spec
+    begin
+      RUBYGEMS_ACTIVATION_MONITOR.exit
+      return gem_original_require(path)
+    ensure
+      RUBYGEMS_ACTIVATION_MONITOR.enter
+    end if spec
 
     # Attempt to find +path+ in any unresolved gems...
 
@@ -109,11 +119,21 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/lib/rubygems/core_ext/kernel_require.rb#L119
       valid.activate
     end
 
-    gem_original_require path
+    begin
+      RUBYGEMS_ACTIVATION_MONITOR.exit
+      return gem_original_require(path)
+    ensure
+      RUBYGEMS_ACTIVATION_MONITOR.enter
+    end
   rescue LoadError => load_error
     if load_error.message.start_with?("Could not find") or
         (load_error.message.end_with?(path) and Gem.try_activate(path)) then
-      return gem_original_require(path)
+      begin
+        RUBYGEMS_ACTIVATION_MONITOR.exit
+        return gem_original_require(path)
+      ensure
+        RUBYGEMS_ACTIVATION_MONITOR.enter
+      end
     end
 
     raise load_error
Index: lib/rubygems/package.rb
===================================================================
--- lib/rubygems/package.rb	(revision 42926)
+++ lib/rubygems/package.rb	(revision 42927)
@@ -339,9 +339,13 @@ EOM https://github.com/ruby/ruby/blob/trunk/lib/rubygems/package.rb#L339
   def extract_tar_gz io, destination_dir, pattern = "*" # :nodoc:
     open_tar_gz io do |tar|
       tar.each do |entry|
-        next unless File.fnmatch pattern, entry.full_name
+        # Some entries start with "./" which fnmatch does not like, see github
+        # issue #644
+        full_name = entry.full_name.sub %r%\A\./%, ''
 
-        destination = install_location entry.full_name, destination_dir
+        next unless File.fnmatch pattern, full_name
+
+        destination = install_location full_name, destination_dir
 
         FileUtils.rm_rf destination
 
Index: lib/rubygems/installer.rb
===================================================================
--- lib/rubygems/installer.rb	(revision 42926)
+++ lib/rubygems/installer.rb	(revision 42927)
@@ -213,6 +213,8 @@ class Gem::Installer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L213
 
     FileUtils.mkdir_p gem_dir
 
+    spec.loaded_from = spec_file
+
     if @options[:install_as_default]
       extract_bin
       write_default_spec
@@ -230,8 +232,6 @@ class Gem::Installer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L232
 
     say spec.post_install_message unless spec.post_install_message.nil?
 
-    spec.loaded_from = spec_file
-
     Gem::Specification.add_spec spec unless Gem::Specification.include? spec
 
     run_post_install_hooks
Index: lib/rubygems.rb
===================================================================
--- lib/rubygems.rb	(revision 42926)
+++ lib/rubygems.rb	(revision 42927)
@@ -8,7 +8,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L8
 require 'rbconfig'
 
 module Gem
-  VERSION = '2.1.0'
+  VERSION = '2.1.3'
 end
 
 # Must be first since it unloads the prelude from 1.9.2
Index: NEWS
===================================================================
--- NEWS	(revision 42926)
+++ NEWS	(revision 42927)
@@ -175,8 +175,8 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L175
     Rinda::RingFinger for details.
 
 * RubyGems
-  * Updated to 2.1.0.  See
-    http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.1.0+%2F+2013-09-09
+  * Updated to 2.1.3.  See
+    http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.1.3+%2F+2013-09-12
     for release notes.
 
 * Socket
Index: test/rubygems/test_gem_package.rb
===================================================================
--- test/rubygems/test_gem_package.rb	(revision 42926)
+++ test/rubygems/test_gem_package.rb	(revision 42927)
@@ -396,6 +396,19 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package.rb#L396
                  "#{@destination} is not allowed", e.message)
   end
 
+  def test_extract_tar_gz_dot_slash
+    package = Gem::Package.new @gem
+
+    tgz_io = util_tar_gz do |tar|
+      tar.add_file './dot_slash.rb', 0644 do |io| io.write 'hi' end
+    end
+
+    package.extract_tar_gz tgz_io, @destination
+
+    extracted = File.join @destination, 'dot_slash.rb'
+    assert_path_exists extracted
+  end
+
   def test_install_location
     package = Gem::Package.new @gem
 
Index: test/rubygems/test_gem_installer.rb
===================================================================
--- test/rubygems/test_gem_installer.rb	(revision 42926)
+++ test/rubygems/test_gem_installer.rb	(revision 42927)
@@ -73,7 +73,7 @@ load Gem.bin_path('a', 'executable', ver https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L73
     @installer.generate_bin
 
     installed_exec = File.join util_inst_bindir, 'executable'
-    assert File.exist? installed_exec
+    assert_path_exists installed_exec
 
     wrapper = File.read installed_exec
     assert_match %r|generated by RubyGems|, wrapper
@@ -136,7 +136,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L136
     @installer.generate_bin # should not raise
 
     installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
-    assert File.exist? installed_exec
+    assert_path_exists installed_exec
 
     wrapper = File.read installed_exec
     assert_match %r|generated by RubyGems|, wrapper
@@ -165,7 +165,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L165
     @installer.generate_bin
 
     installed_exec = File.join util_inst_bindir, 'executable'
-    assert File.exist? installed_exec
+    assert_path_exists installed_exec
 
     wrapper = File.read installed_exec
     assert_match %r|generated by RubyGems|, wrapper
@@ -178,7 +178,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L178
     @installer.generate_bin
 
     installed_exec = File.join util_inst_bindir, 'executable'
-    assert File.exist? installed_exec
+    assert_path_exists installed_exec
 
     wrapper = File.read installed_exec
     assert_match %r|generated by RubyGems|, wrapper
@@ -252,7 +252,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L252
 
     assert_equal true, File.directory?(util_inst_bindir)
     installed_exec = File.join(util_inst_bindir, 'executable')
-    assert_equal true, File.exist?(installed_exec)
+    assert_path_exists installed_exec
     assert_equal mask, File.stat(installed_exec).mode unless win_platform?
 
     wrapper = File.read installed_exec
@@ -287,7 +287,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L287
     @installer.generate_bin
     assert File.directory? util_inst_bindir
     installed_exec = File.join util_inst_bindir, 'executable'
-    assert File.exist? installed_exec
+    assert_path_exists installed_exec
     assert_equal mask, File.stat(installed_exec).mode unless win_platform?
 
     wrapper = File.read installed_exec
@@ -304,7 +304,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L304
     @installer.generate_bin
     assert_equal true, File.directory?(util_inst_bindir)
     installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
-    assert_equal true, File.exist?(installed_exec)
+    assert_path_exists installed_exec
   ensure
     Gem::Installer.exec_format = nil
   end
@@ -318,7 +318,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L318
     @installer.generate_bin
     assert_equal true, File.directory?(util_inst_bindir)
     installed_exec = File.join util_inst_bindir, 'executable'
-    assert_equal true, File.exist?(installed_exec)
+    assert_path_exists installed_exec
   ensure
     Gem::Installer.exec_format = nil
   end
@@ -340,7 +340,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L340
     @installer.generate_bin
 
     installed_exec = File.join("#{@gemhome}2", "bin", 'executable')
-    assert File.exist? installed_exec
+    assert_path_exists installed_exec
     assert_equal mask, File.stat(installed_exec).mode unless win_platform?
 
     wrapper = File.read installed_exec
@@ -353,7 +353,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L353
     @installer.wrappers = true
     @installer.generate_bin
 
-    refute File.exist?(util_inst_bindir), 'bin dir was created when not needed'
+    refute_path_exists util_inst_bindir, 'bin dir was created when not needed'
   end
 
   def test_generate_bin_script_no_perms
@@ -389,7 +389,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L389
     @installer.generate_bin
 
     installed_exec = File.join @gemhome, 'bin', 'executable'
-    assert_equal true, File.exist?(installed_exec)
+    assert_path_exists installed_exec
     assert_equal mask, File.stat(installed_exec).mode unless win_platform?
 
     wrapper = File.read installed_exec
@@ -414,7 +414,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L414
 
     @installer.generate_bin
     assert_equal true, File.directory?(util_inst_bindir)
-    assert_equal true, File.exist?(installed_exec)
+    assert_path_exists installed_exec
     assert_equal mask, File.stat(installed_exec).mode unless win_platform?
 
     assert_match %r|generated by RubyGems|, File.read(installed_exec)
@@ -444,7 +444,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L444
     @installer.wrappers = false
     @installer.generate_bin
 
-    refute File.exist?(util_inst_bindir)
+    refute_path_exists util_inst_bindir
   end
 
   def test_generate_bin_symlink_no_perms
@@ -543,7 +543,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L543
     @installer.generate_bin
 
     installed_exec = File.join util_inst_bindir, 'executable'
-    assert File.exist? installed_exec
+    assert_path_exists installed_exec
 
     @spec = Gem::Specification.new do |s|
       s.files = ['lib/code.rb']
@@ -580,7 +580,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L580
 
     assert_equal true, File.directory?(util_inst_bindir)
     installed_exec = File.join(util_inst_bindir, 'executable')
-    assert_equal true, File.exist?(installed_exec)
+    assert_path_exists installed_exec
 
     assert_match(/Unable to use symlinks on Windows, installing wrapper/i,
                  @ui.error)
@@ -647,19 +647,19 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L647
     rakefile   = File.join gemdir, 'ext', 'a', 'Rakefile'
 
     Gem.pre_install do |installer|
-      refute File.exist?(cache_file), 'cache file must not exist yet'
+      refute_path_exists cache_file, 'cache file must not exist yet'
       true
     end
 
     Gem.post_build do |installer|
-      assert File.exist?(gemdir), 'gem install dir must exist'
-      assert File.exist?(rakefile), 'gem executable must exist'
-      refute File.exist?(stub_exe), 'gem executable must not exist'
+      assert_path_exists gemdir, 'gem install dir must exist'
+      assert_path_exists rakefile, 'gem executable must exist'
+      refute_path_exists stub_exe, 'gem executable must not exist'
       true
     end
 
     Gem.post_install do |installer|
-      assert File.exist?(cache_file), 'cache file must exist'
+      assert_path_exists cache_file, 'cache file must exist'
     end
 
     @newspec = nil
@@ -670,23 +670,23 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L670
     end
 
     assert_equal @spec, @newspec
-    assert File.exist? gemdir
-    assert File.exist?(stub_exe), 'gem executable must exist'
+    assert_path_exists gemdir
+    assert_path_exists stub_exe, 'gem executable must exist'
 
     exe = File.join gemdir, 'bin', 'executable'
-    assert File.exist? exe
+    assert_path_exists exe
 
     exe_mode = File.stat(exe).mode & 0111
     assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform?
 
-    assert File.exist?(File.join(gemdir, 'lib', 'code.rb'))
+    assert_path_exists File.join gemdir, 'lib', 'code.rb'
 
-    assert File.exist? rakefile
+    assert_path_exists rakefile
 
     spec_file = File.join(@gemhome, 'specifications', @spec.spec_name)
 
     assert_equal spec_file, @newspec.loaded_from
-    assert File.exist?(spec_file)
+    assert_path_exists spec_file
 
     assert_same @installer, @post_build_hook_arg
     assert_same @installer, @post_install_hook_arg
@@ -795,7 +795,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L795
     end
 
     gemdir = File.join(@gemhome, 'gems', @spec.full_name)
-    assert File.exist?(File.join(gemdir, 'lib', 'code.rb'))
+    assert_path_exists File.join gemdir, 'lib', 'code.rb'
 
     util_setup_gem
     # Morph spec to have lib/other.rb instead of code.rb and recreate
@@ -814,9 +814,9 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L814
       end
     end
 
-    assert File.exist?(File.join(gemdir, 'lib', 'other.rb'))
-    refute(File.exist?(File.join(gemdir, 'lib', 'code.rb')),
-           "code.rb from prior install of same gem shouldn't remain here")
+    assert_path_exists File.join gemdir, 'lib', 'other.rb'
+    refute_path_exists File.join gemdir, 'lib', 'code.rb',
+           "code.rb from prior install of same gem shouldn't remain here"
   end
 
   def test_install_force
@@ -826,7 +826,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L826
     end
 
     gem_dir = File.join(@gemhome, 'gems', 'old_ruby_required-1')
-    assert File.exist?(gem_dir)
+    assert_path_exists gem_dir
   end
 
   def test_install_missing_dirs
@@ -842,8 +842,8 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L842
     File.directory? File.join(Gem.dir, 'docs')
     File.directory? File.join(Gem.dir, 'specifications')
 
-    assert File.exist?(File.join(@gemhome, 'cache', @spec.file_name))
-    assert File.exist?(File.join(@gemhome, 'specifications', @spec.spec_name))
+    assert_path_exists File.join @gemhome, 'cache', @spec.file_name
+    assert_path_exists File.join @gemhome, 'specifications', @spec.spec_name
   end
 
   def test_install_post_build_false
@@ -864,10 +864,10 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L864
     end
 
     spec_file = File.join @gemhome, 'specifications', @spec.spec_name
-    refute File.exist? spec_file
+    refute_path_exists spec_file
 
     gem_dir = File.join @gemhome, 'gems', @spec.full_name
-    refute File.exist? gem_dir
+    refute_path_exists gem_dir
   end
 
   def test_install_post_build_nil
@@ -882,10 +882,10 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L882
     end
 
     spec_file = File.join @gemhome, 'specifications', @spec.spec_name
-    assert File.exist? spec_file
+    assert_pa (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]