]> git.pld-linux.org Git - packages/ruby.git/blame - rubygems-2.0.0-binary-extensions.patch
- unconditional noarch subpackages
[packages/ruby.git] / rubygems-2.0.0-binary-extensions.patch
CommitLineData
c0484a8d
ER
1From ec90622235ae19b28a327cb50a10e0311e8f3d71 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
3Date: Thu, 3 Nov 2011 16:43:05 +0100
4Subject: [PATCH 1/8] Add dedicate extensions folder into $LOAD_PATH.
5
6---
7 lib/rubygems/specification.rb | 32 ++++++++++++++++++++++++++++++--
8 1 file changed, 30 insertions(+), 2 deletions(-)
9
10diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
11index cabdf8d..87b14d2 100644
12--- a/lib/rubygems/specification.rb
13+++ b/lib/rubygems/specification.rb
14@@ -1256,6 +1256,12 @@ class Gem::Specification
15 File.join full_gem_path, path
16 end
17
18+ unless extensions.empty?
19+ paths += require_paths.map do |path|
20+ File.join ext_dir, path
21+ end
22+ end
23+
24 # gem directories must come after -I and ENV['RUBYLIB']
25 insert_index = Gem.load_path_insert_index
26
27@@ -1374,11 +1380,16 @@ class Gem::Specification
28
29 def contains_requirable_file? file
30 root = full_gem_path
31+ ext = ext_dir
32 suffixes = Gem.suffixes
33
34 require_paths.any? do |lib|
35- base = "#{root}/#{lib}/#{file}"
36- suffixes.any? { |suf| File.file? "#{base}#{suf}" }
37+ base = ["#{root}/#{lib}/#{file}"]
38+ base << "#{ext}/#{lib}/#{file}" unless extensions.empty?
39+
40+ base.any? do |path|
41+ suffixes.any? { |suf| File.file? "#{path}#{suf}" }
42+ end
43 end
44 end
45
46@@ -1674,6 +1685,23 @@ class Gem::Specification
47 end
48
49 ##
50+ # Returns the full path to this spec's ext directory.
51+ # eg: /usr/local/lib/ruby/1.8/exts/mygem-1.0
52+
53+ def ext_dir
54+ @gem_dir ||= File.expand_path File.join(exts_dir, full_name)
55+ end
56+
57+ ##
58+ # Returns the full path to the exts directory containing this spec's
59+ # gem directory. eg: /usr/local/lib/ruby/1.8/exts
60+
61+ def exts_dir
62+ # TODO: this logic seems terribly broken, but tests fail if just base_dir
63+ @exts_dir ||= File.join(loaded_from && base_dir || Gem.dir, "exts")
64+ end
65+
66+ ##
67 # Deprecated and ignored, defaults to true.
68 #
69 # Formerly used to indicate this gem was RDoc-capable.
70--
711.8.1.2
72
73
74From e42819f32fc5d935f7e7189ec4be8bdab0a2cf3f Mon Sep 17 00:00:00 2001
75From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
76Date: Wed, 16 Nov 2011 13:26:48 +0100
77Subject: [PATCH 2/8] Use spec's ext dir for extension installation.
78
79---
80 lib/rubygems/installer.rb | 2 +-
81 lib/rubygems/specification.rb | 7 +++----
82 2 files changed, 4 insertions(+), 5 deletions(-)
83
84diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
85index 780a88b..854c177 100644
86--- a/lib/rubygems/installer.rb
87+++ b/lib/rubygems/installer.rb
88@@ -646,7 +646,7 @@ TEXT
89 say "This could take a while..."
90 end
91
92- dest_path = File.join gem_dir, spec.require_paths.first
93+ dest_path = spec.ext_dir
94 ran_rake = false # only run rake once
95
96 spec.extensions.each do |extension|
97diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
98index 87b14d2..492ddbe 100644
99--- a/lib/rubygems/specification.rb
100+++ b/lib/rubygems/specification.rb
101@@ -1689,16 +1689,15 @@ class Gem::Specification
102 # eg: /usr/local/lib/ruby/1.8/exts/mygem-1.0
103
104 def ext_dir
105- @gem_dir ||= File.expand_path File.join(exts_dir, full_name)
106+ @ext_dir ||= File.join exts_dir, full_name, require_paths.first
107 end
108
109 ##
110 # Returns the full path to the exts directory containing this spec's
111- # gem directory. eg: /usr/local/lib/ruby/1.8/exts
112+ # gem directory. eg: /usr/local/lib/ruby/1.8/gems
113
114 def exts_dir
115- # TODO: this logic seems terribly broken, but tests fail if just base_dir
116- @exts_dir ||= File.join(loaded_from && base_dir || Gem.dir, "exts")
117+ @exts_dir ||= gems_dir
118 end
119
120 ##
121--
1221.8.1.2
123
124
125From 0e9dd0655111f7dda805233c79a3771459d9a66a Mon Sep 17 00:00:00 2001
126From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
127Date: Wed, 16 Nov 2011 14:52:16 +0100
128Subject: [PATCH 3/9] Simplify the extending of $LOAD_PATH for binary gems.
129
130---
131 lib/rubygems/specification.rb | 11 +++++------
132 1 file changed, 5 insertions(+), 6 deletions(-)
133
134diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
135index 492ddbe..c703827 100644
136--- a/lib/rubygems/specification.rb
137+++ b/lib/rubygems/specification.rb
138@@ -1256,11 +1256,7 @@ class Gem::Specification
139 File.join full_gem_path, path
140 end
141
142- unless extensions.empty?
143- paths += require_paths.map do |path|
144- File.join ext_dir, path
145- end
146- end
147+ paths << ext_dir unless extensions.empty? || paths.include?(ext_dir)
148
149 # gem directories must come after -I and ENV['RUBYLIB']
150 insert_index = Gem.load_path_insert_index
151@@ -1697,7 +1693,10 @@ class Gem::Specification
152 # gem directory. eg: /usr/local/lib/ruby/1.8/gems
153
154 def exts_dir
155- @exts_dir ||= gems_dir
156+ @exts_dir ||= begin
157+ dirs = Gem.default_dirs.detect {|location, paths| paths[:gem_dir] == base_dir}
158+ dirs ? File.join(dirs.last[:ext_dir], 'exts') : gems_dir
159+ end
160 end
161
162 ##
163--
1641.8.1.2
165
166
167From 9a8556c609e800d0dbd24af416d613f2e82f323c Mon Sep 17 00:00:00 2001
168From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
169Date: Fri, 9 Dec 2011 16:31:04 +0100
170Subject: [PATCH 4/8] Fix the binary extension search path construction.
171
172---
173 lib/rubygems/installer.rb | 2 +-
174 lib/rubygems/specification.rb | 4 ++--
175 2 files changed, 3 insertions(+), 3 deletions(-)
176
177diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
178index 854c177..f1f2ad7 100644
179--- a/lib/rubygems/installer.rb
180+++ b/lib/rubygems/installer.rb
181@@ -646,7 +646,7 @@ TEXT
182 say "This could take a while..."
183 end
184
185- dest_path = spec.ext_dir
186+ dest_path = File.join spec.ext_dir, spec.require_paths.first
187 ran_rake = false # only run rake once
188
189 spec.extensions.each do |extension|
190diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
191index c703827..fa9ea6e 100644
192--- a/lib/rubygems/specification.rb
193+++ b/lib/rubygems/specification.rb
194@@ -1256,7 +1256,7 @@ class Gem::Specification
195 File.join full_gem_path, path
196 end
197
198- paths << ext_dir unless extensions.empty? || paths.include?(ext_dir)
199+ paths << File.join(ext_dir, require_paths.first) unless extensions.empty? || (ext_dir == full_gem_path)
200
201 # gem directories must come after -I and ENV['RUBYLIB']
202 insert_index = Gem.load_path_insert_index
203@@ -1685,7 +1685,7 @@ class Gem::Specification
204 # eg: /usr/local/lib/ruby/1.8/exts/mygem-1.0
205
206 def ext_dir
207- @ext_dir ||= File.join exts_dir, full_name, require_paths.first
208+ @ext_dir ||= File.join exts_dir, full_name
209 end
210
211 ##
212--
2131.8.1.2
214
215
216From 476c2f90cc6f5f490858f253a9b23eb19d53d2fc Mon Sep 17 00:00:00 2001
217From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
218Date: Tue, 13 Dec 2011 12:14:54 +0100
219Subject: [PATCH 5/8] Remove binary extensions during uninstall.
220
221---
222 lib/rubygems/uninstaller.rb | 1 +
223 1 file changed, 1 insertion(+)
224
225diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
226index d672b9d..5c31a0c 100644
227--- a/lib/rubygems/uninstaller.rb
228+++ b/lib/rubygems/uninstaller.rb
229@@ -246,6 +246,7 @@ class Gem::Uninstaller
230 File.writable?(spec.base_dir)
231
232 FileUtils.rm_rf spec.full_gem_path
233+ FileUtils.rm_rf spec.ext_dir
234
235 # TODO: should this be moved to spec?... I vote eww (also exists in docmgr)
236 old_platform_name = [spec.name,
237--
2381.8.1.2
239
240
241From 35dc17e86f701fe1be80d98ace79735c535fd570 Mon Sep 17 00:00:00 2001
242From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
243Date: Tue, 13 Dec 2011 14:27:14 +0100
244Subject: [PATCH 6/8] Avoid dependency on customized operating_system.rb.
245
246---
247 lib/rubygems/defaults.rb | 11 +++++++++++
248 lib/rubygems/specification.rb | 5 +----
249 2 files changed, 12 insertions(+), 4 deletions(-)
250
251diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
252index ea84e5c..b221954 100644
253--- a/lib/rubygems/defaults.rb
254+++ b/lib/rubygems/defaults.rb
255@@ -101,6 +101,17 @@ module Gem
256 end
257
258 ##
259+ # Returns binary extensions dir for specified RubyGems base dir or nil
260+ # if such directory cannot be determined.
261+ #
262+ # By default, the binary extensions are located side by side with their
263+ # Ruby counterparts, therefore nil is returned
264+
265+ def self.default_ext_dir_for base_dir
266+ nil
267+ end
268+
269+ ##
270 # A wrapper around RUBY_ENGINE const that may not be defined
271
272 def self.ruby_engine
273diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
274index fa9ea6e..2b10499 100644
275--- a/lib/rubygems/specification.rb
276+++ b/lib/rubygems/specification.rb
277@@ -1693,10 +1693,7 @@ class Gem::Specification
278 # gem directory. eg: /usr/local/lib/ruby/1.8/gems
279
280 def exts_dir
281- @exts_dir ||= begin
282- dirs = Gem.default_dirs.detect {|location, paths| paths[:gem_dir] == base_dir}
283- dirs ? File.join(dirs.last[:ext_dir], 'exts') : gems_dir
284- end
285+ @exts_dir ||= Gem.default_ext_dir_for(base_dir) || gems_dir
286 end
287
288 ##
289--
2901.8.1.2
291
292
293From 0937c0b0a3c2ed08ab5b0875f7f95e24157525c2 Mon Sep 17 00:00:00 2001
294From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
295Date: Thu, 7 Feb 2013 13:07:34 +0100
296Subject: [PATCH 7/8] Fix binary extensions installation when --install-dir is
297 specified.
298
299---
300 lib/rubygems/installer.rb | 2 +-
301 1 file changed, 1 insertion(+), 1 deletion(-)
302
303diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
304index f1f2ad7..e1577fc 100644
305--- a/lib/rubygems/installer.rb
306+++ b/lib/rubygems/installer.rb
307@@ -646,7 +646,7 @@ TEXT
308 say "This could take a while..."
309 end
310
311- dest_path = File.join spec.ext_dir, spec.require_paths.first
312+ dest_path = File.join(options[:install_dir] ? gem_dir : spec.ext_dir, spec.require_paths.first)
313 ran_rake = false # only run rake once
314
315 spec.extensions.each do |extension|
316--
3171.8.1.2
318
319
320From 062a11c59731f5875d5a8821a212c8a41cb84577 Mon Sep 17 00:00:00 2001
321From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
322Date: Fri, 15 Feb 2013 17:07:07 +0100
323Subject: [PATCH 8/8] Use correct option.
324
325---
326 lib/rubygems/installer.rb | 2 +-
327 1 file changed, 1 insertion(+), 1 deletion(-)
328
329diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
330index e1577fc..1492c68 100644
331--- a/lib/rubygems/installer.rb
332+++ b/lib/rubygems/installer.rb
333@@ -646,7 +646,7 @@ TEXT
334 say "This could take a while..."
335 end
336
337- dest_path = File.join(options[:install_dir] ? gem_dir : spec.ext_dir, spec.require_paths.first)
338+ dest_path = File.join(@install_dir ? gem_dir : spec.ext_dir, spec.require_paths.first)
339 ran_rake = false # only run rake once
340
341 spec.extensions.each do |extension|
342--
3431.8.1.2
344
This page took 0.115403 seconds and 4 git commands to generate.