From 32458a01eba62f1468e6fc4ad858b228a5425966 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 2 Mar 2013 16:17:22 +0000 Subject: [PATCH] ext_conf_builder.rb: hack for obsolete sytle gems * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.hack_for_obsolete_sytle_gems): remove circular dependencies for old style gems which locate extconf.rb on the toplevel. [ruby-core:53059] [ruby-trunk - Bug #7698] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 ++++++- lib/rubygems/ext/ext_conf_builder.rb | 14 ++++++++++++++ test/rubygems/test_gem_installer.rb | 3 +++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5f3424b957..d575dcbb6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -Sun Mar 3 01:16:16 2013 Nobuyoshi Nakada +Sun Mar 3 01:17:20 2013 Nobuyoshi Nakada + + * lib/rubygems/ext/ext_conf_builder.rb + (Gem::Ext::ExtConfBuilder.hack_for_obsolete_sytle_gems): remove + circular dependencies for old style gems which locate extconf.rb on + the toplevel. [ruby-core:53059] [ruby-trunk - Bug #7698] * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build): use RUBYOPT instead of -r option, and revert some tests. [Bug #7698] diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb index e11a1cdfbc..f3fc5d8e30 100644 --- a/lib/rubygems/ext/ext_conf_builder.rb +++ b/lib/rubygems/ext/ext_conf_builder.rb @@ -11,6 +11,18 @@ require 'tempfile' class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder + def self.hack_for_obsolete_sytle_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|$)/, '')}" + } + if changed + File.open('Makefile', 'wb') {|f| f.print mf} + end + end + def self.build(extension, directory, dest_path, results, args=[]) siteconf = Tempfile.open(%w"siteconf .rb", ".") do |f| f.puts "require 'rbconfig'" @@ -28,6 +40,8 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder run cmd, results + hack_for_obsolete_sytle_gems directory + make dest_path, results results diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index d9a4a82418..acbc0447df 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -1038,6 +1038,9 @@ gem 'other', version RUBY end + # make sure timestamp file will become newer than the script file. + sleep 2 + assert !File.exist?(File.join(@spec.gem_dir, rb)) use_ui @ui do path = Gem::Package.build @spec