From c274c6fabf8772d9fc94be8d1c1c4dc8dd98babd Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 1 Jul 2008 06:01:15 +0000 Subject: [PATCH] * lib/rubygems/ext/builder.rb (Gem::Ext::Builder.make), (Gem::Ext::Builder.run): EXIT_SUCCESS may be 0 or may not. * test/rubygems/test_gem_ext_rake_builder.rb (build_rake_in): override Gem.ruby and ENV["rake"]. * runruby.rb: bin/rake does not exist in archdir where architecture depend script (i.e. rbconfig.rb) exists. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 ++++++++ lib/rubygems/ext/builder.rb | 4 +-- runruby.rb | 1 - test/rubygems/test_gem_ext_rake_builder.rb | 32 ++++++++++++++++++---- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9cd7576c3a..62da012f08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Tue Jul 1 15:01:13 2008 Nobuyoshi Nakada + + * lib/rubygems/ext/builder.rb (Gem::Ext::Builder.make), + (Gem::Ext::Builder.run): EXIT_SUCCESS may be 0 or may not. + + * test/rubygems/test_gem_ext_rake_builder.rb (build_rake_in): override + Gem.ruby and ENV["rake"]. + + * runruby.rb: bin/rake does not exist in archdir where architecture + depend script (i.e. rbconfig.rb) exists. + Tue Jul 1 13:19:44 2008 Nobuyoshi Nakada * array.c (rb_ary_fill): check if beg is too big. diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb index 576951a566..36e9ec18f6 100644 --- a/lib/rubygems/ext/builder.rb +++ b/lib/rubygems/ext/builder.rb @@ -35,7 +35,7 @@ class Gem::Ext::Builder results << `#{cmd} #{redirector}` raise Gem::InstallError, "make#{target} failed:\n\n#{results}" unless - $?.exitstatus.zero? + $?.success? end end @@ -47,7 +47,7 @@ class Gem::Ext::Builder results << command results << `#{command} #{redirector}` - unless $?.exitstatus.zero? then + unless $?.success? then raise Gem::InstallError, "#{class_name} failed:\n\n#{results.join "\n"}" end end diff --git a/runruby.rb b/runruby.rb index 95e2906cad..8b0e9c20e5 100755 --- a/runruby.rb +++ b/runruby.rb @@ -46,7 +46,6 @@ libs << File.expand_path("lib", srcdir) config["bindir"] = abs_archdir ENV["RUBY"] = File.expand_path(ruby) ENV["PATH"] = [abs_archdir, ENV["PATH"]].compact.join(File::PATH_SEPARATOR) -ENV["rake"] = ENV["RUBY"] + " " + File.join(abs_archdir, "bin", "rake") if pure libs << File.expand_path("ext", srcdir) << "-" diff --git a/test/rubygems/test_gem_ext_rake_builder.rb b/test/rubygems/test_gem_ext_rake_builder.rb index cf8e2a6d6b..6bc3ea08eb 100644 --- a/test/rubygems/test_gem_ext_rake_builder.rb +++ b/test/rubygems/test_gem_ext_rake_builder.rb @@ -3,6 +3,8 @@ require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/ext' class TestGemExtRakeBuilder < RubyGemTestCase + @@ruby = ENV["RUBY"] + @@rake = ENV["rake"] || (@@ruby + " " + File.expand_path("../../../bin/rake", __FILE__)) def setup super @@ -14,6 +16,24 @@ class TestGemExtRakeBuilder < RubyGemTestCase FileUtils.mkdir_p @dest_path end + def build_rake_in dir + gem_ruby = Gem.ruby + ruby = @@ruby + Gem.module_eval {@ruby = ruby} + env_rake = ENV["rake"] + ENV["rake"] = @@rake + Dir.chdir dir do + yield @@rake + end + ensure + Gem.module_eval {@ruby = gem_ruby} + if env_rake + ENV["rake"] = env_rake + else + ENV.delete("rake") + end + end + def test_class_build File.open File.join(@ext, 'mkrf_conf.rb'), 'w' do |mkrf_conf| mkrf_conf.puts <<-EO_MKRF @@ -26,15 +46,15 @@ class TestGemExtRakeBuilder < RubyGemTestCase output = [] realdir = nil # HACK /tmp vs. /private/tmp - Dir.chdir @ext do + build_rake_in @ext do realdir = Dir.pwd Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', nil, @dest_path, output end expected = [ - "#{Gem.ruby} mkrf_conf.rb", + "#{@@ruby} mkrf_conf.rb", "", - "#{ENV['rake'] || 'rake'} RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path}", + "#{@@rake} RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path}", "(in #{realdir})\n" ] @@ -53,7 +73,7 @@ class TestGemExtRakeBuilder < RubyGemTestCase output = [] error = assert_raise Gem::InstallError do - Dir.chdir @ext do + build_rake_in @ext do Gem::Ext::RakeBuilder.build "mkrf_conf.rb", nil, @dest_path, output end end @@ -61,9 +81,9 @@ class TestGemExtRakeBuilder < RubyGemTestCase expected = <<-EOF.strip rake failed: -#{Gem.ruby} mkrf_conf.rb +#{@@ruby} mkrf_conf.rb -#{ENV['rake'] || 'rake'} RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path} +#{@@rake} RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path} EOF assert_equal expected, error.message.split("\n")[0..4].join("\n")