ruby-changes:27739
From: nagachika <ko1@a...>
Date: Sun, 17 Mar 2013 23:27:46 +0900 (JST)
Subject: [ruby-changes:27739] nagachika:r39791 (ruby_2_0_0): merge revision(s) 39579: [Backport #7991]
nagachika 2013-03-17 23:27:00 +0900 (Sun, 17 Mar 2013) New Revision: 39791 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39791 Log: merge revision(s) 39579: [Backport #7991] * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build): fix for unusal cases again. install to a temporary directory once and move instaled files to the destination directory, if it is same as the current directory. [Bug #7698] Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb branches/ruby_2_0_0/test/rubygems/test_gem_installer.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 39790) +++ ruby_2_0_0/ChangeLog (revision 39791) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Sun Mar 17 23:26:31 2013 Nobuyoshi Nakada <nobu@r...> + + * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build): + fix for unusal cases again. install to a temporary directory once + and move instaled files to the destination directory, if it is same + as the current directory. [Bug #7698] + Sun Mar 17 23:22:22 2013 Nobuyoshi Nakada <nobu@r...> * lib/rubygems/ext/ext_conf_builder.rb Index: ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb =================================================================== --- ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb (revision 39790) +++ ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb (revision 39791) @@ -10,26 +10,14 @@ require 'fileutils' https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb#L10 require 'tempfile' class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder - - def self.hack_for_obsolete_style_gems(directory) - return unless directory and File.identical?(directory, ".") - mf = Gem.read_binary 'Makefile' - changed = false - changed |= mf.gsub!(/^(install-rb-default:)(.*)/) { - "#$1#{$2.gsub(/(?:^|\s+)\$\(RUBY(?:ARCH|LIB)DIR\)\/\S+(?=\s|$)/, '')}" - } - changed |= mf.gsub!(/^(install-so:.*DLLIB.*\n)((?:\t.*\n)+)/) { - "#$1#{$2.gsub(/.*INSTALL.*DLLIB.*\n/, '')}" - } - if changed - File.open('Makefile', 'wb') {|f| f.print mf} - end - end + FileEntry = FileUtils::Entry_ # :nodoc: def self.build(extension, directory, dest_path, results, args=[]) + tmp_dest = (Dir.mktmpdir(".gem.", ".") if File.identical?(dest_path, ".")) + siteconf = Tempfile.open(%w"siteconf .rb", ".") do |f| f.puts "require 'rbconfig'" - f.puts "dest_path = #{dest_path.dump}" + f.puts "dest_path = #{(tmp_dest || dest_path).dump}" %w[sitearchdir sitelibdir].each do |dir| f.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path" f.puts "RbConfig::CONFIG['#{dir}'] = dest_path" @@ -43,14 +31,20 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/ext/ext_conf_builder.rb#L31 run cmd, results - hack_for_obsolete_style_gems directory - make dest_path, results + if tmp_dest + FileEntry.new(tmp_dest).traverse do |ent| + destent = ent.class.new(dest_path, ent.rel) + destent.exist? or File.rename(ent.path, destent.path) + end + end + results ensure ENV["RUBYOPT"] = rubyopt siteconf.close(true) if siteconf + FileUtils.rm_rf tmp_dest if tmp_dest end end Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 39790) +++ ruby_2_0_0/version.h (revision 39791) @@ -1,6 +1,6 @@ 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-03-17" -#define RUBY_PATCHLEVEL 61 +#define RUBY_PATCHLEVEL 62 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_0_0/test/rubygems/test_gem_installer.rb =================================================================== --- ruby_2_0_0/test/rubygems/test_gem_installer.rb (revision 39790) +++ ruby_2_0_0/test/rubygems/test_gem_installer.rb (revision 39791) @@ -1001,7 +1001,17 @@ load Gem.bin_path('a', 'executable', ver https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_installer.rb#L1001 RUBY end + Dir.mkdir(File.join("lib", @spec.name)) + rb2 = File.join("lib", @spec.name, "#{@spec.name}.rb") + @spec.files << rb2 + write_file File.join(@tempdir, rb2) do |io| + io.write <<-RUBY + # #{@spec.name}/#{@spec.name}.rb + RUBY + end + assert !File.exist?(File.join(@spec.gem_dir, rb)) + assert !File.exist?(File.join(@spec.gem_dir, rb2)) use_ui @ui do path = Gem::Package.build @spec @@ -1009,6 +1019,7 @@ load Gem.bin_path('a', 'executable', ver https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_installer.rb#L1019 @installer.install end assert File.exist?(File.join(@spec.gem_dir, rb)) + assert File.exist?(File.join(@spec.gem_dir, rb2)) end def test_install_extension_flat Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r39579 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/