summaryrefslogtreecommitdiffstats
path: root/meta-ruby/recipes-devtools/ruby/ruby/rubygems-1.8.11-binary-extensions.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-ruby/recipes-devtools/ruby/ruby/rubygems-1.8.11-binary-extensions.patch')
-rw-r--r--meta-ruby/recipes-devtools/ruby/ruby/rubygems-1.8.11-binary-extensions.patch296
1 files changed, 296 insertions, 0 deletions
diff --git a/meta-ruby/recipes-devtools/ruby/ruby/rubygems-1.8.11-binary-extensions.patch b/meta-ruby/recipes-devtools/ruby/ruby/rubygems-1.8.11-binary-extensions.patch
new file mode 100644
index 000000000..5a3bfb451
--- /dev/null
+++ b/meta-ruby/recipes-devtools/ruby/ruby/rubygems-1.8.11-binary-extensions.patch
@@ -0,0 +1,296 @@
1From 5a37a3489491a33f2e7011043fbbcd9a765e1777 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/6] Add dedicate extensions folder into $LOAD_PATH.
5
6---
7 lib/rubygems/specification.rb | 37 ++++++++++++++++++++++++++++++-------
8 1 files changed, 30 insertions(+), 7 deletions(-)
9
10diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
11index 97db19e..263e7d3 100644
12--- a/lib/rubygems/specification.rb
13+++ b/lib/rubygems/specification.rb
14@@ -843,6 +843,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@@ -954,16 +960,16 @@ class Gem::Specification
28
29 def contains_requirable_file? file
30 root = full_gem_path
31+ ext = ext_dir
32+
33+ require_paths.any? do |lib|
34+ base = ["#{root}/#{lib}/#{file}"]
35+ base << "#{ext}/#{lib}/#{file}" unless extensions.empty?
36
37- require_paths.each do |lib|
38- base = "#{root}/#{lib}/#{file}"
39- Gem.suffixes.each do |suf|
40- path = "#{base}#{suf}"
41- return true if File.file? path
42+ base.any? do |path|
43+ Gem.suffixes.any? { |suf| File.file? "#{path}#{suf}" }
44 end
45 end
46-
47- return false
48 end
49
50 ##
51@@ -1273,6 +1279,23 @@ class Gem::Specification
52 end
53
54 ##
55+ # Returns the full path to this spec's ext directory.
56+ # eg: /usr/local/lib/ruby/1.8/exts/mygem-1.0
57+
58+ def ext_dir
59+ @gem_dir ||= File.expand_path File.join(exts_dir, full_name)
60+ end
61+
62+ ##
63+ # Returns the full path to the exts directory containing this spec's
64+ # gem directory. eg: /usr/local/lib/ruby/1.8/exts
65+
66+ def exts_dir
67+ # TODO: this logic seems terribly broken, but tests fail if just base_dir
68+ @exts_dir ||= File.join(loaded_from && base_dir || Gem.dir, "exts")
69+ end
70+
71+ ##
72 # Deprecated and ignored, defaults to true.
73 #
74 # Formerly used to indicate this gem was RDoc-capable.
75--
761.7.7.3
77
78
79From 671e4285bf9db948bc5f054d7d3d931cdd7a17f8 Mon Sep 17 00:00:00 2001
80From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
81Date: Wed, 16 Nov 2011 13:26:48 +0100
82Subject: [PATCH 2/6] Use spec's ext dir for extension installation.
83
84---
85 lib/rubygems/installer.rb | 2 +-
86 lib/rubygems/specification.rb | 7 +++----
87 2 files changed, 4 insertions(+), 5 deletions(-)
88
89diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
90index 74d803d..0063c7f 100644
91--- a/lib/rubygems/installer.rb
92+++ b/lib/rubygems/installer.rb
93@@ -499,7 +499,7 @@ TEXT
94 def build_extensions
95 return if spec.extensions.empty?
96 say "Building native extensions. This could take a while..."
97- dest_path = File.join gem_dir, spec.require_paths.first
98+ dest_path = spec.ext_dir
99 ran_rake = false # only run rake once
100
101 spec.extensions.each do |extension|
102diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
103index 263e7d3..d31b93b 100644
104--- a/lib/rubygems/specification.rb
105+++ b/lib/rubygems/specification.rb
106@@ -1283,16 +1283,15 @@ class Gem::Specification
107 # eg: /usr/local/lib/ruby/1.8/exts/mygem-1.0
108
109 def ext_dir
110- @gem_dir ||= File.expand_path File.join(exts_dir, full_name)
111+ @ext_dir ||= File.join exts_dir, full_name, require_paths.first
112 end
113
114 ##
115 # Returns the full path to the exts directory containing this spec's
116- # gem directory. eg: /usr/local/lib/ruby/1.8/exts
117+ # gem directory. eg: /usr/local/lib/ruby/1.8/gems
118
119 def exts_dir
120- # TODO: this logic seems terribly broken, but tests fail if just base_dir
121- @exts_dir ||= File.join(loaded_from && base_dir || Gem.dir, "exts")
122+ @exts_dir ||= gems_dir
123 end
124
125 ##
126--
1271.7.7.3
128
129
130From 11b4a0cbadd8b1d3320f838881aa60feb6f848e7 Mon Sep 17 00:00:00 2001
131From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
132Date: Wed, 16 Nov 2011 14:52:16 +0100
133Subject: [PATCH 3/6] Simplify the extending of $LOAD_PATH for binary gems.
134
135---
136 lib/rubygems/specification.rb | 11 +++++------
137 1 files changed, 5 insertions(+), 6 deletions(-)
138
139diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
140index d31b93b..e65ea2d 100644
141--- a/lib/rubygems/specification.rb
142+++ b/lib/rubygems/specification.rb
143@@ -843,11 +843,7 @@ class Gem::Specification
144 File.join full_gem_path, path
145 end
146
147- unless extensions.empty?
148- paths += require_paths.map do |path|
149- File.join ext_dir, path
150- end
151- end
152+ paths << ext_dir unless extensions.empty? || paths.include?(ext_dir)
153
154 # gem directories must come after -I and ENV['RUBYLIB']
155 insert_index = Gem.load_path_insert_index
156@@ -1291,7 +1287,10 @@ class Gem::Specification
157 # gem directory. eg: /usr/local/lib/ruby/1.8/gems
158
159 def exts_dir
160- @exts_dir ||= gems_dir
161+ @exts_dir ||= begin
162+ dirs = Gem.default_dirs.detect {|location, paths| paths[:gem_dir] == base_dir}
163+ dirs ? File.join(dirs.last[:ext_dir], 'exts') : gems_dir
164+ end
165 end
166
167 ##
168--
1691.7.7.3
170
171
172From 5d46cd2b1ac9517a9cbcfa430261e62bb3a376b8 Mon Sep 17 00:00:00 2001
173From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
174Date: Fri, 9 Dec 2011 16:31:04 +0100
175Subject: [PATCH 4/6] Fix the binary extension search path construction.
176
177---
178 lib/rubygems/installer.rb | 2 +-
179 lib/rubygems/specification.rb | 4 ++--
180 2 files changed, 3 insertions(+), 3 deletions(-)
181
182diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
183index 0063c7f..83b8fd5 100644
184--- a/lib/rubygems/installer.rb
185+++ b/lib/rubygems/installer.rb
186@@ -499,7 +499,7 @@ TEXT
187 def build_extensions
188 return if spec.extensions.empty?
189 say "Building native extensions. This could take a while..."
190- dest_path = spec.ext_dir
191+ dest_path = File.join spec.ext_dir, spec.require_paths.first
192 ran_rake = false # only run rake once
193
194 spec.extensions.each do |extension|
195diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
196index e65ea2d..8be2ade 100644
197--- a/lib/rubygems/specification.rb
198+++ b/lib/rubygems/specification.rb
199@@ -843,7 +843,7 @@ class Gem::Specification
200 File.join full_gem_path, path
201 end
202
203- paths << ext_dir unless extensions.empty? || paths.include?(ext_dir)
204+ paths << File.join(ext_dir, require_paths.first) unless extensions.empty? || (ext_dir == full_gem_path)
205
206 # gem directories must come after -I and ENV['RUBYLIB']
207 insert_index = Gem.load_path_insert_index
208@@ -1279,7 +1279,7 @@ class Gem::Specification
209 # eg: /usr/local/lib/ruby/1.8/exts/mygem-1.0
210
211 def ext_dir
212- @ext_dir ||= File.join exts_dir, full_name, require_paths.first
213+ @ext_dir ||= File.join exts_dir, full_name
214 end
215
216 ##
217--
2181.7.7.3
219
220
221From 6229583633802b45e5a3e5689ab9077347cd9ef7 Mon Sep 17 00:00:00 2001
222From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
223Date: Tue, 13 Dec 2011 12:14:54 +0100
224Subject: [PATCH 5/6] Remove binary extensions during uninstall.
225
226---
227 lib/rubygems/uninstaller.rb | 1 +
228 1 files changed, 1 insertions(+), 0 deletions(-)
229
230diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
231index cc32ea4..94d78e0 100644
232--- a/lib/rubygems/uninstaller.rb
233+++ b/lib/rubygems/uninstaller.rb
234@@ -213,6 +213,7 @@ class Gem::Uninstaller
235 File.writable?(spec.base_dir)
236
237 FileUtils.rm_rf spec.full_gem_path
238+ FileUtils.rm_rf spec.ext_dir
239
240 # TODO: should this be moved to spec?... I vote eww (also exists in docmgr)
241 old_platform_name = [spec.name,
242--
2431.7.7.3
244
245
246From bc40e1b9f60a9a04456e3504ffe6ee600b6da269 Mon Sep 17 00:00:00 2001
247From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
248Date: Tue, 13 Dec 2011 14:27:14 +0100
249Subject: [PATCH 6/6] Avoid dependency on customized operating_system.rb.
250
251---
252 lib/rubygems/defaults.rb | 11 +++++++++++
253 lib/rubygems/specification.rb | 5 +----
254 2 files changed, 12 insertions(+), 4 deletions(-)
255
256diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
257index 20b4198..6d8711f 100644
258--- a/lib/rubygems/defaults.rb
259+++ b/lib/rubygems/defaults.rb
260@@ -87,6 +87,17 @@ module Gem
261 end
262
263 ##
264+ # Returns binary extensions dir for specified RubyGems base dir or nil
265+ # if such directory cannot be determined.
266+ #
267+ # By default, the binary extensions are located side by side with their
268+ # Ruby counterparts, therefore nil is returned
269+
270+ def self.default_ext_dir_for base_dir
271+ nil
272+ end
273+
274+ ##
275 # The default system-wide source info cache directory
276
277 def self.default_system_source_cache_dir
278diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
279index 8be2ade..f54210a 100644
280--- a/lib/rubygems/specification.rb
281+++ b/lib/rubygems/specification.rb
282@@ -1287,10 +1287,7 @@ class Gem::Specification
283 # gem directory. eg: /usr/local/lib/ruby/1.8/gems
284
285 def exts_dir
286- @exts_dir ||= begin
287- dirs = Gem.default_dirs.detect {|location, paths| paths[:gem_dir] == base_dir}
288- dirs ? File.join(dirs.last[:ext_dir], 'exts') : gems_dir
289- end
290+ @exts_dir ||= Gem.default_ext_dir_for(base_dir) || gems_dir
291 end
292
293 ##
294--
2951.7.7.3
296