File rubygems_fix_build_info_location.patch of Package ruby20.openSUSE_13.1_Update
From: David Majda <dmajda@suse.cz>
Date: Fri, 10 Jan 2014 09:35:17 +0100
References: bnc#858100
Upstream: merged
Subject: RubyGems: Fix build info file location
Gem::Specification#build_info_file didn't respect the :install_dir
option and saved the build info file into a wrong lovation during gem
installation. This caused permission problems when installing gems using
Bundler, making it pretty much useless.
This fix is a backport from upstream:
https://github.com/rubygems/rubygems/commit/26f8ed4aa7f1ac965aec8f5721ec97e84eca6043
The upstream fix is already included in RubyGems 2.0.4.
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 4a41891..25438f9 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -773,7 +773,13 @@ def pre_install_checks
def write_build_info_file
return if @build_args.empty?
- open spec.build_info_file, 'w' do |io|
+ build_info_dir = File.join gem_home, 'build_info'
+
+ FileUtils.mkdir_p build_info_dir
+
+ build_info_file = File.join build_info_dir, "#{spec.full_name}.info"
+
+ open build_info_file, 'w' do |io|
@build_args.each do |arg|
io.puts arg
end
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 0f9bfef..4778b8e 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -1364,6 +1364,20 @@ def test_write_build_args_empty
refute_path_exists @spec.build_info_file
end
+ def test_write_build_info_file_install_dir
+ installer = Gem::Installer.new @gem, :install_dir => "#{@gemhome}2"
+
+ installer.build_args = %w[
+ --with-libyaml-dir /usr/local/Cellar/libyaml/0.1.4
+ ]
+
+ installer.write_build_info_file
+
+ refute_path_exists @spec.build_info_file
+ assert_path_exists \
+ File.join("#{@gemhome}2", 'build_info', "#{@spec.full_name}.info")
+ end
+
def test_write_cache_file
cache_file = File.join @gemhome, 'cache', @spec.file_name
gem = File.join @gemhome, @spec.file_name