Fix installation of binary gems.

This commit is contained in:
Vít Ondruch 2013-02-15 18:06:40 +01:00
parent 9c188645b4
commit 929678a63d
2 changed files with 119 additions and 16 deletions

View File

@ -1,7 +1,7 @@
From b95b9942361104dc5b7fd08eb4970f893d8c1a54 Mon Sep 17 00:00:00 2001 From b95b9942361104dc5b7fd08eb4970f893d8c1a54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Wed, 13 Feb 2013 13:12:30 +0100 Date: Wed, 13 Feb 2013 13:12:30 +0100
Subject: [PATCH 1/2] Remove duplicated check. Subject: [PATCH 1/3] Remove duplicated check.
The loaded specifications are rejected already in #gather_dependencies, The loaded specifications are rejected already in #gather_dependencies,
so this condition cannot trigger. so this condition cannot trigger.
@ -30,7 +30,7 @@ index d811f62..dffa8df 100644
From 2fa9087b1986db6c7945c0f997fed2bfff5ce06a Mon Sep 17 00:00:00 2001 From 2fa9087b1986db6c7945c0f997fed2bfff5ce06a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Wed, 13 Feb 2013 15:47:47 +0100 Date: Wed, 13 Feb 2013 15:47:47 +0100
Subject: [PATCH 2/2] Do not modify global Specification.dirs during Subject: [PATCH 2/3] Do not modify global Specification.dirs during
installation. installation.
While gems are installed into --install-dir just fine even without While gems are installed into --install-dir just fine even without
@ -103,3 +103,50 @@ index dffa8df..841f26a 100644
-- --
1.8.1.2 1.8.1.2
From d473204ce920702dd87257db49355929f31530d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Fri, 15 Feb 2013 17:02:44 +0100
Subject: [PATCH 3/3] Default to Gem.dir as late as possible.
---
lib/rubygems/dependency_installer.rb | 2 +-
lib/rubygems/installer.rb | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
index 841f26a..abcfa0f 100644
--- a/lib/rubygems/dependency_installer.rb
+++ b/lib/rubygems/dependency_installer.rb
@@ -346,7 +346,7 @@ class Gem::DependencyInstaller
:force => @force,
:format_executable => @format_executable,
:ignore_dependencies => @ignore_dependencies,
- :install_dir => (@install_dir || Gem.dir),
+ :install_dir => @install_dir,
:security_policy => @security_policy,
:user_install => @user_install,
:wrappers => @wrappers,
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 780a88b..6543130 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -535,13 +535,13 @@ class Gem::Installer
:bin_dir => nil,
:env_shebang => false,
:force => false,
- :install_dir => Gem.dir,
:only_install_dir => false
}.merge options
@env_shebang = options[:env_shebang]
@force = options[:force]
- @gem_home = options[:install_dir]
+ @install_dir = options[:install_dir]
+ @gem_home = options[:install_dir] || Gem.dir
@ignore_dependencies = options[:ignore_dependencies]
@format_executable = options[:format_executable]
@security_policy = options[:security_policy]
--
1.8.1.2

View File

@ -1,7 +1,7 @@
From ec90622235ae19b28a327cb50a10e0311e8f3d71 Mon Sep 17 00:00:00 2001 From ec90622235ae19b28a327cb50a10e0311e8f3d71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Thu, 3 Nov 2011 16:43:05 +0100 Date: Thu, 3 Nov 2011 16:43:05 +0100
Subject: [PATCH 1/7] Add dedicate extensions folder into $LOAD_PATH. Subject: [PATCH 1/9] Add dedicate extensions folder into $LOAD_PATH.
--- ---
lib/rubygems/specification.rb | 32 ++++++++++++++++++++++++++++++-- lib/rubygems/specification.rb | 32 ++++++++++++++++++++++++++++++--
@ -68,13 +68,13 @@ index cabdf8d..87b14d2 100644
# #
# Formerly used to indicate this gem was RDoc-capable. # Formerly used to indicate this gem was RDoc-capable.
-- --
1.8.1 1.8.1.2
From e42819f32fc5d935f7e7189ec4be8bdab0a2cf3f Mon Sep 17 00:00:00 2001 From e42819f32fc5d935f7e7189ec4be8bdab0a2cf3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Wed, 16 Nov 2011 13:26:48 +0100 Date: Wed, 16 Nov 2011 13:26:48 +0100
Subject: [PATCH 2/7] Use spec's ext dir for extension installation. Subject: [PATCH 2/9] Use spec's ext dir for extension installation.
--- ---
lib/rubygems/installer.rb | 2 +- lib/rubygems/installer.rb | 2 +-
@ -119,13 +119,13 @@ index 87b14d2..492ddbe 100644
## ##
-- --
1.8.1 1.8.1.2
From 0e9dd0655111f7dda805233c79a3771459d9a66a Mon Sep 17 00:00:00 2001 From 0e9dd0655111f7dda805233c79a3771459d9a66a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Wed, 16 Nov 2011 14:52:16 +0100 Date: Wed, 16 Nov 2011 14:52:16 +0100
Subject: [PATCH 3/7] Simplify the extending of $LOAD_PATH for binary gems. Subject: [PATCH 3/9] Simplify the extending of $LOAD_PATH for binary gems.
--- ---
lib/rubygems/specification.rb | 11 +++++------ lib/rubygems/specification.rb | 11 +++++------
@ -161,13 +161,13 @@ index 492ddbe..c703827 100644
## ##
-- --
1.8.1 1.8.1.2
From 9a8556c609e800d0dbd24af416d613f2e82f323c Mon Sep 17 00:00:00 2001 From 9a8556c609e800d0dbd24af416d613f2e82f323c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Fri, 9 Dec 2011 16:31:04 +0100 Date: Fri, 9 Dec 2011 16:31:04 +0100
Subject: [PATCH 4/7] Fix the binary extension search path construction. Subject: [PATCH 4/9] Fix the binary extension search path construction.
--- ---
lib/rubygems/installer.rb | 2 +- lib/rubygems/installer.rb | 2 +-
@ -210,13 +210,13 @@ index c703827..fa9ea6e 100644
## ##
-- --
1.8.1 1.8.1.2
From 476c2f90cc6f5f490858f253a9b23eb19d53d2fc Mon Sep 17 00:00:00 2001 From 476c2f90cc6f5f490858f253a9b23eb19d53d2fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Tue, 13 Dec 2011 12:14:54 +0100 Date: Tue, 13 Dec 2011 12:14:54 +0100
Subject: [PATCH 5/7] Remove binary extensions during uninstall. Subject: [PATCH 5/9] Remove binary extensions during uninstall.
--- ---
lib/rubygems/uninstaller.rb | 1 + lib/rubygems/uninstaller.rb | 1 +
@ -235,13 +235,13 @@ index d672b9d..5c31a0c 100644
# TODO: should this be moved to spec?... I vote eww (also exists in docmgr) # TODO: should this be moved to spec?... I vote eww (also exists in docmgr)
old_platform_name = [spec.name, old_platform_name = [spec.name,
-- --
1.8.1 1.8.1.2
From 35dc17e86f701fe1be80d98ace79735c535fd570 Mon Sep 17 00:00:00 2001 From 35dc17e86f701fe1be80d98ace79735c535fd570 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Tue, 13 Dec 2011 14:27:14 +0100 Date: Tue, 13 Dec 2011 14:27:14 +0100
Subject: [PATCH 6/7] Avoid dependency on customized operating_system.rb. Subject: [PATCH 6/9] Avoid dependency on customized operating_system.rb.
--- ---
lib/rubygems/defaults.rb | 11 +++++++++++ lib/rubygems/defaults.rb | 11 +++++++++++
@ -287,13 +287,13 @@ index fa9ea6e..2b10499 100644
## ##
-- --
1.8.1 1.8.1.2
From 0937c0b0a3c2ed08ab5b0875f7f95e24157525c2 Mon Sep 17 00:00:00 2001 From 0937c0b0a3c2ed08ab5b0875f7f95e24157525c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Thu, 7 Feb 2013 13:07:34 +0100 Date: Thu, 7 Feb 2013 13:07:34 +0100
Subject: [PATCH 7/7] Fix binary extensions installation when --install-dir is Subject: [PATCH 7/9] Fix binary extensions installation when --install-dir is
specified. specified.
--- ---
@ -314,5 +314,61 @@ index f1f2ad7..e1577fc 100644
spec.extensions.each do |extension| spec.extensions.each do |extension|
-- --
1.8.1 1.8.1.2
From 4d9675cab5decaef3c9f7f91b2f9c9abd2a19cea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Fri, 15 Feb 2013 16:24:29 +0100
Subject: [PATCH 8/9] mkmf does not create folder for binary extensions
anymore.
This was dropped in Ruby r37016 for some reasons :/
---
lib/rubygems/ext/builder.rb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index d7d953f..812c20c 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -21,6 +21,10 @@ class Gem::Ext::Builder
mf = mf.gsub(/^RUBYLIBDIR\s*=\s*\$[^$]*/, "RUBYLIBDIR = #{dest_path}")
mf = mf.gsub(/\s*\S+\.time$/, "")
+ # Folder creation was dropped in r37016 for some reasons :/
+ target_prefix = mf[/^target_prefix\s*=\s*(.*)/, 1]
+ FileUtils.mkdir_p File.join(dest_path, target_prefix) rescue nil # in case of perms issues -- lame
+
File.open('Makefile', 'wb') {|f| f.print mf}
# try to find make program from Ruby configure arguments first
--
1.8.1.2
From 062a11c59731f5875d5a8821a212c8a41cb84577 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Fri, 15 Feb 2013 17:07:07 +0100
Subject: [PATCH 9/9] Use correct option.
---
lib/rubygems/installer.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index e1577fc..1492c68 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -642,7 +642,7 @@ TEXT
say "This could take a while..."
end
- dest_path = File.join(options[:install_dir] ? gem_dir : spec.ext_dir, spec.require_paths.first)
+ dest_path = File.join(@install_dir ? gem_dir : spec.ext_dir, spec.require_paths.first)
ran_rake = false # only run rake once
spec.extensions.each do |extension|
--
1.8.1.2