Annotation of /trunk/subversion/patches/subversion-1.7.2-ruby19.patch
Parent Directory | Revision Log
Revision 1699 -
(hide annotations)
(download)
Tue Mar 13 17:37:37 2012 UTC (12 years, 6 months ago) by niro
File size: 14010 byte(s)
Tue Mar 13 17:37:37 2012 UTC (12 years, 6 months ago) by niro
File size: 14010 byte(s)
-added patch for ruby-1.9
1 | niro | 1699 | Date: Tue, 20 Dec 2011 21:08:00 -0800 |
2 | From: Vincent Batts <vbatts@slackware.com> | ||
3 | Subject: Re: [PATCH] enabling ruby in the subversion build | ||
4 | Message-ID: <20111221050800.GA17350@slackware.com> | ||
5 | |||
6 | --- subversion-1.7.2/configure.ac.ruby19 | ||
7 | +++ subversion-1.7.2/configure.ac | ||
8 | @@ -1130,14 +1130,29 @@ if test "$RUBY" != "none"; then | ||
9 | ]) | ||
10 | RUBY_MINOR="$svn_cv_ruby_minor" | ||
11 | |||
12 | + # WHY they have not changed the version of there API, I do not know ... | ||
13 | + AC_CACHE_CHECK([for Ruby tiny version], [svn_cv_ruby_tiny],[ | ||
14 | + svn_cv_ruby_tiny="`$RUBY -rrbconfig -e ' | ||
15 | + begin | ||
16 | + print Config::CONFIG.fetch(%q(RUBY_PROGRAM_VERSION)) | ||
17 | + rescue IndexError | ||
18 | + print Config::CONFIG.fetch(%q(TEENY)) | ||
19 | + end | ||
20 | + ' | cut -d . -f 3` " | ||
21 | + ]) | ||
22 | + RUBY_PROGRAM_TINY="$svn_cv_ruby_tiny" | ||
23 | + | ||
24 | AC_SUBST(RUBY_MAJOR) | ||
25 | AC_SUBST(RUBY_MINOR) | ||
26 | - if test ! \( "$RUBY_MAJOR" -eq "1" -a "$RUBY_MINOR" -eq "8" \); then | ||
27 | - # Disallow Ruby 1.9 or later until the binding tests get fixed | ||
28 | - # to run with those versions. | ||
29 | - RUBY="none" | ||
30 | - AC_MSG_WARN([The detected Ruby is too new for Subversion to use]) | ||
31 | - AC_MSG_WARN([Only 1.8.x releases are supported at this time]) | ||
32 | + AC_SUBST(RUBY_PROGRAM_TINY) | ||
33 | + if test ! \( "$RUBY_MAJOR" -eq "1" -a "$RUBY_MINOR" -gt "8" \); then | ||
34 | + if test \( "$RUBY_PROGRAM_TINY" -lt "3" \); then | ||
35 | + # Disallow Ruby 1.9 or later until the binding tests get fixed | ||
36 | + # to run with those versions. | ||
37 | + RUBY="none" | ||
38 | + AC_MSG_WARN([The detected Ruby version issue, for Subversion to use]) | ||
39 | + AC_MSG_WARN([Only 1.8.x or > 1.9.3 releases are supported at this time]) | ||
40 | + fi | ||
41 | fi | ||
42 | else | ||
43 | AC_MSG_RESULT([no]) | ||
44 | --- subversion-1.7.2/Makefile.in.ruby19 | ||
45 | +++ subversion-1.7.2/Makefile.in | ||
46 | @@ -318,7 +318,7 @@ INSTALL_EXTRA_SWIG_RB=\ | ||
47 | $(INSTALL_DATA) "$$i" $(DESTDIR)$(SWIG_RB_SITE_LIB_DIR)/svn; \ | ||
48 | done | ||
49 | |||
50 | -APXS = @APXS@ | ||
51 | +APXS = @APXS@ | ||
52 | |||
53 | PYTHON = @PYTHON@ | ||
54 | PERL = @PERL@ | ||
55 | @@ -818,9 +818,14 @@ swig-rb: autogen-swig-rb | ||
56 | |||
57 | check-swig-rb: swig-rb svnserve | ||
58 | cd $(SWIG_RB_DIR); \ | ||
59 | - $(RUBY) -I $(SWIG_RB_SRC_DIR) \ | ||
60 | - $(SWIG_RB_SRC_DIR)/test/run-test.rb \ | ||
61 | - --verbose=$(SWIG_RB_TEST_VERBOSE) | ||
62 | + if [ "$(RUBY_MAJOR)" -eq 1 -a "$(RUBY_MINOR)" -lt 9 ] ; then \ | ||
63 | + $(RUBY) -I $(SWIG_RB_SRC_DIR) \ | ||
64 | + $(SWIG_RB_SRC_DIR)/test/run-test.rb \ | ||
65 | + --verbose=$(SWIG_RB_TEST_VERBOSE); \ | ||
66 | + else \ | ||
67 | + $(RUBY) -I $(SWIG_RB_SRC_DIR) \ | ||
68 | + $(SWIG_RB_SRC_DIR)/test/run-test.rb; \ | ||
69 | + fi | ||
70 | |||
71 | EXTRACLEAN_SWIG_RB=rm -f $(SWIG_RB_SRC_DIR)/svn_*.c $(SWIG_RB_SRC_DIR)/core.c | ||
72 | |||
73 | --- subversion-1.7.2/subversion/bindings/swig/ruby/svn/info.rb.ruby19 | ||
74 | +++ subversion-1.7.2/subversion/bindings/swig/ruby/svn/info.rb | ||
75 | @@ -229,7 +229,9 @@ module Svn | ||
76 | |||
77 | def parse_diff_unified(entry) | ||
78 | in_content = false | ||
79 | - entry.body.each do |line| | ||
80 | + # accomodation for ruby 1.9 and 1.8 | ||
81 | + each_meth = entry.body.respond_to?(:each_line) ? :each_line : :each | ||
82 | + entry.body.send(each_meth) do |line| | ||
83 | case line | ||
84 | when /^@@/ | ||
85 | in_content = true | ||
86 | --- subversion-1.7.2/subversion/bindings/swig/ruby/svn/util.rb.ruby19 | ||
87 | +++ subversion-1.7.2/subversion/bindings/swig/ruby/svn/util.rb | ||
88 | @@ -36,7 +36,7 @@ module Svn | ||
89 | module Util #:nodoc: | ||
90 | module_function | ||
91 | def to_ruby_class_name(name) | ||
92 | - name.split("_").collect do |x| | ||
93 | + name.to_s.split("_").collect do |x| | ||
94 | "#{x[0,1].upcase}#{x[1..-1].downcase}" | ||
95 | end.join("") | ||
96 | end | ||
97 | --- subversion-1.7.2/subversion/bindings/swig/ruby/test/my-assertions.rb.ruby19 | ||
98 | +++ subversion-1.7.2/subversion/bindings/swig/ruby/test/my-assertions.rb | ||
99 | @@ -24,20 +24,33 @@ module Test | ||
100 | module Unit | ||
101 | module Assertions | ||
102 | |||
103 | + # make an intermediary assertion block handler | ||
104 | + def _my_assert_block(&block) | ||
105 | + if RUBY_VERSION > '1.9' | ||
106 | + assert_block do | ||
107 | + yield | ||
108 | + end | ||
109 | + else | ||
110 | + _wrap_assertion do | ||
111 | + yield | ||
112 | + end | ||
113 | + end | ||
114 | + end | ||
115 | + | ||
116 | def assert_true(boolean, message=nil) | ||
117 | - _wrap_assertion do | ||
118 | + _my_assert_block do | ||
119 | assert_equal(true, boolean, message) | ||
120 | end | ||
121 | end | ||
122 | |||
123 | def assert_false(boolean, message=nil) | ||
124 | - _wrap_assertion do | ||
125 | + _my_assert_block do | ||
126 | assert_equal(false, boolean, message) | ||
127 | end | ||
128 | end | ||
129 | |||
130 | def assert_nested_sorted_array(expected, actual, message=nil) | ||
131 | - _wrap_assertion do | ||
132 | + _my_assert_block do | ||
133 | assert_equal(expected.collect {|elem| elem.sort}, | ||
134 | actual.collect {|elem| elem.sort}, | ||
135 | message) | ||
136 | @@ -45,7 +58,7 @@ module Test | ||
137 | end | ||
138 | |||
139 | def assert_equal_log_entries(expected, actual, message=nil) | ||
140 | - _wrap_assertion do | ||
141 | + _my_assert_block do | ||
142 | actual = actual.collect do |entry| | ||
143 | changed_paths = entry.changed_paths | ||
144 | changed_paths.each_key do |path| | ||
145 | --- subversion-1.7.2/subversion/bindings/swig/ruby/test/test_client.rb.ruby19 | ||
146 | +++ subversion-1.7.2/subversion/bindings/swig/ruby/test/test_client.rb | ||
147 | @@ -2203,7 +2203,11 @@ class SvnClientTest < Test::Unit::TestCa | ||
148 | |||
149 | make_context(log) do |ctx| | ||
150 | items = nil | ||
151 | - ctx.set_log_msg_func do |items| | ||
152 | + ctx.set_log_msg_func do |l_items| | ||
153 | + # ruby 1.8 magically carried the assignment of 'items' back from this Proc block, | ||
154 | + # but in 1.9, we need to have names that don't conflict, and set the outside 'items'. | ||
155 | + # This works in 1.8 as well | ||
156 | + items = l_items | ||
157 | [true, log] | ||
158 | end | ||
159 | |||
160 | --- subversion-1.7.2/subversion/bindings/swig/ruby/test/test_core.rb.ruby19 | ||
161 | +++ subversion-1.7.2/subversion/bindings/swig/ruby/test/test_core.rb | ||
162 | @@ -1,3 +1,4 @@ | ||
163 | +# encoding: UTF-8 | ||
164 | # ==================================================================== | ||
165 | # Licensed to the Apache Software Foundation (ASF) under one | ||
166 | # or more contributor license agreements. See the NOTICE file | ||
167 | @@ -52,7 +53,13 @@ class SvnCoreTest < Test::Unit::TestCase | ||
168 | now = Time.now.gmtime | ||
169 | str = now.strftime("%Y-%m-%dT%H:%M:%S.") + "#{now.usec}Z" | ||
170 | |||
171 | - assert_equal(now, Time.from_svn_format(str)) | ||
172 | + if RUBY_VERSION > '1.9' | ||
173 | + # ruby 1.9 Time comparison gets into the nano-seconds, that strftime | ||
174 | + # shaves off. So we can compare epoch time instead | ||
175 | + assert_equal(now.to_i, Time.from_svn_format(str).gmtime.to_i) | ||
176 | + else | ||
177 | + assert_equal(now, Time.from_svn_format(str).gmtime) | ||
178 | + end | ||
179 | |||
180 | apr_time = now.to_i * 1000000 + now.usec | ||
181 | assert_equal(apr_time, now.to_apr_time) | ||
182 | @@ -244,7 +251,11 @@ class SvnCoreTest < Test::Unit::TestCase | ||
183 | config_infos << [section, name, value] | ||
184 | end | ||
185 | assert_equal(infos.sort, config_infos.sort) | ||
186 | - assert_equal(infos.sort, config.collect {|args| args}.sort) | ||
187 | + if RUBY_VERSION > '1.9' | ||
188 | + assert_equal(infos.sort, config.collect {|sect,name,val| [sect,name,val]}.sort) | ||
189 | + else | ||
190 | + assert_equal(infos.sort, config.collect {|args| args}.sort) | ||
191 | + end | ||
192 | end | ||
193 | |||
194 | def test_config_find_group | ||
195 | @@ -532,7 +543,13 @@ EOD | ||
196 | date_str = now.strftime("%Y-%m-%dT%H:%M:%S") | ||
197 | date_str << ".#{now.usec}Z" | ||
198 | info.date = date_str | ||
199 | - assert_equal(now, info.date) | ||
200 | + if RUBY_VERSION > '1.9' | ||
201 | + # ruby 1.9 Time comparison gets into the nano-seconds, that strftime | ||
202 | + # shaves off. So we can compare epoch time instead | ||
203 | + assert_equal(now.to_i, info.date.gmtime.to_i) | ||
204 | + else | ||
205 | + assert_equal(now, info.date.gmtime) | ||
206 | + end | ||
207 | end | ||
208 | |||
209 | def test_svn_prop | ||
210 | --- subversion-1.7.2/subversion/bindings/swig/ruby/test/test_delta.rb.ruby19 | ||
211 | +++ subversion-1.7.2/subversion/bindings/swig/ruby/test/test_delta.rb | ||
212 | @@ -17,9 +17,10 @@ | ||
213 | # under the License. | ||
214 | # ==================================================================== | ||
215 | |||
216 | +require "my-assertions" | ||
217 | require "util" | ||
218 | require "stringio" | ||
219 | -require 'md5' | ||
220 | +require 'digest/md5' | ||
221 | require 'tempfile' | ||
222 | |||
223 | require "svn/info" | ||
224 | @@ -46,8 +47,8 @@ class SvnDeltaTest < Test::Unit::TestCas | ||
225 | target = StringIO.new(t) | ||
226 | stream = Svn::Delta::TextDeltaStream.new(source, target) | ||
227 | assert_nil(stream.md5_digest) | ||
228 | - _wrap_assertion do | ||
229 | - stream.each do |window| | ||
230 | + _my_assert_block do | ||
231 | + ret = stream.each do |window| | ||
232 | window.ops.each do |op| | ||
233 | op_size = op.offset + op.length | ||
234 | case op.action_code | ||
235 | @@ -62,8 +63,9 @@ class SvnDeltaTest < Test::Unit::TestCas | ||
236 | end | ||
237 | end | ||
238 | end | ||
239 | + true if RUBY_VERSION > '1.9' # this block returns nil in > ruby '1.9' | ||
240 | end | ||
241 | - assert_equal(MD5.new(t).hexdigest, stream.md5_digest) | ||
242 | + assert_equal(Digest::MD5.hexdigest(t), stream.md5_digest) | ||
243 | end | ||
244 | |||
245 | def test_txdelta_window_compose | ||
246 | @@ -81,7 +83,7 @@ class SvnDeltaTest < Test::Unit::TestCas | ||
247 | end | ||
248 | end | ||
249 | |||
250 | - _wrap_assertion do | ||
251 | + assert_block do | ||
252 | composed_window.ops.each do |op| | ||
253 | op_size = op.offset + op.length | ||
254 | case op.action_code | ||
255 | @@ -174,6 +176,7 @@ class SvnDeltaTest < Test::Unit::TestCas | ||
256 | Svn::Delta.send(target_text, handler) | ||
257 | output.rewind | ||
258 | result = output.read | ||
259 | + # FIXME this is needing encoding love on ruby 1.9 | ||
260 | assert_match(/\ASVN.*#{target_text}\z/, result) | ||
261 | |||
262 | # skip svndiff window | ||
263 | --- subversion-1.7.2/subversion/bindings/swig/ruby/test/test_fs.rb.ruby19 | ||
264 | +++ subversion-1.7.2/subversion/bindings/swig/ruby/test/test_fs.rb | ||
265 | @@ -20,7 +20,7 @@ | ||
266 | require "my-assertions" | ||
267 | require "util" | ||
268 | require "time" | ||
269 | -require "md5" | ||
270 | +require "digest/md5" | ||
271 | |||
272 | require "svn/core" | ||
273 | require "svn/fs" | ||
274 | @@ -49,14 +49,15 @@ class SvnFsTest < Test::Unit::TestCase | ||
275 | |||
276 | assert(!File.exist?(path)) | ||
277 | fs = nil | ||
278 | - callback = Proc.new do |fs| | ||
279 | + callback = Proc.new do |t_fs| | ||
280 | assert(File.exist?(path)) | ||
281 | assert_equal(fs_type, Svn::Fs.type(path)) | ||
282 | - fs.set_warning_func do |err| | ||
283 | + t_fs.set_warning_func do |err| | ||
284 | p err | ||
285 | abort | ||
286 | end | ||
287 | - assert_equal(path, fs.path) | ||
288 | + assert_equal(path, t_fs.path) | ||
289 | + fs = t_fs | ||
290 | end | ||
291 | yield(:create, [path, config], callback) | ||
292 | |||
293 | @@ -162,7 +163,7 @@ class SvnFsTest < Test::Unit::TestCase | ||
294 | |||
295 | assert_equal(src, @fs.root.file_contents(path_in_repos){|f| f.read}) | ||
296 | assert_equal(src.length, @fs.root.file_length(path_in_repos)) | ||
297 | - assert_equal(MD5.new(src).hexdigest, | ||
298 | + assert_equal(Digest::MD5.hexdigest(src), | ||
299 | @fs.root.file_md5_checksum(path_in_repos)) | ||
300 | |||
301 | assert_equal([path_in_repos], @fs.root.paths_changed.keys) | ||
302 | @@ -364,7 +365,7 @@ class SvnFsTest < Test::Unit::TestCase | ||
303 | |||
304 | File.open(path, "w") {|f| f.print(modified)} | ||
305 | @fs.transaction do |txn| | ||
306 | - checksum = MD5.new(normalize_line_break(result)).hexdigest | ||
307 | + checksum = Digest::MD5.hexdigest(normalize_line_break(result)) | ||
308 | stream = txn.root.apply_text(path_in_repos, checksum) | ||
309 | stream.write(normalize_line_break(result)) | ||
310 | stream.close | ||
311 | @@ -392,8 +393,8 @@ class SvnFsTest < Test::Unit::TestCase | ||
312 | |||
313 | File.open(path, "w") {|f| f.print(modified)} | ||
314 | @fs.transaction do |txn| | ||
315 | - base_checksum = MD5.new(normalize_line_break(src)).hexdigest | ||
316 | - checksum = MD5.new(normalize_line_break(result)).hexdigest | ||
317 | + base_checksum = Digest::MD5.hexdigest(normalize_line_break(src)) | ||
318 | + checksum = Digest::MD5.hexdigest(normalize_line_break(result)) | ||
319 | handler = txn.root.apply_textdelta(path_in_repos, | ||
320 | base_checksum, checksum) | ||
321 | assert_raises(Svn::Error::ChecksumMismatch) do | ||
322 | --- subversion-1.7.2/subversion/bindings/swig/ruby/test/test_repos.rb.ruby19 | ||
323 | +++ subversion-1.7.2/subversion/bindings/swig/ruby/test/test_repos.rb | ||
324 | @@ -98,11 +98,12 @@ class SvnReposTest < Test::Unit::TestCas | ||
325 | fs_type = Svn::Fs::TYPE_FSFS | ||
326 | fs_config = {Svn::Fs::CONFIG_FS_TYPE => fs_type} | ||
327 | repos = nil | ||
328 | - Svn::Repos.create(tmp_repos_path, {}, fs_config) do |repos| | ||
329 | + Svn::Repos.create(tmp_repos_path, {}, fs_config) do |t_repos| | ||
330 | assert(File.exist?(tmp_repos_path)) | ||
331 | - fs_type_path = File.join(repos.fs.path, Svn::Fs::CONFIG_FS_TYPE) | ||
332 | + fs_type_path = File.join(t_repos.fs.path, Svn::Fs::CONFIG_FS_TYPE) | ||
333 | assert_equal(fs_type, File.open(fs_type_path) {|f| f.read.chop}) | ||
334 | - repos.fs.set_warning_func(&warning_func) | ||
335 | + t_repos.fs.set_warning_func(&warning_func) | ||
336 | + repos = t_repos | ||
337 | end | ||
338 | |||
339 | assert(repos.closed?) | ||
340 | --- subversion-1.7.2/subversion/bindings/swig/ruby/test/test-unit-ext/priority.rb.ruby19 | ||
341 | +++ subversion-1.7.2/subversion/bindings/swig/ruby/test/test-unit-ext/priority.rb | ||
342 | @@ -179,7 +179,7 @@ module Test | ||
343 | apply_priority | ||
344 | !@tests.empty? | ||
345 | end | ||
346 | - end | ||
347 | + end if RUBY_VERSION < '1.9.3' | ||
348 | |||
349 | class AutoRunner | ||
350 | alias_method :original_options, :options | ||
351 | --- subversion-1.7.2/subversion/bindings/swig/ruby/test/test-unit-ext.rb.ruby19 | ||
352 | +++ subversion-1.7.2/subversion/bindings/swig/ruby/test/test-unit-ext.rb | ||
353 | @@ -17,7 +17,7 @@ | ||
354 | # under the License. | ||
355 | # ==================================================================== | ||
356 | |||
357 | -require "test-unit-ext/always-show-result" | ||
358 | +require "test-unit-ext/always-show-result" if RUBY_VERSION < '1.9.3' | ||
359 | require "test-unit-ext/priority" | ||
360 | -require "test-unit-ext/backtrace-filter" | ||
361 | -require "test-unit-ext/long-display-for-emacs" | ||
362 | +require "test-unit-ext/backtrace-filter" if RUBY_VERSION < '1.9.3' | ||
363 | +require "test-unit-ext/long-display-for-emacs" if RUBY_VERSION < '1.9.3' | ||
364 | --- subversion-1.7.2/subversion/bindings/swig/ruby/test/test_wc.rb.ruby19 | ||
365 | +++ subversion-1.7.2/subversion/bindings/swig/ruby/test/test_wc.rb | ||
366 | @@ -530,7 +530,7 @@ EOE | ||
367 | ctx.ci(lf_path) | ||
368 | |||
369 | Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access| | ||
370 | - _wrap_assertion do | ||
371 | + _my_assert_block do | ||
372 | File.open(src_path, "wb") {|f| f.print(source)} | ||
373 | args = [method_name, src_path, crlf_path, Svn::Wc::TRANSLATE_FROM_NF] | ||
374 | result = yield(access.send(*args), source) | ||
375 | @@ -1084,7 +1084,11 @@ EOE | ||
376 | assert_not_nil context | ||
377 | assert_kind_of Svn::Wc::Context, context | ||
378 | end | ||
379 | - assert_nil result; | ||
380 | + if RUBY_VERSION > '1.9' | ||
381 | + assert_equal(result,true) | ||
382 | + else | ||
383 | + assert_nil result | ||
384 | + end | ||
385 | end | ||
386 | end | ||
387 |