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

ruby-changes:27508

From: nobu <ko1@a...>
Date: Sun, 3 Mar 2013 01:17:30 +0900 (JST)
Subject: [ruby-changes:27508] nobu:r39560 (trunk): ext_conf_builder.rb: hack for obsolete sytle gems

nobu	2013-03-03 01:17:22 +0900 (Sun, 03 Mar 2013)

  New Revision: 39560

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

  Log:
    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]

  Modified files:
    trunk/ChangeLog
    trunk/lib/rubygems/ext/ext_conf_builder.rb
    trunk/test/rubygems/test_gem_installer.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39559)
+++ ChangeLog	(revision 39560)
@@ -1,4 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Sun Mar  3 01:16:16 2013  Nobuyoshi Nakada  <nobu@r...>
+Sun Mar  3 01:17:20 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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]
Index: lib/rubygems/ext/ext_conf_builder.rb
===================================================================
--- lib/rubygems/ext/ext_conf_builder.rb	(revision 39559)
+++ lib/rubygems/ext/ext_conf_builder.rb	(revision 39560)
@@ -11,6 +11,18 @@ require 'tempfile' https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/ext_conf_builder.rb#L11
 
 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::Ex https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/ext_conf_builder.rb#L40
 
     run cmd, results
 
+    hack_for_obsolete_sytle_gems directory
+
     make dest_path, results
 
     results
Index: test/rubygems/test_gem_installer.rb
===================================================================
--- test/rubygems/test_gem_installer.rb	(revision 39559)
+++ test/rubygems/test_gem_installer.rb	(revision 39560)
@@ -1038,6 +1038,9 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L1038
       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

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

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