subversion 1.6.6-x86-mswin32-60 → 1.6.11-x86-mswin32-60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/licenses/apr-util/NOTICE +1 -1
- data/licenses/apr/NOTICE +1 -1
- data/licenses/zlib/README +37 -48
- data/readme.txt +20 -0
- data/{ruby → subversion}/ext/svn/ext/client.dll +0 -0
- data/subversion/ext/svn/ext/core.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/delta.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/fs.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/intl3_svn.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libapr-1.dll +0 -0
- data/subversion/ext/svn/ext/libaprutil-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libdb44.dll +0 -0
- data/subversion/ext/svn/ext/libsasl.dll +0 -0
- data/subversion/ext/svn/ext/libsvn_client-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libsvn_delta-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libsvn_diff-1.dll +0 -0
- data/subversion/ext/svn/ext/libsvn_fs-1.dll +0 -0
- data/subversion/ext/svn/ext/libsvn_ra-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libsvn_repos-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libsvn_subr-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libsvn_swig_ruby-1.dll +0 -0
- data/subversion/ext/svn/ext/libsvn_wc-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/ra.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/repos.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/wc.dll +0 -0
- data/{ruby → subversion}/lib/svn/client.rb +0 -0
- data/{ruby → subversion}/lib/svn/core.rb +0 -0
- data/{ruby → subversion}/lib/svn/delta.rb +2 -2
- data/{ruby → subversion}/lib/svn/error.rb +0 -0
- data/{ruby → subversion}/lib/svn/fs.rb +0 -0
- data/{ruby → subversion}/lib/svn/info.rb +0 -0
- data/{ruby → subversion}/lib/svn/ra.rb +0 -0
- data/{ruby → subversion}/lib/svn/repos.rb +0 -0
- data/{ruby → subversion}/lib/svn/util.rb +0 -0
- data/{ruby → subversion}/lib/svn/wc.rb +0 -0
- data/subversion/test/greek_tree.rb +63 -0
- data/subversion/test/my-assertions.rb +48 -0
- data/subversion/test/run-test.rb +35 -0
- data/subversion/test/test-unit-ext.rb +4 -0
- data/subversion/test/test-unit-ext/always-show-result.rb +28 -0
- data/subversion/test/test-unit-ext/backtrace-filter.rb +17 -0
- data/subversion/test/test-unit-ext/long-display-for-emacs.rb +25 -0
- data/subversion/test/test-unit-ext/priority.rb +176 -0
- data/subversion/test/test_client.rb +2457 -0
- data/subversion/test/test_core.rb +849 -0
- data/subversion/test/test_delta.rb +497 -0
- data/subversion/test/test_error.rb +16 -0
- data/subversion/test/test_fs.rb +519 -0
- data/subversion/test/test_info.rb +331 -0
- data/subversion/test/test_ra.rb +436 -0
- data/subversion/test/test_repos.rb +872 -0
- data/subversion/test/test_util.rb +18 -0
- data/subversion/test/test_wc.rb +1063 -0
- data/subversion/test/util.rb +292 -0
- data/subversion/test/windows_util.rb +263 -0
- metadata +71 -39
- data/ruby/ext/svn/ext/core.dll +0 -0
- data/ruby/ext/svn/ext/libaprutil-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_client-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_fs-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_ra-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_wc-1.dll +0 -0
@@ -0,0 +1,292 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require "pathname"
|
3
|
+
|
4
|
+
require "my-assertions"
|
5
|
+
|
6
|
+
class Time
|
7
|
+
unless instance_methods.include?("to_int")
|
8
|
+
alias to_int to_i
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'greek_tree'
|
13
|
+
|
14
|
+
module SvnTestUtil
|
15
|
+
def setup_default_variables
|
16
|
+
@author = ENV["USER"] || "sample-user"
|
17
|
+
@password = "sample-password"
|
18
|
+
@realm = "sample realm"
|
19
|
+
@repos_path = "repos"
|
20
|
+
@full_repos_path = File.expand_path(@repos_path)
|
21
|
+
@repos_uri = "file://#{@full_repos_path.sub(/^\/?/, '/')}"
|
22
|
+
@svnserve_host = "127.0.0.1"
|
23
|
+
@svnserve_ports = (64152..64282).collect{|x| x.to_s}
|
24
|
+
@wc_base_dir = "wc-tmp"
|
25
|
+
@wc_path = File.join(@wc_base_dir, "wc")
|
26
|
+
@full_wc_path = File.expand_path(@wc_path)
|
27
|
+
@tmp_path = "tmp"
|
28
|
+
@config_path = "config"
|
29
|
+
@greek = Greek.new(@tmp_path, @wc_path, @repos_uri)
|
30
|
+
end
|
31
|
+
|
32
|
+
def setup_basic(need_svnserve=false)
|
33
|
+
@need_svnserve = need_svnserve
|
34
|
+
setup_default_variables
|
35
|
+
setup_tmp
|
36
|
+
setup_repository
|
37
|
+
add_hooks
|
38
|
+
setup_svnserve if @need_svnserve
|
39
|
+
setup_config
|
40
|
+
setup_wc
|
41
|
+
add_authentication
|
42
|
+
GC.stress = true if GC.respond_to?(:stress=) and $DEBUG
|
43
|
+
end
|
44
|
+
|
45
|
+
def teardown_basic
|
46
|
+
GC.stress = false if GC.respond_to?(:stress=)
|
47
|
+
teardown_svnserve if @need_svnserve
|
48
|
+
teardown_repository
|
49
|
+
teardown_wc
|
50
|
+
teardown_config
|
51
|
+
teardown_tmp
|
52
|
+
gc
|
53
|
+
end
|
54
|
+
|
55
|
+
def gc
|
56
|
+
if $DEBUG
|
57
|
+
before_pools = Svn::Core::Pool.number_of_pools
|
58
|
+
puts
|
59
|
+
puts "before pools: #{before_pools}"
|
60
|
+
end
|
61
|
+
gc_enable do
|
62
|
+
GC.start
|
63
|
+
end
|
64
|
+
if $DEBUG
|
65
|
+
after_pools = Svn::Core::Pool.number_of_pools
|
66
|
+
puts "after pools: #{after_pools}"
|
67
|
+
STDOUT.flush
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def change_gc_status(prev_disabled)
|
72
|
+
begin
|
73
|
+
yield
|
74
|
+
ensure
|
75
|
+
if prev_disabled
|
76
|
+
GC.disable
|
77
|
+
else
|
78
|
+
GC.enable
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def gc_disable(&block)
|
84
|
+
change_gc_status(GC.disable, &block)
|
85
|
+
end
|
86
|
+
|
87
|
+
def gc_enable(&block)
|
88
|
+
change_gc_status(GC.enable, &block)
|
89
|
+
end
|
90
|
+
|
91
|
+
def setup_tmp(path=@tmp_path)
|
92
|
+
FileUtils.rm_rf(path)
|
93
|
+
FileUtils.mkdir_p(path)
|
94
|
+
end
|
95
|
+
|
96
|
+
def teardown_tmp(path=@tmp_path)
|
97
|
+
FileUtils.rm_rf(path)
|
98
|
+
end
|
99
|
+
|
100
|
+
def setup_repository(path=@repos_path, config={}, fs_config={})
|
101
|
+
require "svn/repos"
|
102
|
+
FileUtils.rm_rf(path)
|
103
|
+
FileUtils.mkdir_p(File.dirname(path))
|
104
|
+
@repos = Svn::Repos.create(path, config, fs_config)
|
105
|
+
@fs = @repos.fs
|
106
|
+
end
|
107
|
+
|
108
|
+
def teardown_repository(path=@repos_path)
|
109
|
+
@fs.close unless @fs.nil?
|
110
|
+
@repos.close unless @repos.nil?
|
111
|
+
Svn::Repos.delete(path) if File.exists?(path)
|
112
|
+
@repos = nil
|
113
|
+
@fs = nil
|
114
|
+
end
|
115
|
+
|
116
|
+
def setup_wc
|
117
|
+
teardown_wc
|
118
|
+
make_context("").checkout(@repos_uri, @wc_path)
|
119
|
+
end
|
120
|
+
|
121
|
+
def teardown_wc
|
122
|
+
FileUtils.rm_rf(@wc_base_dir)
|
123
|
+
end
|
124
|
+
|
125
|
+
def setup_config
|
126
|
+
teardown_config
|
127
|
+
Svn::Core::Config.ensure(@config_path)
|
128
|
+
end
|
129
|
+
|
130
|
+
def teardown_config
|
131
|
+
FileUtils.rm_rf(@config_path)
|
132
|
+
end
|
133
|
+
|
134
|
+
def add_authentication
|
135
|
+
passwd_file = "passwd"
|
136
|
+
File.open(@repos.svnserve_conf, "w") do |conf|
|
137
|
+
conf.print <<-CONF
|
138
|
+
[general]
|
139
|
+
anon-access = none
|
140
|
+
auth-access = write
|
141
|
+
password-db = #{passwd_file}
|
142
|
+
realm = #{@realm}
|
143
|
+
CONF
|
144
|
+
end
|
145
|
+
File.open(File.join(@repos.conf_dir, passwd_file), "w") do |f|
|
146
|
+
f.print <<-PASSWD
|
147
|
+
[users]
|
148
|
+
#{@author} = #{@password}
|
149
|
+
PASSWD
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def add_hooks
|
154
|
+
add_pre_revprop_change_hook
|
155
|
+
end
|
156
|
+
|
157
|
+
def youngest_rev
|
158
|
+
@fs.youngest_rev
|
159
|
+
end
|
160
|
+
|
161
|
+
def root(rev=nil)
|
162
|
+
@fs.root(rev)
|
163
|
+
end
|
164
|
+
|
165
|
+
def prop(name, rev=nil)
|
166
|
+
@fs.prop(name, rev)
|
167
|
+
end
|
168
|
+
|
169
|
+
def make_context(log)
|
170
|
+
ctx = Svn::Client::Context.new
|
171
|
+
ctx.set_log_msg_func do |items|
|
172
|
+
[true, log]
|
173
|
+
end
|
174
|
+
ctx.add_username_prompt_provider(0) do |cred, realm, username, may_save|
|
175
|
+
cred.username = @author
|
176
|
+
cred.may_save = false
|
177
|
+
end
|
178
|
+
setup_auth_baton(ctx.auth_baton)
|
179
|
+
return ctx unless block_given?
|
180
|
+
begin
|
181
|
+
yield ctx
|
182
|
+
ensure
|
183
|
+
ctx.destroy
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
def setup_auth_baton(auth_baton)
|
188
|
+
auth_baton[Svn::Core::AUTH_PARAM_CONFIG_DIR] = @config_path
|
189
|
+
auth_baton[Svn::Core::AUTH_PARAM_DEFAULT_USERNAME] = @author
|
190
|
+
end
|
191
|
+
|
192
|
+
def normalize_line_break(str)
|
193
|
+
if windows?
|
194
|
+
str.gsub(/\n/, "\r\n")
|
195
|
+
else
|
196
|
+
str
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def setup_greek_tree
|
201
|
+
@greek.setup(make_context("setup greek tree"))
|
202
|
+
end
|
203
|
+
|
204
|
+
module_function
|
205
|
+
def windows?
|
206
|
+
/cygwin|mingw|mswin32|bccwin32/.match(RUBY_PLATFORM)
|
207
|
+
end
|
208
|
+
|
209
|
+
module Svnserve
|
210
|
+
def setup_svnserve
|
211
|
+
@svnserve_port = nil
|
212
|
+
@repos_svnserve_uri = nil
|
213
|
+
|
214
|
+
# Look through the list of potential ports until we're able to
|
215
|
+
# successfully start svnserve on a free one.
|
216
|
+
@svnserve_ports.each do |port|
|
217
|
+
@svnserve_pid = fork {
|
218
|
+
STDERR.close
|
219
|
+
exec("svnserve",
|
220
|
+
"--listen-host", @svnserve_host,
|
221
|
+
"--listen-port", port,
|
222
|
+
"-d", "--foreground")
|
223
|
+
}
|
224
|
+
pid, status = Process.waitpid2(@svnserve_pid, Process::WNOHANG)
|
225
|
+
if status and status.exited?
|
226
|
+
if $DEBUG
|
227
|
+
STDERR.puts "port #{port} couldn't be used for svnserve"
|
228
|
+
end
|
229
|
+
else
|
230
|
+
# svnserve started successfully. Note port number and cease
|
231
|
+
# startup attempts.
|
232
|
+
@svnserve_port = port
|
233
|
+
@repos_svnserve_uri =
|
234
|
+
"svn://#{@svnserve_host}:#{@svnserve_port}#{@full_repos_path}"
|
235
|
+
break
|
236
|
+
end
|
237
|
+
end
|
238
|
+
if @svnserve_port.nil?
|
239
|
+
msg = "Can't run svnserve because available port "
|
240
|
+
msg << "isn't exist in [#{@svnserve_ports.join(', ')}]"
|
241
|
+
raise msg
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def teardown_svnserve
|
246
|
+
if @svnserve_pid
|
247
|
+
Process.kill(:TERM, @svnserve_pid)
|
248
|
+
begin
|
249
|
+
Process.waitpid(@svnserve_pid)
|
250
|
+
rescue Errno::ECHILD
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
def add_pre_revprop_change_hook
|
256
|
+
File.open(@repos.pre_revprop_change_hook, "w") do |hook|
|
257
|
+
hook.print <<-HOOK
|
258
|
+
#!/bin/sh
|
259
|
+
REPOS="$1"
|
260
|
+
REV="$2"
|
261
|
+
USER="$3"
|
262
|
+
PROPNAME="$4"
|
263
|
+
|
264
|
+
if [ "$PROPNAME" = "#{Svn::Core::PROP_REVISION_LOG}" -a \
|
265
|
+
"$USER" = "#{@author}" ]; then
|
266
|
+
exit 0
|
267
|
+
fi
|
268
|
+
|
269
|
+
exit 1
|
270
|
+
HOOK
|
271
|
+
end
|
272
|
+
FileUtils.chmod(0755, @repos.pre_revprop_change_hook)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
module SetupEnvironment
|
277
|
+
def setup_test_environment(top_dir, base_dir, ext_dir)
|
278
|
+
svnserve_dir = File.join(top_dir, 'subversion', 'svnserve')
|
279
|
+
ENV["PATH"] = "#{svnserve_dir}:#{ENV['PATH']}"
|
280
|
+
FileUtils.ln_sf(File.join(base_dir, ".libs"), ext_dir)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
if windows?
|
285
|
+
require 'windows_util'
|
286
|
+
include Windows::Svnserve
|
287
|
+
extend Windows::SetupEnvironment
|
288
|
+
else
|
289
|
+
include Svnserve
|
290
|
+
extend SetupEnvironment
|
291
|
+
end
|
292
|
+
end
|
@@ -0,0 +1,263 @@
|
|
1
|
+
require 'etc'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module SvnTestUtil
|
5
|
+
module Windows
|
6
|
+
module Svnserve
|
7
|
+
def service_name
|
8
|
+
"test-svn-server--port-#{@svnserve_port}"
|
9
|
+
end
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def escape_value(value)
|
13
|
+
escaped_value = value.gsub(/"/, '\\"') # "
|
14
|
+
"\"#{escaped_value}\""
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def service_control(command, args={})
|
19
|
+
args = args.collect do |key, value|
|
20
|
+
"#{key}= #{Svnserve.escape_value(value)}"
|
21
|
+
end.join(" ")
|
22
|
+
result = `sc #{command} #{service_name} #{args}`
|
23
|
+
if result.match(/FAILED/)
|
24
|
+
raise "Failed to #{command} #{service_name}: #{args}"
|
25
|
+
end
|
26
|
+
/^\s*STATE\s*:\s\d+\s*(.*?)\s*$/ =~ result
|
27
|
+
$1
|
28
|
+
end
|
29
|
+
|
30
|
+
def grant_everyone_full_access(dir)
|
31
|
+
dir = dir.tr(File::SEPARATOR, File::ALT_SEPARATOR)
|
32
|
+
`cacls #{Svnserve.escape_value(dir)} /T /E /P Everyone:F`
|
33
|
+
end
|
34
|
+
|
35
|
+
def service_exists?
|
36
|
+
begin
|
37
|
+
service_control("query")
|
38
|
+
true
|
39
|
+
rescue
|
40
|
+
false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def service_stopped?
|
45
|
+
"STOPPED" == service_control("query") rescue true
|
46
|
+
end
|
47
|
+
|
48
|
+
def setup_svnserve
|
49
|
+
@svnserve_port = @svnserve_ports.last
|
50
|
+
@repos_svnserve_uri = "svn://#{@svnserve_host}:#{@svnserve_port}"
|
51
|
+
grant_everyone_full_access(@full_repos_path)
|
52
|
+
|
53
|
+
@@service_created ||= begin
|
54
|
+
@@service_created = true
|
55
|
+
service_control('stop') unless service_stopped?
|
56
|
+
service_control('delete') if service_exists?
|
57
|
+
|
58
|
+
svnserve_dir = File.expand_path("svnserve")
|
59
|
+
FileUtils.mkdir_p(svnserve_dir)
|
60
|
+
at_exit do
|
61
|
+
service_control('stop') unless service_stopped?
|
62
|
+
service_control('delete') if service_exists?
|
63
|
+
FileUtils.rm_rf(svnserve_dir)
|
64
|
+
end
|
65
|
+
trap("INT") do
|
66
|
+
service_control('stop') unless service_stopped?
|
67
|
+
service_control('delete') if service_exists?
|
68
|
+
FileUtils.rm_rf(svnserve_dir)
|
69
|
+
end
|
70
|
+
|
71
|
+
config = SetupEnvironment.gen_make_opts
|
72
|
+
apr_version_include = Pathname.new(config["--with-apr"]) +
|
73
|
+
'include' + 'apr_version.h'
|
74
|
+
%r'^\s*#define\s+APR_MAJOR_VERSION\s+(\d+)' =~ apr_version_include.read
|
75
|
+
apr_major_version = $1 == '0' ? '' : "-#{$1}"
|
76
|
+
|
77
|
+
targets = %W(svnserve.exe libsvn_subr-1.dll libsvn_repos-1.dll
|
78
|
+
libsvn_fs-1.dll libsvn_delta-1.dll
|
79
|
+
libaprutil#{apr_major_version}.dll
|
80
|
+
libapr#{apr_major_version}.dll
|
81
|
+
libapriconv#{apr_major_version}.dll
|
82
|
+
libdb44.dll libdb44d.dll)
|
83
|
+
ENV["PATH"].split(";").each do |path|
|
84
|
+
found_targets = []
|
85
|
+
targets.each do |target|
|
86
|
+
target_path = "#{path}\\#{target}"
|
87
|
+
if File.exists?(target_path)
|
88
|
+
found_targets << target
|
89
|
+
FileUtils.cp(target_path, svnserve_dir)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
targets -= found_targets
|
93
|
+
break if targets.empty?
|
94
|
+
end
|
95
|
+
# Remove optional targets instead of raising below. If they are really
|
96
|
+
# needed, svnserve won't start anyway.
|
97
|
+
targets -= %W[libapriconv#{apr_major_version}.dll]
|
98
|
+
unless targets.empty?
|
99
|
+
raise "can't find libraries to work svnserve: #{targets.join(' ')}"
|
100
|
+
end
|
101
|
+
|
102
|
+
grant_everyone_full_access(svnserve_dir)
|
103
|
+
|
104
|
+
svnserve_path = File.join(svnserve_dir, "svnserve.exe")
|
105
|
+
svnserve_path = svnserve_path.tr(File::SEPARATOR,
|
106
|
+
File::ALT_SEPARATOR)
|
107
|
+
svnserve_path = Svnserve.escape_value(svnserve_path)
|
108
|
+
|
109
|
+
root = @full_repos_path.tr(File::SEPARATOR, File::ALT_SEPARATOR)
|
110
|
+
|
111
|
+
args = ["--service", "--root", Svnserve.escape_value(root),
|
112
|
+
"--listen-host", @svnserve_host,
|
113
|
+
"--listen-port", @svnserve_port]
|
114
|
+
user = ENV["USERNAME"] || Etc.getlogin
|
115
|
+
service_control('create',
|
116
|
+
[["binPath", "#{svnserve_path} #{args.join(' ')}"],
|
117
|
+
["DisplayName", service_name],
|
118
|
+
["type", "own"]])
|
119
|
+
end
|
120
|
+
service_control('start')
|
121
|
+
true
|
122
|
+
end
|
123
|
+
|
124
|
+
def teardown_svnserve
|
125
|
+
service_control('stop') unless service_stopped?
|
126
|
+
end
|
127
|
+
|
128
|
+
def add_pre_revprop_change_hook
|
129
|
+
File.open("#{@repos.pre_revprop_change_hook}.cmd", "w") do |hook|
|
130
|
+
hook.print <<-HOOK
|
131
|
+
set REPOS=%1
|
132
|
+
set REV=%2
|
133
|
+
set USER=%3
|
134
|
+
set PROPNAME=%4
|
135
|
+
if "%PROPNAME%" == "#{Svn::Core::PROP_REVISION_LOG}" if "%USER%" == "#{@author}" exit 0
|
136
|
+
exit 1
|
137
|
+
HOOK
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
module SetupEnvironment
|
143
|
+
def setup_test_environment(top_dir, base_dir, ext_dir)
|
144
|
+
@@top_dir = top_dir
|
145
|
+
|
146
|
+
build_type = ENV["BUILD_TYPE"] || "Release"
|
147
|
+
|
148
|
+
FileUtils.mkdir_p(ext_dir)
|
149
|
+
|
150
|
+
relative_base_dir =
|
151
|
+
base_dir.sub(/^#{Regexp.escape(top_dir + File::SEPARATOR)}/, '')
|
152
|
+
build_base_dir = File.join(top_dir, build_type, relative_base_dir)
|
153
|
+
|
154
|
+
dll_dir = File.expand_path(build_base_dir)
|
155
|
+
subversion_dir = File.join(build_base_dir, "..", "..", "..")
|
156
|
+
subversion_dir = File.expand_path(subversion_dir)
|
157
|
+
|
158
|
+
util_name = "util"
|
159
|
+
build_conf = File.join(top_dir, "build.conf")
|
160
|
+
File.open(File.join(ext_dir, "#{util_name}.rb" ), 'w') do |util|
|
161
|
+
setup_dll_wrapper_util(dll_dir, util)
|
162
|
+
add_depended_dll_path_to_dll_wrapper_util(top_dir, build_type, util)
|
163
|
+
add_svn_dll_path_to_dll_wrapper_util(build_conf, subversion_dir, util)
|
164
|
+
setup_dll_wrappers(build_conf, ext_dir, dll_dir, util_name) do |lib|
|
165
|
+
svn_lib_dir = File.join(subversion_dir, "libsvn_#{lib}")
|
166
|
+
util.puts("add_path.call(#{svn_lib_dir.dump})")
|
167
|
+
end
|
168
|
+
|
169
|
+
svnserve_dir = File.join(subversion_dir, "svnserve")
|
170
|
+
util.puts("add_path.call(#{svnserve_dir.dump})")
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def gen_make_opts
|
175
|
+
@gen_make_opts ||= begin
|
176
|
+
lines = []
|
177
|
+
gen_make_opts = File.join(@@top_dir, "gen-make.opts")
|
178
|
+
lines = File.read(gen_make_opts).to_a if File.exists?(gen_make_opts)
|
179
|
+
config = Hash.new do |hash, key|
|
180
|
+
if /^--with-(.*)$/ =~ key
|
181
|
+
hash[key] = File.join(@@top_dir, $1)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
lines.each do |line|
|
186
|
+
name, value = line.chomp.split(/\s*=\s*/, 2)
|
187
|
+
if value
|
188
|
+
config[name] = Pathname.new(value).absolute? ?
|
189
|
+
value :
|
190
|
+
File.join(@@top_dir, value)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
config
|
194
|
+
end
|
195
|
+
end
|
196
|
+
module_function :gen_make_opts
|
197
|
+
|
198
|
+
private
|
199
|
+
def setup_dll_wrapper_util(dll_dir, util)
|
200
|
+
libsvn_swig_ruby_dll_dir = File.join(dll_dir, "libsvn_swig_ruby")
|
201
|
+
|
202
|
+
util.puts(<<-EOC)
|
203
|
+
paths = ENV["PATH"].split(';')
|
204
|
+
add_path = Proc.new do |path|
|
205
|
+
win_path = path.tr(File::SEPARATOR, File::ALT_SEPARATOR)
|
206
|
+
unless paths.include?(win_path)
|
207
|
+
ENV["PATH"] = "\#{win_path};\#{ENV['PATH']}"
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
add_path.call(#{dll_dir.dump})
|
212
|
+
add_path.call(#{libsvn_swig_ruby_dll_dir.dump})
|
213
|
+
EOC
|
214
|
+
end
|
215
|
+
|
216
|
+
def add_depended_dll_path_to_dll_wrapper_util(top_dir, build_type, util)
|
217
|
+
[
|
218
|
+
["apr", build_type],
|
219
|
+
["apr-util", build_type],
|
220
|
+
["apr-iconv", build_type],
|
221
|
+
["berkeley-db", "bin"],
|
222
|
+
["libintl", "bin"],
|
223
|
+
["sasl", "lib"],
|
224
|
+
].each do |lib, sub_dir|
|
225
|
+
lib_dir = Pathname.new(gen_make_opts["--with-#{lib}"])
|
226
|
+
dll_dir = lib_dir + sub_dir
|
227
|
+
dll_dir = dll_dir.expand_path
|
228
|
+
util.puts("add_path.call(#{dll_dir.to_s.dump})")
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
def add_svn_dll_path_to_dll_wrapper_util(build_conf, subversion_dir, util)
|
233
|
+
File.open(build_conf) do |f|
|
234
|
+
f.each do |line|
|
235
|
+
if /^\[(libsvn_.+)\]\s*$/ =~ line
|
236
|
+
lib_name = $1
|
237
|
+
lib_dir = File.join(subversion_dir, lib_name)
|
238
|
+
util.puts("add_path.call(#{lib_dir.dump})")
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def setup_dll_wrappers(build_conf, ext_dir, dll_dir, util_name)
|
245
|
+
File.open(build_conf) do |f|
|
246
|
+
f.each do |line|
|
247
|
+
if /^\[swig_(.+)\]\s*$/ =~ line
|
248
|
+
lib_name = $1
|
249
|
+
File.open(File.join(ext_dir, "#{lib_name}.rb" ), 'w') do |rb|
|
250
|
+
rb.puts(<<-EOC)
|
251
|
+
require File.join(File.dirname(__FILE__), #{util_name.dump})
|
252
|
+
require File.join(#{dll_dir.dump}, File.basename(__FILE__, '.rb')) + '.so'
|
253
|
+
EOC
|
254
|
+
end
|
255
|
+
|
256
|
+
yield(lib_name)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|