Mxx_ru 1.6.9 → 1.6.10.1
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.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/bin/mxxruexternals +204 -0
- data/bin/mxxrugen +1 -0
- data/lib/mxx_ru/externals.rb +226 -82
- data/lib/mxx_ru/version.rb +1 -1
- data/tests/externals/check_git.rb +1 -1
- data/tests/externals/check_hg.rb +1 -1
- data/tests/externals/check_svn.rb +4 -4
- data/tests/externals/check_tar.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c4a5d6f710b5089948eef9011789f6b721aa283d
|
|
4
|
+
data.tar.gz: 4b6dcd63781c43e5073131dbefab3abc965abbbc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: be0a4bb10bd7f3e4a2706051ade9eee586b54fc808ef5c0e930ab239611ae7f21058a0fd108e4f027be5743d31296c046247ae540c9b1550802d36296b35316d
|
|
7
|
+
data.tar.gz: 1a40070ec8fcbe916e69945f983e17c35c472409a9dea3a7b8d090490de087d4466a1ab26b4f41aa96b87f295d6aa41031e57fb6b13e1048ca8a837a5691505e
|
data/Rakefile
CHANGED
|
@@ -10,7 +10,7 @@ require 'lib/mxx_ru/version'
|
|
|
10
10
|
spec = Gem::Specification.new do |s|
|
|
11
11
|
s.name = "Mxx_ru"
|
|
12
12
|
s.version = MXX_RU_VERSION
|
|
13
|
-
s.licenses = ['
|
|
13
|
+
s.licenses = ['BSD-3-Clause']
|
|
14
14
|
s.author = "The Mxx_ru Project"
|
|
15
15
|
s.email = "eao197@yahoo.com"
|
|
16
16
|
s.homepage = "http://sourceforge.net/projects/mxxru"
|
|
@@ -20,7 +20,7 @@ spec = Gem::Specification.new do |s|
|
|
|
20
20
|
"to C/C++ projects"
|
|
21
21
|
s.files = FileList[ "{bin,tests,lib,docs,examples}/**/*" ].
|
|
22
22
|
exclude( "rdoc" ).to_a + [ "THANKS" ]
|
|
23
|
-
s.executables = 'mxxrugen'
|
|
23
|
+
s.executables = [ 'mxxrugen', 'mxxruexternals' ]
|
|
24
24
|
s.require_path = "lib"
|
|
25
25
|
s.has_rdoc = true
|
|
26
26
|
s.rdoc_options = [ '--main', 'README' ]
|
data/bin/mxxruexternals
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
##--
|
|
3
|
+
# Copyright (c) 1996-2004, Yauheni Akhotnikau
|
|
4
|
+
# Copyright (c) 2004-2006, JSC Intervale
|
|
5
|
+
# Copyright (c) 2006-2016, The Mxx_ru Project
|
|
6
|
+
# All rights reserved.
|
|
7
|
+
#
|
|
8
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
|
9
|
+
# are permitted provided that the following conditions are met:
|
|
10
|
+
#
|
|
11
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
|
12
|
+
# this list of conditions and the following disclaimer.
|
|
13
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
14
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
15
|
+
# and/or other materials provided with the distribution.
|
|
16
|
+
# 3. The name of the author may not be used to endorse or promote products derived
|
|
17
|
+
# from this software without specific prior written permission.
|
|
18
|
+
#
|
|
19
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
20
|
+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21
|
+
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
|
22
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
25
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
26
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
27
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
#++
|
|
29
|
+
# This code is based on the code from RuCodeGen
|
|
30
|
+
# (http://www.rubyforge.org/projects/rucodegen) project.
|
|
31
|
+
# RuCodeGen is distributed under the following license:
|
|
32
|
+
#--
|
|
33
|
+
#
|
|
34
|
+
# Copyright (c) 2005-2006, Yauheni Akhotnikau
|
|
35
|
+
# All rights reserved.
|
|
36
|
+
#
|
|
37
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
|
38
|
+
# are permitted provided that the following conditions are met:
|
|
39
|
+
#
|
|
40
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
|
41
|
+
# this list of conditions and the following disclaimer.
|
|
42
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
43
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
44
|
+
# and/or other materials provided with the distribution.
|
|
45
|
+
# 3. The name of the author may not be used to endorse or promote products derived
|
|
46
|
+
# from this software without specific prior written permission.
|
|
47
|
+
#
|
|
48
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
49
|
+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
50
|
+
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
|
51
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
52
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
53
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
54
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
55
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
56
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
57
|
+
#
|
|
58
|
+
#++
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# Since v.1.6.10
|
|
62
|
+
#
|
|
63
|
+
# Template generation scripts runner.
|
|
64
|
+
|
|
65
|
+
require 'optparse'
|
|
66
|
+
require 'ostruct'
|
|
67
|
+
|
|
68
|
+
require 'tempfile'
|
|
69
|
+
|
|
70
|
+
require 'fileutils'
|
|
71
|
+
|
|
72
|
+
module MxxRuExternals
|
|
73
|
+
|
|
74
|
+
module Impl
|
|
75
|
+
|
|
76
|
+
# Command-line argument parsing.
|
|
77
|
+
#
|
|
78
|
+
# Returns object with the following methods:
|
|
79
|
+
# externals_file:: Name of file with externals definition. Could be nil.
|
|
80
|
+
# task:: Name of task for rake (default :install).
|
|
81
|
+
#
|
|
82
|
+
# Finishes script work is --help specified.
|
|
83
|
+
#
|
|
84
|
+
def Impl.parse_args
|
|
85
|
+
result = OpenStruct.new(
|
|
86
|
+
:externals_file => nil,
|
|
87
|
+
:libdirs => [],
|
|
88
|
+
:task => :install )
|
|
89
|
+
|
|
90
|
+
parser = OptionParser.new
|
|
91
|
+
|
|
92
|
+
parser.banner = <<BANNER
|
|
93
|
+
Mxx_ru Externals command script
|
|
94
|
+
|
|
95
|
+
Usage:
|
|
96
|
+
|
|
97
|
+
mxxruexternals [<options>] [-f externals-file] [task]
|
|
98
|
+
|
|
99
|
+
BANNER
|
|
100
|
+
|
|
101
|
+
parser.on_head( '-I', '--libdir LIBDIR',
|
|
102
|
+
'Include LIBDIR in the search path for required modules' ) do |p|
|
|
103
|
+
result.libdirs << p
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
parser.on_head( '-f', '--rakefile NAME',
|
|
107
|
+
'Name of file with externals definition' ) do |p|
|
|
108
|
+
result.externals_file = p
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
parser.on_head( '-h', '--help', 'Show this message' ) do
|
|
112
|
+
puts parser
|
|
113
|
+
exit( 1 )
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
parser.order!( ARGV ) do |nonarg|
|
|
117
|
+
# First non-option is a task name.
|
|
118
|
+
result.task = nonarg
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
result
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
end # Impl
|
|
125
|
+
|
|
126
|
+
# Performs main work.
|
|
127
|
+
def MxxRuExternals.run
|
|
128
|
+
options = Impl.parse_args
|
|
129
|
+
|
|
130
|
+
if options.externals_file.nil?
|
|
131
|
+
options.externals_file = 'externals.rb'
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
script_name = nil
|
|
135
|
+
Tempfile.open('mxxruexternals-temp', '.') do |tmpf|
|
|
136
|
+
script_name = tmpf.path
|
|
137
|
+
puts "[Info] Generation of auxilary rakefile: #{script_name}"
|
|
138
|
+
tmpf.write <<EOF
|
|
139
|
+
require 'mxx_ru/externals'
|
|
140
|
+
|
|
141
|
+
task :mxxru_cleanup_previous
|
|
142
|
+
task :mxxru_install_final_step
|
|
143
|
+
|
|
144
|
+
MxxRu::Externals::Registry.instance.turn_new_rules_on
|
|
145
|
+
load '#{options.externals_file}'
|
|
146
|
+
|
|
147
|
+
PREVIOUS_FILE = File.join MxxRu::Externals::EXTERNALS_STORAGE_DIR, 'previous.rb'
|
|
148
|
+
BAK_FILE_NAME = lambda {|n| "\#{PREVIOUS_FILE}.\#{n}.bak" }
|
|
149
|
+
MV_IF_EXISTS = lambda{ |from, to| mv(from, to) if File.exists?(from) }
|
|
150
|
+
|
|
151
|
+
file PREVIOUS_FILE do
|
|
152
|
+
cp '#{options.externals_file}', PREVIOUS_FILE, :verbose => Rake.verbose
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if File.exists?(PREVIOUS_FILE)
|
|
156
|
+
prev_digest = Digest::MD5.file(PREVIOUS_FILE)
|
|
157
|
+
curr_digest = Digest::MD5.file('#{options.externals_file}')
|
|
158
|
+
|
|
159
|
+
if prev_digest != curr_digest
|
|
160
|
+
puts "[Note] Externals description changed from the last time"
|
|
161
|
+
puts "[Note] Contents of \#{PREVIOUS_FILE} will be used"
|
|
162
|
+
|
|
163
|
+
task :mxxru_cleanup_previous do
|
|
164
|
+
MV_IF_EXISTS[BAK_FILE_NAME[4], BAK_FILE_NAME[5]]
|
|
165
|
+
MV_IF_EXISTS[BAK_FILE_NAME[3], BAK_FILE_NAME[4]]
|
|
166
|
+
MV_IF_EXISTS[BAK_FILE_NAME[2], BAK_FILE_NAME[3]]
|
|
167
|
+
MV_IF_EXISTS[BAK_FILE_NAME[1], BAK_FILE_NAME[2]]
|
|
168
|
+
mv(PREVIOUS_FILE, BAK_FILE_NAME[1])
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
MxxRu::Externals::Registry.instance.turn_old_rules_on
|
|
172
|
+
load PREVIOUS_FILE
|
|
173
|
+
|
|
174
|
+
task mxxru_install_final_step: [PREVIOUS_FILE]
|
|
175
|
+
else
|
|
176
|
+
puts "[Note] It seems there is no changes in externals description"
|
|
177
|
+
puts "[Note] Contents of \#{PREVIOUS_FILE} won't be used"
|
|
178
|
+
end
|
|
179
|
+
else
|
|
180
|
+
task mxxru_install_final_step: [PREVIOUS_FILE]
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
task install: [:mxxru_cleanup_previous, :mxxru_install_final_step]
|
|
184
|
+
task remove: [:mxxru_cleanup_previous, :mxxru_install_final_step]
|
|
185
|
+
task reget: [:mxxru_cleanup_previous, :mxxru_install_final_step]
|
|
186
|
+
|
|
187
|
+
EOF
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
cmdline = "rake ";
|
|
191
|
+
options.libdirs.each do |l| cmdline += "-I \"#{l}\" " end
|
|
192
|
+
cmdline += "-f #{script_name} #{options.task}"
|
|
193
|
+
|
|
194
|
+
puts "[Info] Launching rake with: #{cmdline}"
|
|
195
|
+
system cmdline
|
|
196
|
+
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
end # MxxRuExternals
|
|
200
|
+
|
|
201
|
+
MxxRuExternals.run
|
|
202
|
+
|
|
203
|
+
# vim:ft=ruby:ts=2:sts=2:sw=2:expandtab
|
|
204
|
+
|
data/bin/mxxrugen
CHANGED
data/lib/mxx_ru/externals.rb
CHANGED
|
@@ -6,10 +6,67 @@ require 'singleton'
|
|
|
6
6
|
|
|
7
7
|
require 'digest'
|
|
8
8
|
|
|
9
|
+
require 'json'
|
|
10
|
+
|
|
9
11
|
module MxxRu
|
|
10
12
|
|
|
11
13
|
module Externals
|
|
12
14
|
|
|
15
|
+
EXTERNALS_STORAGE_DIR = '.externals'
|
|
16
|
+
|
|
17
|
+
class Registry
|
|
18
|
+
include Singleton
|
|
19
|
+
|
|
20
|
+
INITIAL_MODE = 0
|
|
21
|
+
NEW_RULES_MODE = 1
|
|
22
|
+
OLD_RULES_MODE = 2
|
|
23
|
+
|
|
24
|
+
def initialize
|
|
25
|
+
@mode = INITIAL_MODE
|
|
26
|
+
@externals = {}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def turn_new_rules_on
|
|
30
|
+
@mode = NEW_RULES_MODE
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def turn_old_rules_on
|
|
34
|
+
@mode = OLD_RULES_MODE
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def Registry.handle_external(*args)
|
|
38
|
+
Registry.instance.handle_external(*args)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def handle_external(name, obj)
|
|
42
|
+
if INITIAL_MODE == @mode
|
|
43
|
+
raise "Use mxxruexternals command for handling externals.\n" +
|
|
44
|
+
"For example:\n\n" +
|
|
45
|
+
"mxxruexternals -f my_externals.rb\n"
|
|
46
|
+
elsif NEW_RULES_MODE == @mode
|
|
47
|
+
@externals[ name ] = obj.make_hash
|
|
48
|
+
obj.define_rules :new_rules
|
|
49
|
+
elsif OLD_RULES_MODE == @mode
|
|
50
|
+
fresh_version = @externals.fetch(name, nil)
|
|
51
|
+
if fresh_version
|
|
52
|
+
puts "[Note] #{name} previous rules found"
|
|
53
|
+
old_hash = obj.make_hash
|
|
54
|
+
if old_hash == fresh_version
|
|
55
|
+
puts "[Note] #{name} previous rules the same with current"
|
|
56
|
+
else
|
|
57
|
+
puts "[Note] #{name} previous rules differs with current"
|
|
58
|
+
puts "[Note] #{name} WILL BE REGET"
|
|
59
|
+
obj.define_rules :old_rules
|
|
60
|
+
end
|
|
61
|
+
else
|
|
62
|
+
puts "[Note] #{name} not present in the current version"
|
|
63
|
+
puts "[Note] #{name} WILL BE REMOVED"
|
|
64
|
+
obj.define_rules :old_rules
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
13
70
|
module Impl
|
|
14
71
|
|
|
15
72
|
module Utils
|
|
@@ -43,6 +100,10 @@ private
|
|
|
43
100
|
@options = [] unless @options
|
|
44
101
|
@options
|
|
45
102
|
end
|
|
103
|
+
|
|
104
|
+
def options_to_map
|
|
105
|
+
{ options: @options }
|
|
106
|
+
end
|
|
46
107
|
end # module OptionsHolder
|
|
47
108
|
|
|
48
109
|
class CurlDownloder
|
|
@@ -162,7 +223,6 @@ private
|
|
|
162
223
|
end # class WebDownloader
|
|
163
224
|
|
|
164
225
|
module ExternalBasics
|
|
165
|
-
EXTERNALS_STORAGE_DIR = '.externals'
|
|
166
226
|
|
|
167
227
|
attr_reader :url
|
|
168
228
|
|
|
@@ -182,7 +242,12 @@ module ExternalBasics
|
|
|
182
242
|
@paths.merge!(value)
|
|
183
243
|
end
|
|
184
244
|
|
|
185
|
-
|
|
245
|
+
def map(value)
|
|
246
|
+
STDERR.print("#{caller(1)[0]}: 'map_dir' must be used instead of 'map'," +
|
|
247
|
+
" 'map' is deprecated\n")
|
|
248
|
+
|
|
249
|
+
map_dir(value)
|
|
250
|
+
end
|
|
186
251
|
|
|
187
252
|
def map_file(value)
|
|
188
253
|
raise "map_file() value must be a Hash" unless value.is_a?(Hash)
|
|
@@ -194,13 +259,18 @@ private
|
|
|
194
259
|
|
|
195
260
|
def defaults(name)
|
|
196
261
|
@name = name
|
|
197
|
-
@
|
|
198
|
-
@
|
|
262
|
+
@install_task_name = "#{@name}_#{object_id}"
|
|
263
|
+
@remove_task_name = "#{@install_task_name}:remove"
|
|
264
|
+
@reget_task_name = "#{@install_task_name}:reget"
|
|
199
265
|
@paths = {}
|
|
200
266
|
@files = {}
|
|
201
267
|
@verbose = Rake.verbose
|
|
202
268
|
end
|
|
203
269
|
|
|
270
|
+
def basics_to_map
|
|
271
|
+
{ url: @url, paths: @paths, files: @files }
|
|
272
|
+
end
|
|
273
|
+
|
|
204
274
|
def fileop_options
|
|
205
275
|
{ :verbose => @verbose }
|
|
206
276
|
end
|
|
@@ -238,17 +308,25 @@ private
|
|
|
238
308
|
"#{prefixes.join('.')}.#{Process.pid}.#{Thread.current.object_id}"
|
|
239
309
|
end
|
|
240
310
|
|
|
241
|
-
|
|
311
|
+
# Note: argument old_or_new can receive values :new_rules or :old_rules.
|
|
312
|
+
def define(old_or_new, &exporter)
|
|
242
313
|
ensure_basics_correctness(@name)
|
|
243
314
|
|
|
244
315
|
ext_prj_sources_dir, dir_subtargets, file_subtargets =
|
|
245
|
-
define_basic_task(&exporter)
|
|
316
|
+
define_basic_task(old_or_new, &exporter)
|
|
246
317
|
|
|
247
|
-
define_remove_task(
|
|
248
|
-
|
|
318
|
+
define_remove_task(
|
|
319
|
+
old_or_new,
|
|
320
|
+
ext_prj_sources_dir,
|
|
321
|
+
dir_subtargets,
|
|
322
|
+
file_subtargets)
|
|
323
|
+
|
|
324
|
+
if :new_rules == old_or_new
|
|
325
|
+
define_reget_task(ext_prj_sources_dir, dir_subtargets, file_subtargets)
|
|
326
|
+
end
|
|
249
327
|
end
|
|
250
328
|
|
|
251
|
-
def define_basic_task(&exporter)
|
|
329
|
+
def define_basic_task(old_or_new, &exporter)
|
|
252
330
|
ext_prj_sources_dir = subdir_name(@name.to_s)
|
|
253
331
|
|
|
254
332
|
directory EXTERNALS_STORAGE_DIR
|
|
@@ -257,11 +335,14 @@ private
|
|
|
257
335
|
@paths.each do |src, dst|
|
|
258
336
|
src, actual_dst, dir_dep = handle_dir_map_pair(src, dst)
|
|
259
337
|
|
|
260
|
-
|
|
338
|
+
define_only_if_new_rules(old_or_new) do
|
|
339
|
+
directory dir_dep
|
|
261
340
|
|
|
262
|
-
|
|
263
|
-
|
|
341
|
+
directory actual_dst => [ext_prj_sources_dir, dir_dep] do
|
|
342
|
+
cp_r(File.join(ext_prj_sources_dir, src), actual_dst, fileop_options)
|
|
343
|
+
end
|
|
264
344
|
end
|
|
345
|
+
|
|
265
346
|
dir_subtargets << actual_dst
|
|
266
347
|
end
|
|
267
348
|
|
|
@@ -269,47 +350,56 @@ private
|
|
|
269
350
|
@files.each do |src, dst|
|
|
270
351
|
dst, dir_dep = handle_file_map_pair(src, dst)
|
|
271
352
|
|
|
272
|
-
|
|
353
|
+
define_only_if_new_rules(old_or_new) do
|
|
354
|
+
directory dir_dep
|
|
273
355
|
|
|
274
|
-
|
|
275
|
-
|
|
356
|
+
file dst => [ext_prj_sources_dir, dir_dep] do
|
|
357
|
+
cp(File.join(ext_prj_sources_dir, src), dst, fileop_options)
|
|
358
|
+
end
|
|
276
359
|
end
|
|
360
|
+
|
|
277
361
|
file_subtargets << dst
|
|
278
362
|
end
|
|
279
363
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
364
|
+
define_only_if_new_rules(old_or_new) do
|
|
365
|
+
directory ext_prj_sources_dir => [EXTERNALS_STORAGE_DIR] do
|
|
366
|
+
# All old destinations must be removed because source code
|
|
367
|
+
# will be exported again.
|
|
368
|
+
rm_directories(dir_subtargets)
|
|
369
|
+
rm_files(file_subtargets)
|
|
285
370
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
371
|
+
ext_prj_sources_tmp_dir = subdir_name(make_tmp_name(@name))
|
|
372
|
+
exporter.call(ext_prj_sources_tmp_dir)
|
|
373
|
+
mv(ext_prj_sources_tmp_dir, ext_prj_sources_dir, fileop_options)
|
|
374
|
+
end
|
|
290
375
|
|
|
291
|
-
|
|
292
|
-
|
|
376
|
+
task @install_task_name =>
|
|
377
|
+
[:mxxru_cleanup_previous, dir_subtargets, file_subtargets].flatten!
|
|
293
378
|
|
|
294
|
-
|
|
379
|
+
task install: @install_task_name
|
|
380
|
+
end
|
|
295
381
|
|
|
296
382
|
return ext_prj_sources_dir, dir_subtargets, file_subtargets
|
|
297
383
|
end
|
|
298
384
|
|
|
299
|
-
def define_remove_task(
|
|
300
|
-
|
|
385
|
+
def define_remove_task(
|
|
386
|
+
old_or_new, ext_prj_sources_dir, dir_subtargets, file_subtargets)
|
|
387
|
+
|
|
301
388
|
task @remove_task_name do
|
|
302
389
|
rm_files(file_subtargets)
|
|
303
390
|
rm_directories(dir_subtargets)
|
|
304
391
|
rm_dir_if_exists(ext_prj_sources_dir)
|
|
305
392
|
end
|
|
306
393
|
|
|
307
|
-
|
|
394
|
+
if :new_rules == old_or_new
|
|
395
|
+
task :remove => @remove_task_name
|
|
396
|
+
else
|
|
397
|
+
task :mxxru_cleanup_previous => @remove_task_name
|
|
398
|
+
end
|
|
308
399
|
end
|
|
309
400
|
|
|
310
401
|
def define_reget_task(ext_prj_sources_dir, dir_subtargets, file_subtargets)
|
|
311
|
-
|
|
312
|
-
task @reget_task_name => [@remove_task_name, @name]
|
|
402
|
+
task @reget_task_name => [@remove_task_name, @install_task_name]
|
|
313
403
|
|
|
314
404
|
task :reget => @reget_task_name
|
|
315
405
|
end
|
|
@@ -347,6 +437,13 @@ private
|
|
|
347
437
|
end
|
|
348
438
|
[dst, dst_parts.first]
|
|
349
439
|
end
|
|
440
|
+
|
|
441
|
+
# Helper function for doing some actions only if old_or_new is :new_rules.
|
|
442
|
+
def define_only_if_new_rules(old_or_new, &block)
|
|
443
|
+
if :new_rules == old_or_new
|
|
444
|
+
block.call
|
|
445
|
+
end
|
|
446
|
+
end
|
|
350
447
|
end
|
|
351
448
|
|
|
352
449
|
end # module Impl
|
|
@@ -361,7 +458,24 @@ class Svn < Rake::TaskLib
|
|
|
361
458
|
|
|
362
459
|
yield self if block_given?
|
|
363
460
|
|
|
364
|
-
|
|
461
|
+
Registry::handle_external(@name, self)
|
|
462
|
+
end
|
|
463
|
+
|
|
464
|
+
attr_reader :rev
|
|
465
|
+
def rev(v); @rev = v; end
|
|
466
|
+
alias :rev= :rev
|
|
467
|
+
|
|
468
|
+
def with_externals
|
|
469
|
+
@with_externals = true
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
def make_hash
|
|
473
|
+
options_to_map.merge!( basics_to_map ).merge!(
|
|
474
|
+
{ :rev => @rev, :with_externals => @with_externals } )
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
def define_rules(old_or_new)
|
|
478
|
+
define(old_or_new) do |tmp_dir|
|
|
365
479
|
sh_args = [ 'svn', 'export' ]
|
|
366
480
|
|
|
367
481
|
sh_args << '-r' << @rev.to_s if @rev
|
|
@@ -374,13 +488,6 @@ class Svn < Rake::TaskLib
|
|
|
374
488
|
end
|
|
375
489
|
end
|
|
376
490
|
|
|
377
|
-
attr_reader :rev
|
|
378
|
-
def rev(v); @rev = v; end
|
|
379
|
-
alias :rev= :rev
|
|
380
|
-
|
|
381
|
-
def with_externals
|
|
382
|
-
@with_externals = true
|
|
383
|
-
end
|
|
384
491
|
end
|
|
385
492
|
|
|
386
493
|
class Git < Rake::TaskLib
|
|
@@ -396,7 +503,36 @@ class Git < Rake::TaskLib
|
|
|
396
503
|
|
|
397
504
|
raise "#{name}: tag and commit cannot be specified together" if @tag and @commit
|
|
398
505
|
|
|
399
|
-
|
|
506
|
+
Registry::handle_external(@name, self)
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
attr_reader :tag
|
|
510
|
+
def tag(v); @tag = v; end
|
|
511
|
+
alias :tag= :tag
|
|
512
|
+
|
|
513
|
+
def unlimited_depth
|
|
514
|
+
@unlimited_depth = true
|
|
515
|
+
end
|
|
516
|
+
|
|
517
|
+
def recursive
|
|
518
|
+
@recursive = true
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
attr_reader :commit
|
|
522
|
+
def commit(v); @commit = v; end
|
|
523
|
+
alias :commit= :commit
|
|
524
|
+
|
|
525
|
+
def make_hash
|
|
526
|
+
options_to_map.merge!( basics_to_map ).merge!(
|
|
527
|
+
{ :recursive => @recursive,
|
|
528
|
+
:unlimited_depth => @unlimited_depth,
|
|
529
|
+
:tag => @tag,
|
|
530
|
+
:commit => @commit
|
|
531
|
+
} )
|
|
532
|
+
end
|
|
533
|
+
|
|
534
|
+
def define_rules(old_or_new)
|
|
535
|
+
define(old_or_new) do |tmp_dir|
|
|
400
536
|
if @commit.nil?
|
|
401
537
|
# No specific commit.
|
|
402
538
|
# Simple clone (probably with --depth 1) is enough.
|
|
@@ -425,21 +561,6 @@ class Git < Rake::TaskLib
|
|
|
425
561
|
end
|
|
426
562
|
end
|
|
427
563
|
|
|
428
|
-
attr_reader :tag
|
|
429
|
-
def tag(v); @tag = v; end
|
|
430
|
-
alias :tag= :tag
|
|
431
|
-
|
|
432
|
-
def unlimited_depth
|
|
433
|
-
@unlimited_depth = true
|
|
434
|
-
end
|
|
435
|
-
|
|
436
|
-
def recursive
|
|
437
|
-
@recursive = true
|
|
438
|
-
end
|
|
439
|
-
|
|
440
|
-
attr_reader :commit
|
|
441
|
-
def commit(v); @commit = v; end
|
|
442
|
-
alias :commit= :commit
|
|
443
564
|
end
|
|
444
565
|
|
|
445
566
|
class Hg < Rake::TaskLib
|
|
@@ -451,7 +572,19 @@ class Hg < Rake::TaskLib
|
|
|
451
572
|
|
|
452
573
|
yield self if block_given?
|
|
453
574
|
|
|
454
|
-
|
|
575
|
+
Registry::handle_external(@name, self)
|
|
576
|
+
end
|
|
577
|
+
|
|
578
|
+
attr_reader :tag
|
|
579
|
+
def tag(v); @tag = v; end
|
|
580
|
+
alias :tag= :tag
|
|
581
|
+
|
|
582
|
+
def make_hash
|
|
583
|
+
options_to_map.merge!( basics_to_map ).merge!( { :tag => @tag } )
|
|
584
|
+
end
|
|
585
|
+
|
|
586
|
+
def define_rules(old_or_new)
|
|
587
|
+
define(old_or_new) do |tmp_dir|
|
|
455
588
|
sh_args = ['hg', 'clone']
|
|
456
589
|
|
|
457
590
|
sh_args << '--updaterev' << @tag.to_s if @tag
|
|
@@ -463,9 +596,6 @@ class Hg < Rake::TaskLib
|
|
|
463
596
|
end
|
|
464
597
|
end
|
|
465
598
|
|
|
466
|
-
attr_reader :tag
|
|
467
|
-
def tag(v); @tag = v; end
|
|
468
|
-
alias :tag= :tag
|
|
469
599
|
end # class Hg
|
|
470
600
|
|
|
471
601
|
# Implementation of externals represented as downloadable
|
|
@@ -477,13 +607,13 @@ class ArchiveAsExternals < Rake::TaskLib
|
|
|
477
607
|
|
|
478
608
|
@@archive_handlers = {
|
|
479
609
|
:tar => proc {
|
|
480
|
-
['tar', 'x'].push(*@
|
|
610
|
+
['tar', 'x'].push(*@unpacker_options).push('-f').push(archive_name)
|
|
481
611
|
},
|
|
482
612
|
:zip => proc {
|
|
483
|
-
['unzip'].push(*@
|
|
613
|
+
['unzip'].push(*@unpacker_options).push(archive_name)
|
|
484
614
|
},
|
|
485
615
|
:sevenzip => proc {
|
|
486
|
-
['7z', 'x'].push(*@
|
|
616
|
+
['7z', 'x'].push(*@unpacker_options).push(archive_name)
|
|
487
617
|
}
|
|
488
618
|
}
|
|
489
619
|
|
|
@@ -508,29 +638,14 @@ class ArchiveAsExternals < Rake::TaskLib
|
|
|
508
638
|
|
|
509
639
|
def initialize(name)
|
|
510
640
|
defaults(name)
|
|
511
|
-
@
|
|
641
|
+
@unpacker_options = []
|
|
512
642
|
|
|
513
643
|
yield self if block_given?
|
|
514
644
|
|
|
515
645
|
parse_uri
|
|
516
646
|
detect_archive_type
|
|
517
647
|
|
|
518
|
-
|
|
519
|
-
# Temporary directory must be removed in a case of any error.
|
|
520
|
-
successful = false
|
|
521
|
-
begin
|
|
522
|
-
mkdir(tmp_dir, fileop_options) if !Dir.exists?(tmp_dir)
|
|
523
|
-
|
|
524
|
-
cd tmp_dir do
|
|
525
|
-
download_archive
|
|
526
|
-
unpack_archive
|
|
527
|
-
end
|
|
528
|
-
|
|
529
|
-
successful = true
|
|
530
|
-
ensure
|
|
531
|
-
rm_dir_if_exists(tmp_dir) unless successful
|
|
532
|
-
end
|
|
533
|
-
end
|
|
648
|
+
Registry::handle_external(@name, self)
|
|
534
649
|
end
|
|
535
650
|
|
|
536
651
|
def md5(v)
|
|
@@ -550,7 +665,36 @@ class ArchiveAsExternals < Rake::TaskLib
|
|
|
550
665
|
end
|
|
551
666
|
|
|
552
667
|
def unpacker_option(v)
|
|
553
|
-
@
|
|
668
|
+
@unpacker_options.push(v)
|
|
669
|
+
end
|
|
670
|
+
|
|
671
|
+
def make_hash
|
|
672
|
+
all_downloader_options.merge( basics_to_map ).merge!(
|
|
673
|
+
{ :md5 => @md5,
|
|
674
|
+
:sha1 => @sha1,
|
|
675
|
+
:sha256 => @sha256,
|
|
676
|
+
:sha512 => @sha512,
|
|
677
|
+
:unpacker_options => @unpacker_options
|
|
678
|
+
} )
|
|
679
|
+
end
|
|
680
|
+
|
|
681
|
+
def define_rules(old_or_new)
|
|
682
|
+
define(old_or_new) do |tmp_dir|
|
|
683
|
+
# Temporary directory must be removed in a case of any error.
|
|
684
|
+
successful = false
|
|
685
|
+
begin
|
|
686
|
+
mkdir(tmp_dir, fileop_options) if !Dir.exists?(tmp_dir)
|
|
687
|
+
|
|
688
|
+
cd tmp_dir do
|
|
689
|
+
download_archive
|
|
690
|
+
unpack_archive
|
|
691
|
+
end
|
|
692
|
+
|
|
693
|
+
successful = true
|
|
694
|
+
ensure
|
|
695
|
+
rm_dir_if_exists(tmp_dir) unless successful
|
|
696
|
+
end
|
|
697
|
+
end
|
|
554
698
|
end
|
|
555
699
|
|
|
556
700
|
private
|
|
@@ -669,7 +813,7 @@ end # module MxxRu
|
|
|
669
813
|
|
|
670
814
|
desc "Remove all external projects"
|
|
671
815
|
task :remove do
|
|
672
|
-
d = MxxRu::Externals::
|
|
816
|
+
d = MxxRu::Externals::EXTERNALS_STORAGE_DIR
|
|
673
817
|
rm_r(d, :verbose => Rake.verbose) if Dir.exists?(d)
|
|
674
818
|
end
|
|
675
819
|
|
data/lib/mxx_ru/version.rb
CHANGED
data/tests/externals/check_hg.rb
CHANGED
|
@@ -3,8 +3,8 @@ require 'mxx_ru/externals'
|
|
|
3
3
|
MxxRu::svn_externals :so_5 do |ext|
|
|
4
4
|
ext.url 'http://svn.code.sf.net/p/sobjectizer/repo/branches/so_5/5.5'
|
|
5
5
|
ext.option '-q'
|
|
6
|
-
ext.
|
|
7
|
-
ext.
|
|
6
|
+
ext.map_dir 'dev/so_5' => 'dev'
|
|
7
|
+
ext.map_dir 'dev/test/so_5' => 'dev/test'
|
|
8
8
|
ext.map_file 'README' => 'README.so_5'
|
|
9
9
|
end
|
|
10
10
|
|
|
@@ -12,6 +12,6 @@ MxxRu::svn_externals :socomm do |ext|
|
|
|
12
12
|
ext.url 'http://svn.code.sf.net/p/sobjectizer/repo/branches/so_comm_1/1.1'
|
|
13
13
|
ext.option '-q'
|
|
14
14
|
ext.rev 2290
|
|
15
|
-
ext.
|
|
16
|
-
ext.
|
|
15
|
+
ext.map_dir 'dev/so_comm_1' => 'dev'
|
|
16
|
+
ext.map_dir 'dev/test/so_comm_1' => 'dev/test'
|
|
17
17
|
end
|
|
@@ -4,7 +4,7 @@ MxxRu::arch_externals :asio_tgz do |e|
|
|
|
4
4
|
e.url 'https://github.com/chriskohlhoff/asio/archive/asio-1-11-0.tar.gz'
|
|
5
5
|
e.sha1 '1be2489015a1e1c7b8666a5a803d984cdec4a12b'
|
|
6
6
|
|
|
7
|
-
e.
|
|
7
|
+
e.map_dir 'asio/src' => 'dev/asio_tgz'
|
|
8
8
|
|
|
9
9
|
e.downloader_option :wget, '--no-use-server-timestamps'
|
|
10
10
|
e.downloader_option :wget, '-T', '36'
|
metadata
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: Mxx_ru
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.6.
|
|
4
|
+
version: 1.6.10.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Mxx_ru Project
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Mxx_ru is a cross-platform build tool primarily focused to C/C++ projects
|
|
14
14
|
email: eao197@yahoo.com
|
|
15
15
|
executables:
|
|
16
16
|
- mxxrugen
|
|
17
|
+
- mxxruexternals
|
|
17
18
|
extensions: []
|
|
18
19
|
extra_rdoc_files:
|
|
19
20
|
- README
|
|
@@ -26,6 +27,7 @@ files:
|
|
|
26
27
|
- README
|
|
27
28
|
- Rakefile
|
|
28
29
|
- THANKS
|
|
30
|
+
- bin/mxxruexternals
|
|
29
31
|
- bin/mxxrugen
|
|
30
32
|
- examples/exe_and_lib/main.cpp
|
|
31
33
|
- examples/exe_and_lib/prj.rb
|
|
@@ -350,7 +352,7 @@ files:
|
|
|
350
352
|
- tests/unix/lib_order/tc_normal_build.rb
|
|
351
353
|
homepage: http://sourceforge.net/projects/mxxru
|
|
352
354
|
licenses:
|
|
353
|
-
-
|
|
355
|
+
- BSD-3-Clause
|
|
354
356
|
metadata: {}
|
|
355
357
|
post_install_message:
|
|
356
358
|
rdoc_options:
|
|
@@ -370,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
370
372
|
version: '0'
|
|
371
373
|
requirements: []
|
|
372
374
|
rubyforge_project:
|
|
373
|
-
rubygems_version: 2.
|
|
375
|
+
rubygems_version: 2.2.2
|
|
374
376
|
signing_key:
|
|
375
377
|
specification_version: 4
|
|
376
378
|
summary: Mxx_ru (Make++ on Ruby) is a cross-platform build tool
|