Magellan Linux

Annotation of /trunk/subversion/patches/subversion-1.7.10-ruby20.patch

Parent Directory Parent Directory | Revision Log Revision Log


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