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