autobuild 1.10.0.rc14 → 1.10.0.rc15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/autobuild.rb +1 -0
- data/lib/autobuild/config.rb +1 -1
- data/lib/autobuild/importer.rb +2 -4
- data/lib/autobuild/package.rb +7 -2
- data/lib/autobuild/packages/cmake.rb +78 -22
- data/lib/autobuild/packages/ruby.rb +4 -0
- data/lib/autobuild/reporting.rb +24 -21
- data/lib/autobuild/test.rb +16 -3
- data/lib/autobuild/test_utility.rb +105 -0
- data/lib/autobuild/tools.rb +1 -1
- data/lib/autobuild/utility.rb +4 -2
- data/lib/autobuild/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bfbc713367f1cd0d1935302128f639b649cdf3a
|
4
|
+
data.tar.gz: a57057547ba73f4d15ee253d8e385ae548a0bc42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb3752c3e4c69d1c82bc3de46913d56bb8ec96a5259b332a9abc2c0bd18c3833ad7bfd15087c9cb1fb3767588d67d4245793d0ea8e47c5aa2561a2f2e5d3f918
|
7
|
+
data.tar.gz: 576d86ebb48163f35cfac3c06dc7a46ab4fa5c828015a4d5e000be96e44b5ef2cb08901427ffc5ad4fca41e3ae6a36442ca505ab488a5f9354d547d149ec5760
|
data/lib/autobuild.rb
CHANGED
data/lib/autobuild/config.rb
CHANGED
@@ -83,7 +83,7 @@ def full_build?
|
|
83
83
|
end
|
84
84
|
@utilities = Hash.new
|
85
85
|
register_utility_class 'doc', Utility, disabled_by_default: false
|
86
|
-
register_utility_class 'test',
|
86
|
+
register_utility_class 'test', TestUtility, disabled_by_default: true
|
87
87
|
|
88
88
|
@colorizer = Pastel.new
|
89
89
|
class << self
|
data/lib/autobuild/importer.rb
CHANGED
@@ -255,7 +255,7 @@ def self.add_post_hook(&hook)
|
|
255
255
|
|
256
256
|
# Enumerate the post-import hooks defined for all instances of this class
|
257
257
|
def self.each_post_hook(&hook)
|
258
|
-
(@post_hooks
|
258
|
+
(@post_hooks ||= Array.new).each(&hook)
|
259
259
|
end
|
260
260
|
|
261
261
|
# @api private
|
@@ -318,7 +318,7 @@ def perform_update(package,only_local=false)
|
|
318
318
|
cur_patches = currently_applied_patches(package)
|
319
319
|
if !cur_patches.empty?
|
320
320
|
package.progress_done
|
321
|
-
package.message "update failed and some patches are applied,
|
321
|
+
package.message "update failed and some patches are applied, removing all patches and retrying"
|
322
322
|
begin
|
323
323
|
patch(package, [])
|
324
324
|
return perform_update(package,only_local)
|
@@ -455,8 +455,6 @@ def fallback(error, package, *args, &block)
|
|
455
455
|
raise error
|
456
456
|
end
|
457
457
|
|
458
|
-
private
|
459
|
-
|
460
458
|
def patchdir(package)
|
461
459
|
File.join(package.importdir, ".autobuild-patches")
|
462
460
|
end
|
data/lib/autobuild/package.rb
CHANGED
@@ -162,7 +162,7 @@ def initialize(spec = Hash.new)
|
|
162
162
|
end
|
163
163
|
task :prepare => "#{name}-prepare"
|
164
164
|
|
165
|
-
task "#{name}-build"
|
165
|
+
task "#{name}-build"
|
166
166
|
task :build => "#{name}-build"
|
167
167
|
|
168
168
|
task(name) do
|
@@ -180,6 +180,11 @@ def initialize(spec = Hash.new)
|
|
180
180
|
@spec_dependencies = depends
|
181
181
|
end
|
182
182
|
|
183
|
+
# Whether the package's source directory is present on disk
|
184
|
+
def checked_out?
|
185
|
+
File.directory?(srcdir)
|
186
|
+
end
|
187
|
+
|
183
188
|
# @api private
|
184
189
|
#
|
185
190
|
# Adds a new operation to this package's environment setup. This is a
|
@@ -310,7 +315,7 @@ def find_in_path(file, envvar = 'PATH')
|
|
310
315
|
# @return [Hash<String,String>] the full environment
|
311
316
|
# @see Autobuild::Environment#resolved_env
|
312
317
|
def resolved_env(root = Autobuild.env)
|
313
|
-
full_env.resolved_env
|
318
|
+
full_env(root).resolved_env
|
314
319
|
end
|
315
320
|
|
316
321
|
# Called before a forced build. It should remove all the timestamp and
|
@@ -30,6 +30,23 @@ def full_reconfigures?
|
|
30
30
|
|
31
31
|
attr_reader :prefix_path
|
32
32
|
attr_reader :module_path
|
33
|
+
|
34
|
+
# Whether files that are not within CMake's install manifest but are
|
35
|
+
# present in the prefix should be deleted. Note that the contents of
|
36
|
+
# {#log_dir} are unaffected.
|
37
|
+
#
|
38
|
+
# It is false by default. Set to true only if each package has its
|
39
|
+
# own prefix.
|
40
|
+
def delete_obsolete_files_in_prefix?
|
41
|
+
@@delete_obsolete_files_in_prefix
|
42
|
+
end
|
43
|
+
|
44
|
+
# Set {#delete_obsolete_files_in_prefix?}
|
45
|
+
def delete_obsolete_files_in_prefix=(flag)
|
46
|
+
@@delete_obsolete_files_in_prefix = flag
|
47
|
+
end
|
48
|
+
|
49
|
+
@@delete_obsolete_files_in_prefix = false
|
33
50
|
end
|
34
51
|
@builddir = nil
|
35
52
|
@prefix_path = []
|
@@ -85,6 +102,17 @@ def configurestamp; cmake_cache end
|
|
85
102
|
def initialize(options)
|
86
103
|
@defines = Hash.new
|
87
104
|
super
|
105
|
+
@delete_obsolete_files_in_prefix = self.class.delete_obsolete_files_in_prefix?
|
106
|
+
end
|
107
|
+
|
108
|
+
# (see CMake.delete_obsolete_files_in_prefix?)
|
109
|
+
def delete_obsolete_files_in_prefix?
|
110
|
+
@delete_obsolete_files_in_prefix
|
111
|
+
end
|
112
|
+
|
113
|
+
# (see CMake.delete_obsolete_files_in_prefix=)
|
114
|
+
def delete_obsolete_files_in_prefix=(flag)
|
115
|
+
@delete_obsolete_files_in_prefix = flag
|
88
116
|
end
|
89
117
|
|
90
118
|
@@defines = Hash.new
|
@@ -317,6 +345,28 @@ def update_environment
|
|
317
345
|
end
|
318
346
|
end
|
319
347
|
|
348
|
+
def defines_changed?(all_defines, cache_data)
|
349
|
+
all_defines.any? do |name, value|
|
350
|
+
if match = /^#{name}:\w+=(.*)$/.match(cache_data)
|
351
|
+
old_value = match[1]
|
352
|
+
end
|
353
|
+
|
354
|
+
value = value.to_s
|
355
|
+
if !old_value || !equivalent_option_value?(old_value, value)
|
356
|
+
if Autobuild.debug
|
357
|
+
message "%s: option '#{name}' changed value: '#{old_value}' => '#{value}'"
|
358
|
+
end
|
359
|
+
if old_value
|
360
|
+
message "%s: changed value of #{name} from #{old_value} to #{value}"
|
361
|
+
else
|
362
|
+
message "%s: setting value of #{name} to #{value}"
|
363
|
+
end
|
364
|
+
|
365
|
+
true
|
366
|
+
end
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
320
370
|
def prepare
|
321
371
|
# A failed initial CMake configuration leaves a CMakeCache.txt file,
|
322
372
|
# but no Makefile.
|
@@ -329,29 +379,8 @@ def prepare
|
|
329
379
|
doc_utility.source_ref_dir = builddir
|
330
380
|
|
331
381
|
if File.exist?(cmake_cache)
|
332
|
-
all_defines = self.all_defines
|
333
382
|
cache = File.read(cmake_cache)
|
334
|
-
|
335
|
-
cache_line = cache.each_line.find do |line|
|
336
|
-
line =~ /^#{name}:/
|
337
|
-
end
|
338
|
-
|
339
|
-
value = value.to_s
|
340
|
-
old_value = cache_line.partition("=").last.chomp if cache_line
|
341
|
-
if !old_value || !equivalent_option_value?(old_value, value)
|
342
|
-
if Autobuild.debug
|
343
|
-
message "%s: option '#{name}' changed value: '#{old_value}' => '#{value}'"
|
344
|
-
end
|
345
|
-
if old_value
|
346
|
-
message "%s: changed value of #{name} from #{old_value} to #{value}"
|
347
|
-
else
|
348
|
-
message "%s: setting value of #{name} to #{value}"
|
349
|
-
end
|
350
|
-
|
351
|
-
true
|
352
|
-
end
|
353
|
-
end
|
354
|
-
if did_change
|
383
|
+
if defines_changed?(all_defines, cache)
|
355
384
|
if Autobuild.debug
|
356
385
|
message "%s: CMake configuration changed, forcing a reconfigure"
|
357
386
|
end
|
@@ -463,14 +492,41 @@ def build
|
|
463
492
|
end
|
464
493
|
|
465
494
|
# Install the result in prefix
|
495
|
+
#
|
496
|
+
# If {#delete_obsolete_files_in_prefix?} is set, files that are present
|
497
|
+
# in the prefix but not in CMake's install manifest will be removed.
|
466
498
|
def install
|
467
499
|
in_dir(builddir) do
|
468
500
|
progress_start "installing %s", :done_message => 'installed %s' do
|
469
501
|
run('install', Autobuild.tool(:make), "-j#{parallel_build_level}", 'install')
|
470
502
|
end
|
503
|
+
|
504
|
+
if delete_obsolete_files_in_prefix?
|
505
|
+
delete_obsolete_files
|
506
|
+
end
|
471
507
|
end
|
472
508
|
super
|
473
509
|
end
|
510
|
+
|
511
|
+
# @api private
|
512
|
+
#
|
513
|
+
# Delete files in {#prefix} that are not present in CMake's install
|
514
|
+
# manifest
|
515
|
+
#
|
516
|
+
# This is enabled globally by {CMake.delete_obsolete_files=} or
|
517
|
+
# per-package with {#delete_obsolete_files=}. Do NOT enable if packages
|
518
|
+
# share the same prefix.
|
519
|
+
def delete_obsolete_files
|
520
|
+
manifest_contents = File.readlines(File.join(builddir, 'install_manifest.txt')).
|
521
|
+
map(&:chomp).to_set
|
522
|
+
logdir = self.logdir
|
523
|
+
Find.find(prefix) do |path|
|
524
|
+
Find.prune if path == logdir
|
525
|
+
if !manifest_contents.include?(path) && File.file?(path)
|
526
|
+
FileUtils.rm path
|
527
|
+
end
|
528
|
+
end
|
529
|
+
end
|
474
530
|
end
|
475
531
|
end
|
476
532
|
|
@@ -1,4 +1,8 @@
|
|
1
1
|
module Autobuild
|
2
|
+
# Handling of "standard" Ruby packages
|
3
|
+
#
|
4
|
+
# The package is expected to follow the general standards laid down by the
|
5
|
+
# bundler guys (i.e. look like a package generated by `bundler gem`)
|
2
6
|
class Ruby < ImporterPackage
|
3
7
|
# The Rake task that is used to set up the package. Defaults to "default".
|
4
8
|
# Set to nil to disable setup altogether
|
data/lib/autobuild/reporting.rb
CHANGED
@@ -281,29 +281,32 @@ module Reporting
|
|
281
281
|
## Run a block and report known exception
|
282
282
|
# If an exception is fatal, the program is terminated using exit()
|
283
283
|
def self.report
|
284
|
-
begin
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
# on the way. If so, raise an exception to inform the user about
|
289
|
-
# it
|
290
|
-
errors = []
|
291
|
-
Autobuild::Package.each do |name, pkg|
|
292
|
-
errors.concat(pkg.failures)
|
293
|
-
end
|
284
|
+
begin yield
|
285
|
+
rescue Interrupt
|
286
|
+
interrupted = true
|
287
|
+
end
|
294
288
|
|
295
|
-
|
296
|
-
|
297
|
-
|
289
|
+
# If ignore_erorrs is true, check if some packages have failed
|
290
|
+
# on the way. If so, raise an exception to inform the user about
|
291
|
+
# it
|
292
|
+
errors = []
|
293
|
+
Autobuild::Package.each do |name, pkg|
|
294
|
+
errors.concat(pkg.failures)
|
295
|
+
end
|
298
296
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
297
|
+
if !errors.empty?
|
298
|
+
raise CompositeException.new(errors)
|
299
|
+
elsif interrupted
|
300
|
+
raise Interrupt
|
301
|
+
end
|
302
|
+
|
303
|
+
rescue Autobuild::Exception => e
|
304
|
+
error(e)
|
305
|
+
if e.fatal?
|
306
|
+
if Autobuild.debug
|
307
|
+
raise
|
308
|
+
else
|
309
|
+
exit 1
|
307
310
|
end
|
308
311
|
end
|
309
312
|
end
|
data/lib/autobuild/test.rb
CHANGED
@@ -41,7 +41,9 @@ module Autobuild
|
|
41
41
|
#
|
42
42
|
module SelfTest
|
43
43
|
def setup
|
44
|
-
@
|
44
|
+
@temp_dirs = Array.new
|
45
|
+
|
46
|
+
@tempdir = make_tmpdir
|
45
47
|
FileUtils.mkdir_p(@tempdir, :mode => 0700)
|
46
48
|
Autobuild.logdir = "#{tempdir}/log"
|
47
49
|
FileUtils.mkdir_p Autobuild.logdir
|
@@ -54,12 +56,18 @@ def teardown
|
|
54
56
|
super
|
55
57
|
|
56
58
|
Autobuild::Package.clear
|
59
|
+
Rake::Task.clear
|
57
60
|
|
58
|
-
|
59
|
-
FileUtils.rm_rf
|
61
|
+
@temp_dirs.each do |dir|
|
62
|
+
FileUtils.rm_rf dir
|
60
63
|
end
|
61
64
|
end
|
62
65
|
|
66
|
+
def make_tmpdir
|
67
|
+
@temp_dirs << (dir = Dir.mktmpdir)
|
68
|
+
dir
|
69
|
+
end
|
70
|
+
|
63
71
|
def data_dir
|
64
72
|
File.join(File.dirname(__FILE__), '..', '..', 'test', 'data')
|
65
73
|
end
|
@@ -86,6 +94,11 @@ def untar(file)
|
|
86
94
|
|
87
95
|
dir
|
88
96
|
end
|
97
|
+
|
98
|
+
def prepare_and_build_package(package)
|
99
|
+
package.prepare
|
100
|
+
Rake::Task["#{package.name}-build"].invoke
|
101
|
+
end
|
89
102
|
end
|
90
103
|
end
|
91
104
|
|
@@ -0,0 +1,105 @@
|
|
1
|
+
module Autobuild
|
2
|
+
# Control of the test facility for a package
|
3
|
+
class TestUtility < Utility
|
4
|
+
@coverage_enabled = false
|
5
|
+
|
6
|
+
# Whether coverage is enabled for all tests
|
7
|
+
def self.coverage_enabled?
|
8
|
+
@coverage_enabled
|
9
|
+
end
|
10
|
+
|
11
|
+
# Enable code coverage for all tests
|
12
|
+
def self.coverage_enabled=(flag)
|
13
|
+
@coverage_enabled = flag
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(name, package, install_on_error: true)
|
17
|
+
super(name, package, install_on_error: install_on_error)
|
18
|
+
@coverage_enabled = nil
|
19
|
+
@coverage_source_dir = nil
|
20
|
+
@coverage_target_dir = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
# Whether code coverage should be generated for these tests
|
24
|
+
def coverage_enabled?
|
25
|
+
if @coverage_enabled.nil?
|
26
|
+
TestUtility.coverage_enabled?
|
27
|
+
else @coverage_enabled
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def coverage_available?
|
32
|
+
!!@coverage_source_dir
|
33
|
+
end
|
34
|
+
|
35
|
+
# Controls whether code coverage should be measured
|
36
|
+
#
|
37
|
+
# @param [Boolean,nil] flag enable or disable code coverage. If set to
|
38
|
+
# nil, will use the default from {TestUtility.coverage?}
|
39
|
+
def coverage_enabled=(flag)
|
40
|
+
@coverage_enabled = flag
|
41
|
+
end
|
42
|
+
|
43
|
+
# Where the code coverage will be generated
|
44
|
+
#
|
45
|
+
# If left unset, {Utility#source_dir} will be used instead. Relative
|
46
|
+
# paths are resolved relative to {Package#builddir}
|
47
|
+
attr_writer :coverage_source_dir
|
48
|
+
|
49
|
+
# The full path to the coverage information
|
50
|
+
#
|
51
|
+
# It cannot be a subdirectory of {#source_dir}
|
52
|
+
#
|
53
|
+
# @return [String]
|
54
|
+
def coverage_source_dir
|
55
|
+
if @coverage_source_dir
|
56
|
+
relative = if package.respond_to?(:builddir)
|
57
|
+
package.builddir
|
58
|
+
else package.srcdir
|
59
|
+
end
|
60
|
+
File.expand_path(@coverage_source_dir, relative)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Where the code coverage will be generated
|
65
|
+
#
|
66
|
+
# If left unset, {Utility#target_dir}/coverage will be used instead.
|
67
|
+
# Relative paths are resolved relative to {Package#prefix}
|
68
|
+
attr_writer :coverage_target_dir
|
69
|
+
|
70
|
+
# Where the coverage information should be installed
|
71
|
+
#
|
72
|
+
# It is the same than {Utility#target_dir}/coverage by default
|
73
|
+
#
|
74
|
+
# @return [String]
|
75
|
+
def coverage_target_dir
|
76
|
+
if @coverage_target_dir
|
77
|
+
File.expand_path(@coverage_target_dir, package.prefix)
|
78
|
+
else File.join(target_dir, 'coverage')
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def install
|
83
|
+
super
|
84
|
+
|
85
|
+
if !coverage_enabled?
|
86
|
+
return
|
87
|
+
elsif !coverage_available?
|
88
|
+
package.warn "%s: #coverage_source_dir not set on #test_utility, skipping installation of the code coverage results"
|
89
|
+
end
|
90
|
+
|
91
|
+
coverage_target_dir = self.coverage_target_dir
|
92
|
+
coverage_source_dir = self.coverage_source_dir
|
93
|
+
if "#{coverage_source_dir}/".start_with?("#{source_dir}/")
|
94
|
+
raise ArgumentError, "#coverage_source_dir cannot be a subdirectory of #source_dir in #{package.name}"
|
95
|
+
elsif target_dir == coverage_target_dir
|
96
|
+
raise ArgumentError, "#coverage_target_dir cannot be the same than of #target_dir in #{package.name}"
|
97
|
+
end
|
98
|
+
|
99
|
+
FileUtils.mkdir_p File.dirname(coverage_target_dir)
|
100
|
+
FileUtils.cp_r coverage_source_dir, coverage_target_dir
|
101
|
+
package.message "%s: copied test coverage results for #{package.name} from #{coverage_source_dir} to #{coverage_target_dir}"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
data/lib/autobuild/tools.rb
CHANGED
@@ -27,7 +27,7 @@ def find_in_path(file, envvar = 'PATH')
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# Resolves the absolute path to a given tool
|
30
|
-
def tool_in_path(name)
|
30
|
+
def tool_in_path(name, env: self.env)
|
31
31
|
path, path_name, path_env = programs_in_path[name]
|
32
32
|
current = tool(name)
|
33
33
|
env_PATH = env.resolved_env['PATH']
|
data/lib/autobuild/utility.rb
CHANGED
@@ -85,7 +85,9 @@ def task(&block)
|
|
85
85
|
if enabled?
|
86
86
|
@installed = false
|
87
87
|
catch(:disabled) do
|
88
|
-
package.isolate_errors
|
88
|
+
package.isolate_errors do
|
89
|
+
call_task_block(&block)
|
90
|
+
end
|
89
91
|
end
|
90
92
|
end
|
91
93
|
end
|
@@ -161,7 +163,7 @@ def install
|
|
161
163
|
FileUtils.rm_rf target_dir
|
162
164
|
FileUtils.mkdir_p File.dirname(target_dir)
|
163
165
|
FileUtils.cp_r source_dir, target_dir
|
164
|
-
Autoproj.message " copied #{name} results for #{package.name} to #{target_dir}"
|
166
|
+
Autoproj.message " copied #{name} results for #{package.name} from #{source_dir} to #{target_dir}"
|
165
167
|
|
166
168
|
@installed = true
|
167
169
|
end
|
data/lib/autobuild/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autobuild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.0.
|
4
|
+
version: 1.10.0.rc15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Joyeux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08
|
11
|
+
date: 2016-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- lib/autobuild/reporting.rb
|
198
198
|
- lib/autobuild/subcommand.rb
|
199
199
|
- lib/autobuild/test.rb
|
200
|
+
- lib/autobuild/test_utility.rb
|
200
201
|
- lib/autobuild/timestamps.rb
|
201
202
|
- lib/autobuild/tools.rb
|
202
203
|
- lib/autobuild/utility.rb
|