* 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
This commit is contained in:
nobu 2008-07-01 06:01:15 +00:00
Родитель d3b61c079e
Коммит c274c6fabf
4 изменённых файлов: 39 добавлений и 9 удалений

Просмотреть файл

@ -1,3 +1,14 @@
Tue Jul 1 15:01:13 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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 <nobu@ruby-lang.org>
* array.c (rb_ary_fill): check if beg is too big.

Просмотреть файл

@ -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

Просмотреть файл

@ -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) << "-"

Просмотреть файл

@ -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")