Gentoo Archives: gentoo-commits

From: Hans de Graaff <graaff@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/ruby-scripts:master commit in: patchsets/patches-2.2.7-r3/
Date: Sun, 23 Jul 2017 08:58:03
Message-Id: 1500800207.d6ddc8a3fc527a644e28937d95f555d51e1c7e55.graaff@gentoo
1 commit: d6ddc8a3fc527a644e28937d95f555d51e1c7e55
2 Author: Hans de Graaff <hans <AT> degraaff <DOT> org>
3 AuthorDate: Sun Jul 23 08:56:47 2017 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Sun Jul 23 08:56:47 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/ruby-scripts.git/commit/?id=d6ddc8a3
7
8 Patch set for 2.2.7-r3
9
10 Add net-smtp-validation patch.
11
12 patchsets/patches-2.2.7-r3/001_ia64.patch | 62 ++++++++++++
13 patchsets/patches-2.2.7-r3/004_gfbsd7.patch | 37 +++++++
14 .../patches-2.2.7-r3/005_no-undefined-ext.patch | 11 +++
15 patchsets/patches-2.2.7-r3/006_tcltk1.patch | 27 +++++
16 patchsets/patches-2.2.7-r3/007_tcltk2.patch | 110 +++++++++++++++++++++
17 .../patches-2.2.7-r3/008-net-smtp-validation.patch | 39 ++++++++
18 patchsets/patches-2.2.7-r3/009_no-gems.patch | 88 +++++++++++++++++
19 7 files changed, 374 insertions(+)
20
21 diff --git a/patchsets/patches-2.2.7-r3/001_ia64.patch b/patchsets/patches-2.2.7-r3/001_ia64.patch
22 new file mode 100644
23 index 0000000..e1e9c89
24 --- /dev/null
25 +++ b/patchsets/patches-2.2.7-r3/001_ia64.patch
26 @@ -0,0 +1,62 @@
27 +Bug: https://bugs.gentoo.org/show_bug.cgi?id=561780
28 +
29 +fix crash on register stack mark/sweep pass
30 +
31 +The crash looks like
32 +
33 + Program received signal SIGSEGV, Segmentation fault.
34 + mark_locations_array (objspace=0x6000000000045db0, x=0x0, n=864692227966763116) at gc.c:3297
35 + 3297 v = *x;
36 + (gdb) bt
37 + #0 mark_locations_array (objspace=0x6000000000045db0, x=0x0, n=864692227966763116) at gc.c:3297
38 + #1 0x400000000014a040 in gc_mark_locations (objspace=0x6000000000045db0, start=0x0, end=0x6000080000000368) at gc.c:3310
39 + #2 0x400000000014b3a0 in mark_current_machine_context (objspace=0x6000000000045db0, th=0x60000000000455b0) at gc.c:3500
40 + #3 0x400000000014dfe0 in gc_mark_roots (objspace=0x6000000000045db0, full_mark=0, categoryp=0x0) at gc.c:4105
41 + #4 0x400000000014e6b0 in gc_marks_body (objspace=0x6000000000045db0, full_mark=0) at gc.c:4164
42 + #5 0x400000000014f260 in gc_marks (objspace=0x6000000000045db0, full_mark=0) at gc.c:4526
43 + #6 0x40000000001525c0 in garbage_collect_body (objspace=0x6000000000045db0, full_mark=0, immediate_sweep=0, reason=256) at gc.c:5024
44 + #7 0x400000000013c010 in heap_prepare_freepage (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1219
45 + #8 0x400000000013c140 in heap_get_freeobj_from_next_freepage (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1237
46 + #9 0x400000000013c360 in heap_get_freeobj (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1259
47 + #10 0x400000000013c950 in newobj_of (klass=0, flags=40, v1=0, v2=0, v3=0) at gc.c:1303
48 + #11 0x400000000013ccc0 in rb_newobj_of (klass=0, flags=40) at gc.c:1356
49 + #12 0x4000000000163740 in hash_alloc (klass=0) at hash.c:289
50 + #13 0x4000000000163860 in rb_hash_new () at hash.c:309
51 + #14 0x400000000050e420 in Init_BareVM () at vm.c:2822
52 + #15 0x40000000000f6b60 in ruby_setup () at eval.c:54
53 + #16 0x40000000000f6f50 in ruby_init () at eval.c:75
54 + #17 0x400000000001b010 in main (argc=9, argv=0x60000fffffffb1d8) at main.c:35
55 +
56 +The problem here is in call
57 + gc_mark_locations (objspace=0x6000000000045db0, start=0x0, end=0x6000080000000368) at gc.c:3310
58 +where 'start' (native_main_thread.register_stack_start)
59 +is supposed to be stack start but it's not initialized.
60 +
61 +The initialization of 'native_main_thread.register_stack_start'
62 +is supposed to be done in 'ruby_init_stack()'.
63 +
64 +But code under 'MAINSTACKADDR_AVAILABLE' exits early.
65 +The fix is to move 'register_stack_start' earlier.
66 +
67 +diff --git a/thread_pthread.c b/thread_pthread.c
68 +index c8a7a16..9ad448b 100644
69 +--- a/thread_pthread.c
70 ++++ b/thread_pthread.c
71 +@@ -722,2 +722,8 @@ ruby_init_stack(volatile VALUE *addr
72 + native_main_thread.id = pthread_self();
73 ++#ifdef __ia64
74 ++ if (!native_main_thread.register_stack_start ||
75 ++ (VALUE*)bsp < native_main_thread.register_stack_start) {
76 ++ native_main_thread.register_stack_start = (VALUE*)bsp;
77 ++ }
78 ++#endif
79 + #if MAINSTACKADDR_AVAILABLE
80 +@@ -745,8 +751,2 @@ ruby_init_stack(volatile VALUE *addr
81 + #endif
82 +-#ifdef __ia64
83 +- if (!native_main_thread.register_stack_start ||
84 +- (VALUE*)bsp < native_main_thread.register_stack_start) {
85 +- native_main_thread.register_stack_start = (VALUE*)bsp;
86 +- }
87 +-#endif
88 + {
89
90 diff --git a/patchsets/patches-2.2.7-r3/004_gfbsd7.patch b/patchsets/patches-2.2.7-r3/004_gfbsd7.patch
91 new file mode 100644
92 index 0000000..450d714
93 --- /dev/null
94 +++ b/patchsets/patches-2.2.7-r3/004_gfbsd7.patch
95 @@ -0,0 +1,37 @@
96 +--- configure.in.orig 2013-05-05 19:36:02.800254192 +0200
97 ++++ configure.in 2013-05-05 19:37:56.573346196 +0200
98 +@@ -2156,7 +2156,7 @@
99 + fi
100 +
101 + AS_CASE(["$target_os"],
102 +-[linux* | gnu* | k*bsd*-gnu | bsdi* | kopensolaris*-gnu | nacl], [
103 ++[linux* | gnu* | k*bsd*-gnu | bsdi* | kopensolaris*-gnu | nacl | freebsd* | dragonfly*], [
104 + if test "$rb_cv_binary_elf" = no; then
105 + with_dln_a_out=yes
106 + else
107 +@@ -2249,7 +2249,7 @@
108 + [bsdi3*], [ AS_CASE(["$CC"],
109 + [*shlicc*], [ : ${LDSHARED='$(CC) -r'}
110 + rb_cv_dlopen=yes])],
111 +- [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu], [
112 ++ [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | freebsd7*], [
113 + : ${LDSHARED='$(CC) -shared'}
114 + if test "$rb_cv_binary_elf" = yes; then
115 + LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
116 +@@ -2262,7 +2262,6 @@
117 + [freebsd*|dragonfly*], [
118 + : ${LDSHARED='$(CC) -shared'}
119 + if test "$rb_cv_binary_elf" = yes; then
120 +- LDFLAGS="$LDFLAGS -rdynamic"
121 + DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$@'
122 + else
123 + test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED='$(LD) -Bshareable'
124 +@@ -2638,7 +2637,7 @@
125 + [sunos4*], [
126 + LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
127 + ],
128 +- [linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu], [
129 ++ [linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu | freebsd7*], [
130 + LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'" $LDFLAGS_OPTDIR"
131 + LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
132 + if test "$load_relative" = yes; then
133
134 diff --git a/patchsets/patches-2.2.7-r3/005_no-undefined-ext.patch b/patchsets/patches-2.2.7-r3/005_no-undefined-ext.patch
135 new file mode 100644
136 index 0000000..f279932
137 --- /dev/null
138 +++ b/patchsets/patches-2.2.7-r3/005_no-undefined-ext.patch
139 @@ -0,0 +1,11 @@
140 +--- ruby-1.9.3-preview1.orig/configure.in
141 ++++ ruby-1.9.3-preview1/configure.in
142 +@@ -2038,7 +2038,7 @@ if test "$with_dln_a_out" != yes; then
143 + [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu], [
144 + : ${LDSHARED='$(CC) -shared'}
145 + if test "$rb_cv_binary_elf" = yes; then
146 +- LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
147 ++ LDFLAGS="$LDFLAGS -Wl,-export-dynamic -Wl,--no-undefined"
148 + fi
149 + rb_cv_dlopen=yes],
150 + [interix*], [ : ${LDSHARED='$(CC) -shared'}
151
152 diff --git a/patchsets/patches-2.2.7-r3/006_tcltk1.patch b/patchsets/patches-2.2.7-r3/006_tcltk1.patch
153 new file mode 100644
154 index 0000000..a0e7444
155 --- /dev/null
156 +++ b/patchsets/patches-2.2.7-r3/006_tcltk1.patch
157 @@ -0,0 +1,27 @@
158 +From ebd0fc80d62eeb7b8556522256f8d035e013eb65 Mon Sep 17 00:00:00 2001
159 +From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
160 +Date: Sun, 2 Aug 2015 01:27:31 +0000
161 +Subject: [PATCH] tcltklib.c: check argument
162 +
163 +* ext/tk/tcltklib.c (ip_cancel_eval_core): check argument type and
164 + length.
165 +
166 +git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
167 +---
168 + ext/tk/tcltklib.c | 3 ++-
169 + 1 file changed, 2 insertions(+), 1 deletion(-)
170 +
171 +diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
172 +index afcee3b..e305c13 100644
173 +--- a/ext/tk/tcltklib.c
174 ++++ b/ext/tk/tcltklib.c
175 +@@ -7745,7 +7745,8 @@ ip_cancel_eval_core(interp, msg, flag)
176 + if (NIL_P(msg)) {
177 + msg_obj = NULL;
178 + } else {
179 +- msg_obj = Tcl_NewStringObj(RSTRING_PTR(msg), RSTRING_LEN(msg));
180 ++ char *s = StringValuePtr(msg);
181 ++ msg_obj = Tcl_NewStringObj(s, RSTRING_LENINT(msg));
182 + Tcl_IncrRefCount(msg_obj);
183 + }
184 +
185
186 diff --git a/patchsets/patches-2.2.7-r3/007_tcltk2.patch b/patchsets/patches-2.2.7-r3/007_tcltk2.patch
187 new file mode 100644
188 index 0000000..2357898
189 --- /dev/null
190 +++ b/patchsets/patches-2.2.7-r3/007_tcltk2.patch
191 @@ -0,0 +1,110 @@
192 +From d098136e3f62a4879a7d7cd34bbd50f482ba3331 Mon Sep 17 00:00:00 2001
193 +From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
194 +Date: Tue, 9 Aug 2016 05:05:11 +0000
195 +Subject: [PATCH] tcltklib.c: use StringValueCStr [ci skip]
196 +
197 +* ext/tk/tcltklib.c (set_max_block_time, tcl_protect_core,
198 + ip_init, ip_create_slave_core, get_obj_from_str,
199 + ip_cancel_eval_core, lib_set_system_encoding,
200 + alloc_invoke_arguments, lib_merge_tklist): use StringValueCStr
201 + instead of StringValuePtr for values to be passed to Tcl
202 + interperter.
203 +
204 +git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
205 +---
206 + ext/tk/tcltklib.c | 26 +++++++++++++-------------
207 + 1 file changed, 13 insertions(+), 13 deletions(-)
208 +
209 +diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
210 +index 430c934..721f497 100644
211 +--- a/ext/tk/tcltklib.c
212 ++++ b/ext/tk/tcltklib.c
213 +@@ -3303,7 +3303,7 @@ tcl_protect_core(interp, proc, data) /* should not raise exception */
214 + DUMP1("set backtrace");
215 + if (!NIL_P(backtrace = rb_funcallv(exc, ID_backtrace, 0, 0))) {
216 + backtrace = rb_ary_join(backtrace, rb_str_new2("\n"));
217 +- Tcl_AddErrorInfo(interp, StringValuePtr(backtrace));
218 ++ Tcl_AddErrorInfo(interp, StringValueCStr(backtrace));
219 + }
220 +
221 + rb_thread_critical = thr_crit_bup;
222 +@@ -6208,19 +6208,19 @@ ip_init(argc, argv, self)
223 + /* without Tk */
224 + with_tk = 0;
225 + } else {
226 +- /* Tcl_SetVar(ptr->ip, "argv", StringValuePtr(opts), 0); */
227 +- Tcl_SetVar(ptr->ip, "argv", StringValuePtr(opts), TCL_GLOBAL_ONLY);
228 ++ /* Tcl_SetVar(ptr->ip, "argv", StringValueCStr(opts), 0); */
229 ++ Tcl_SetVar(ptr->ip, "argv", StringValueCStr(opts), TCL_GLOBAL_ONLY);
230 + Tcl_Eval(ptr->ip, "set argc [llength $argv]");
231 + }
232 + case 1:
233 + /* argv0 */
234 + if (!NIL_P(argv0)) {
235 +- if (strncmp(StringValuePtr(argv0), "-e", 3) == 0
236 +- || strncmp(StringValuePtr(argv0), "-", 2) == 0) {
237 ++ if (strncmp(StringValueCStr(argv0), "-e", 3) == 0
238 ++ || strncmp(StringValueCStr(argv0), "-", 2) == 0) {
239 + Tcl_SetVar(ptr->ip, "argv0", "ruby", TCL_GLOBAL_ONLY);
240 + } else {
241 +- /* Tcl_SetVar(ptr->ip, "argv0", StringValuePtr(argv0), 0); */
242 +- Tcl_SetVar(ptr->ip, "argv0", StringValuePtr(argv0),
243 ++ /* Tcl_SetVar(ptr->ip, "argv0", StringValueCStr(argv0), 0); */
244 ++ Tcl_SetVar(ptr->ip, "argv0", StringValueCStr(argv0),
245 + TCL_GLOBAL_ONLY);
246 + }
247 + }
248 +@@ -6420,7 +6420,7 @@ ip_create_slave_core(interp, argc, argv)
249 + slave->allow_ruby_exit = 0;
250 + slave->return_value = 0;
251 +
252 +- slave->ip = Tcl_CreateSlave(master->ip, StringValuePtr(name), safe);
253 ++ slave->ip = Tcl_CreateSlave(master->ip, StringValueCStr(name), safe);
254 + if (slave->ip == NULL) {
255 + rb_thread_critical = thr_crit_bup;
256 + return rb_exc_new2(rb_eRuntimeError,
257 +@@ -6896,7 +6896,7 @@ static Tcl_Obj *
258 + get_obj_from_str(str)
259 + VALUE str;
260 + {
261 +- const char *s = StringValuePtr(str);
262 ++ const char *s = StringValueCStr(str);
263 +
264 + #if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
265 + return Tcl_NewStringObj((char*)s, RSTRING_LEN(str));
266 +@@ -7744,7 +7744,7 @@ ip_cancel_eval_core(interp, msg, flag)
267 + if (NIL_P(msg)) {
268 + msg_obj = NULL;
269 + } else {
270 +- char *s = StringValuePtr(msg);
271 ++ char *s = StringValueCStr(msg);
272 + msg_obj = Tcl_NewStringObj(s, RSTRING_LENINT(msg));
273 + Tcl_IncrRefCount(msg_obj);
274 + }
275 +@@ -8409,7 +8409,7 @@ lib_set_system_encoding(self, enc_name)
276 +
277 + enc_name = rb_funcallv(enc_name, ID_to_s, 0, 0);
278 + if (Tcl_SetSystemEncoding((Tcl_Interp *)NULL,
279 +- StringValuePtr(enc_name)) != TCL_OK) {
280 ++ StringValueCStr(enc_name)) != TCL_OK) {
281 + rb_raise(rb_eArgError, "unknown encoding name '%s'",
282 + RSTRING_PTR(enc_name));
283 + }
284 +@@ -8850,7 +8850,7 @@ alloc_invoke_arguments(argc, argv)
285 + Tcl_Preserve((ClientData)av); /* XXXXXXXX */
286 + #endif
287 + for (i = 0; i < argc; ++i) {
288 +- av[i] = strdup(StringValuePtr(argv[i]));
289 ++ av[i] = strdup(StringValueCStr(argv[i]));
290 + }
291 + av[argc] = NULL;
292 + #endif
293 +@@ -9854,7 +9854,7 @@ lib_merge_tklist(argc, argv, obj)
294 + len = 1;
295 + for(num = 0; num < argc; num++) {
296 + if (OBJ_TAINTED(argv[num])) taint_flag = 1;
297 +- dst = StringValuePtr(argv[num]);
298 ++ dst = StringValueCStr(argv[num]);
299 + #if TCL_MAJOR_VERSION >= 8
300 + len += Tcl_ScanCountedElement(dst, RSTRING_LENINT(argv[num]),
301 + &flagPtr[num]) + 1;
302
303 diff --git a/patchsets/patches-2.2.7-r3/008-net-smtp-validation.patch b/patchsets/patches-2.2.7-r3/008-net-smtp-validation.patch
304 new file mode 100644
305 index 0000000..0b30c99
306 --- /dev/null
307 +++ b/patchsets/patches-2.2.7-r3/008-net-smtp-validation.patch
308 @@ -0,0 +1,39 @@
309 +From 0827a7e52ba3d957a634b063bf5a391239b9ffee Mon Sep 17 00:00:00 2001
310 +From: shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
311 +Date: Wed, 8 Jun 2016 07:06:57 +0000
312 +Subject: [PATCH] * lib/net/smtp.rb (getok, get_response): raise an
313 + ArgumentError when CR or LF is included in a line, because they are not
314 + allowed in RFC5321.
315 +
316 +git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
317 +---
318 + lib/net/smtp.rb | 9 +++++++++
319 +
320 +diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
321 +index 250293bdbe21..a7130a593b40 100644
322 +--- a/lib/net/smtp.rb
323 ++++ b/lib/net/smtp.rb
324 +@@ -926,7 +926,15 @@ def quit
325 +
326 + private
327 +
328 ++ def validate_line(line)
329 ++ # A bare CR or LF is not allowed in RFC5321.
330 ++ if /[\r\n]/ =~ line
331 ++ raise ArgumentError, "A line must not contain CR or LF"
332 ++ end
333 ++ end
334 ++
335 + def getok(reqline)
336 ++ validate_line reqline
337 + res = critical {
338 + @socket.writeline reqline
339 + recv_response()
340 +@@ -936,6 +944,7 @@ def getok(reqline)
341 + end
342 +
343 + def get_response(reqline)
344 ++ validate_line reqline
345 + @socket.writeline reqline
346 + recv_response()
347 + end
348
349 diff --git a/patchsets/patches-2.2.7-r3/009_no-gems.patch b/patchsets/patches-2.2.7-r3/009_no-gems.patch
350 new file mode 100644
351 index 0000000..a67cbf8
352 --- /dev/null
353 +++ b/patchsets/patches-2.2.7-r3/009_no-gems.patch
354 @@ -0,0 +1,88 @@
355 +--- tool/rbinstall.rb.~1~ 2015-03-25 04:33:14.000000000 +0100
356 ++++ tool/rbinstall.rb 2015-04-14 07:07:01.169073427 +0200
357 +@@ -654,83 +654,11 @@
358 + # :startdoc:
359 +
360 + install?(:ext, :comm, :gem) do
361 +- $:.unshift(File.join(srcdir, "lib"))
362 +- require("rubygems.rb")
363 +- gem_dir = Gem.default_dir
364 +- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
365 +- prepare "default gems", gem_dir, directories
366 +-
367 +- spec_dir = File.join(gem_dir, directories.grep(/^spec/)[0])
368 +- default_spec_dir = "#{spec_dir}/default"
369 +- makedirs(default_spec_dir)
370 +-
371 +- gems = {}
372 +- File.foreach(File.join(srcdir, "defs/default_gems")) do |line|
373 +- line.chomp!
374 +- line.sub!(/\s*#.*/, '')
375 +- next if line.empty?
376 +- words = []
377 +- line.scan(/\G\s*([^\[\]\s]+|\[([^\[\]]*)\])/) do
378 +- words << ($2 ? $2.split : $1)
379 +- end
380 +- name, base_dir, src, execs = *words
381 +- next unless name and base_dir and src
382 +-
383 +- src = File.join(srcdir, src)
384 +- base_dir = File.join(srcdir, base_dir)
385 +- specgen = RbInstall::Specs::Generator.new(name, base_dir, src, execs || [])
386 +- gems[name] ||= specgen
387 +- end
388 +-
389 +- Dir.glob(srcdir+"/{lib,ext}/**/*.gemspec").each do |src|
390 +- specgen = RbInstall::Specs::Reader.new(src)
391 +- gems[specgen.gemspec.name] ||= specgen
392 +- end
393 +-
394 +- gems.sort.each do |name, specgen|
395 +- gemspec = specgen.gemspec
396 +- base_dir = specgen.src.sub(/\A#{Regexp.escape(srcdir)}\//, "")
397 +- full_name = "#{gemspec.name}-#{gemspec.version}"
398 +-
399 +- puts "#{" "*30}#{gemspec.name} #{gemspec.version}"
400 +- gemspec_path = File.join(default_spec_dir, "#{full_name}.gemspec")
401 +- open_for_install(gemspec_path, $data_mode) do
402 +- specgen.spec_source
403 +- end
404 +-
405 +- unless gemspec.executables.empty? then
406 +- bin_dir = File.join(gem_dir, 'gems', full_name, 'bin')
407 +- makedirs(bin_dir)
408 +-
409 +- execs = gemspec.executables.map {|exec| File.join(srcdir, 'bin', exec)}
410 +- install(execs, bin_dir, :mode => $prog_mode)
411 +- end
412 +- end
413 ++ # gems are unbundled in Gentoo.
414 + end
415 +
416 + install?(:ext, :comm, :gem) do
417 +- begin
418 +- require "zlib"
419 +- rescue LoadError
420 +- end
421 +- if defined?(Zlib)
422 +- require 'pathname'
423 +- gem_dir = Gem.default_dir
424 +- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
425 +- prepare "bundle gems", gem_dir, directories
426 +- Dir.glob(srcdir+'/gems/*.gem').each do |gem|
427 +- Gem.install gem, Gem::Requirement.default, :install_dir => with_destdir(Gem.dir), :domain => :local, :ignore_dependencies => true
428 +- gemname = Pathname(gem).basename
429 +- puts "#{" "*30}#{gemname}"
430 +- end
431 +- # fix directory permissions
432 +- # TODO: Gem.install should accept :dir_mode option or something
433 +- File.chmod($dir_mode, *Dir.glob(with_destdir(Gem.dir)+"/**/"))
434 +- # fix .gemspec permissions
435 +- File.chmod($data_mode, *Dir.glob(with_destdir(Gem.dir)+"/specifications/*.gemspec"))
436 +- else
437 +- puts "skip installing bundle gems because of lacking zlib"
438 +- end
439 ++ # gems are unbundled in Gentoo.
440 + end
441 +
442 + parse_args()