mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 01:54:00 +02:00
merge revision(s) 39597: [Backport #7991]
* lib/rubygems.rb: Bump version to 2.0.1 for upcoming bugfix release * lib/rubygems/ext/ext_conf_builder.rb: Restore ruby 1.8 compatibility for [Bug #9698] * test/rubygems/test_gem_installer.rb: Ditto. * lib/rubygems/package.rb: Restore ruby 1.8 compatibility. * test/rubygems/test_gem_dependency_installer.rb: Fix warnings git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
64766e9db8
commit
9a756111e3
7 changed files with 57 additions and 32 deletions
|
@ -13,41 +13,45 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|||
FileEntry = FileUtils::Entry_ # :nodoc:
|
||||
|
||||
def self.build(extension, directory, dest_path, results, args=[])
|
||||
tmp_dest = (Dir.mktmpdir(".gem.", ".") if File.identical?(dest_path, "."))
|
||||
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 = #{(tmp_dest || dest_path).dump}"
|
||||
Tempfile.open %w"siteconf .rb", "." do |siteconf|
|
||||
siteconf.puts "require 'rbconfig'"
|
||||
siteconf.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"
|
||||
siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path"
|
||||
siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path"
|
||||
end
|
||||
f
|
||||
end
|
||||
|
||||
rubyopt = ENV["RUBYOPT"]
|
||||
ENV["RUBYOPT"] = ["-r#{siteconf.path}", rubyopt].compact.join(' ')
|
||||
cmd = [Gem.ruby, File.basename(extension), *args].join ' '
|
||||
siteconf.flush
|
||||
|
||||
run cmd, results
|
||||
rubyopt = ENV["RUBYOPT"]
|
||||
destdir = ENV["DESTDIR"]
|
||||
|
||||
destdir = ENV["DESTDIR"]
|
||||
ENV["DESTDIR"] = nil
|
||||
begin
|
||||
ENV["RUBYOPT"] = ["-r#{siteconf.path}", rubyopt].compact.join(' ')
|
||||
cmd = [Gem.ruby, File.basename(extension), *args].join ' '
|
||||
|
||||
make dest_path, results
|
||||
run cmd, 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)
|
||||
ENV["DESTDIR"] = nil
|
||||
|
||||
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
|
||||
ENV["DESTDIR"] = destdir
|
||||
end
|
||||
end
|
||||
|
||||
results
|
||||
ensure
|
||||
ENV["RUBYOPT"] = rubyopt
|
||||
ENV["DESTDIR"] = destdir
|
||||
siteconf.close(true) if siteconf
|
||||
FileUtils.rm_rf tmp_dest if tmp_dest
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue