| @@ -1,18 +1,18 @@ | | | @@ -1,18 +1,18 @@ |
1 | $NetBSD: patch-ad,v 1.11 2013/06/11 14:55:54 taca Exp $ | | 1 | $NetBSD: patch-ad,v 1.12 2013/07/07 15:02:56 taca Exp $ |
2 | | | 2 | |
3 | * Add install_root option for pkgsrc's rubygems support. | | 3 | * Add install_root option for pkgsrc's rubygems support. |
4 | | | 4 | |
5 | --- lib/rubygems/installer.rb.orig 2013-02-21 21:50:03.000000000 +0000 | | 5 | --- lib/rubygems/installer.rb.orig 2013-03-05 21:25:39.000000000 +0000 |
6 | +++ lib/rubygems/installer.rb | | 6 | +++ lib/rubygems/installer.rb |
7 | @@ -89,6 +89,9 @@ class Gem::Installer | | 7 | @@ -89,6 +89,9 @@ class Gem::Installer |
8 | # foo_exec18. | | 8 | # foo_exec18. |
9 | # :ignore_dependencies:: Don't raise if a dependency is missing. | | 9 | # :ignore_dependencies:: Don't raise if a dependency is missing. |
10 | # :install_dir:: The directory to install the gem into. | | 10 | # :install_dir:: The directory to install the gem into. |
11 | + # :install_root:: The directory to use as a buildroot for "destdir"-style | | 11 | + # :install_root:: The directory to use as a buildroot for "destdir"-style |
12 | + # installation. All paths during installation are relative | | 12 | + # installation. All paths during installation are relative |
13 | + # to the buildroot. | | 13 | + # to the buildroot. |
14 | # :security_policy:: Use the specified security policy. See Gem::Security | | 14 | # :security_policy:: Use the specified security policy. See Gem::Security |
15 | # :user_install:: Indicate that the gem should be unpacked into the users | | 15 | # :user_install:: Indicate that the gem should be unpacked into the users |
16 | # personal gem directory. | | 16 | # personal gem directory. |
17 | @@ -538,7 +541,8 @@ class Gem::Installer | | 17 | @@ -538,7 +541,8 @@ class Gem::Installer |
18 | :env_shebang => false, | | 18 | :env_shebang => false, |
| @@ -29,13 +29,24 @@ $NetBSD: patch-ad,v 1.11 2013/06/11 14:5 | | | @@ -29,13 +29,24 @@ $NetBSD: patch-ad,v 1.11 2013/06/11 14:5 |
29 | # the system gem directory, then use the system bin directory, else create | | 29 | # the system gem directory, then use the system bin directory, else create |
30 | # (or use) a new bin dir under the gem_home. | | 30 | # (or use) a new bin dir under the gem_home. |
31 | - @bin_dir = options[:bin_dir] || Gem.bindir(gem_home) | | 31 | - @bin_dir = options[:bin_dir] || Gem.bindir(gem_home) |
32 | + install_root = options[:install_root] | | 32 | + install_root = options[:install_root] |
33 | + @bin_dir = options[:bin_dir] || Gem.bindir(gem_home, install_root) | | 33 | + @bin_dir = options[:bin_dir] || Gem.bindir(gem_home, install_root) |
34 | @development = options[:development] | | 34 | @development = options[:development] |
35 | + unless install_root.nil? or install_root == "" | | 35 | + unless install_root.nil? or install_root == "" |
36 | + @install_root = File.expand_path install_root | | 36 | + @install_root = File.expand_path install_root |
37 | + @gem_home = File.join(@install_root, @gem_home) | | 37 | + @gem_home = File.join(@install_root, @gem_home) |
38 | + end | | 38 | + end |
39 | | | 39 | |
40 | @build_args = options[:build_args] || Gem::Command.build_args | | 40 | @build_args = options[:build_args] || Gem::Command.build_args |
41 | end | | 41 | end |
| | | 42 | @@ -773,7 +782,9 @@ EOF |
| | | 43 | def write_build_info_file |
| | | 44 | return if @build_args.empty? |
| | | 45 | |
| | | 46 | - open spec.build_info_file, 'w' do |io| |
| | | 47 | + build_info_file = (@options[:install_root].nil?) ? spec.build_info_file : |
| | | 48 | + File.join(@options[:install_root], spec.build_info_file) |
| | | 49 | + open build_info_file, 'w' do |io| |
| | | 50 | @build_args.each do |arg| |
| | | 51 | io.puts arg |
| | | 52 | end |