autobuild 1.11.2 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/autobuild/environment.rb +2 -0
- data/lib/autobuild/import/archive.rb +1 -0
- data/lib/autobuild/reporting.rb +63 -22
- data/lib/autobuild/subcommand.rb +18 -8
- data/lib/autobuild/version.rb +1 -3
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aa8495a7fa559f22d689834414b45c31f51fb5b
|
4
|
+
data.tar.gz: 8e4d55676e5c79de59a77157501aa7e2f3c7af8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aedbeb75280b0ec1bae6a57bb2c35268d47709af81823f7e06e706ee36046f83433e66745a2bbe3546078daed1769c5997019353677275edb12653706ef1ddf9
|
7
|
+
data.tar.gz: 9bbcf11269f27b6939cd4641e56f7db9eefbce5a292b9888a5422c875a8e504ab1933c70b70263b05147df450858aca136d00e6c7b3d982fa87e0a9ff97b1e37
|
data/lib/autobuild/reporting.rb
CHANGED
@@ -46,7 +46,9 @@ def self.display_message(*args)
|
|
46
46
|
end
|
47
47
|
|
48
48
|
if !Autobuild.progress_display_enabled?
|
49
|
-
|
49
|
+
if !silent?
|
50
|
+
io.puts msg
|
51
|
+
end
|
50
52
|
return
|
51
53
|
end
|
52
54
|
|
@@ -270,9 +272,8 @@ def to_s
|
|
270
272
|
end
|
271
273
|
end
|
272
274
|
|
273
|
-
## The reporting module provides the framework
|
274
|
-
#
|
275
|
-
# to the user
|
275
|
+
## The reporting module provides the framework # to run commands in
|
276
|
+
# autobuild and report errors # to the user
|
276
277
|
#
|
277
278
|
# It does not use a logging framework like Log4r, but it should ;-)
|
278
279
|
module Reporting
|
@@ -280,10 +281,12 @@ module Reporting
|
|
280
281
|
|
281
282
|
## Run a block and report known exception
|
282
283
|
# If an exception is fatal, the program is terminated using exit()
|
283
|
-
def self.report
|
284
|
+
def self.report(on_package_failures: default_report_on_package_failures)
|
284
285
|
begin yield
|
285
|
-
rescue Interrupt
|
286
|
-
interrupted =
|
286
|
+
rescue Interrupt => e
|
287
|
+
interrupted = e
|
288
|
+
rescue Autobuild::Exception => e
|
289
|
+
return report_finish_on_error([e], on_package_failures: on_package_failures, interrupted_by: interrupted)
|
287
290
|
end
|
288
291
|
|
289
292
|
# If ignore_erorrs is true, check if some packages have failed
|
@@ -294,23 +297,62 @@ def self.report
|
|
294
297
|
errors.concat(pkg.failures)
|
295
298
|
end
|
296
299
|
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
300
|
+
report_finish_on_error(errors, on_package_failures: on_package_failures, interrupted_by: interrupted)
|
301
|
+
end
|
302
|
+
|
303
|
+
# @api private
|
304
|
+
#
|
305
|
+
# Helper that returns the default for on_package_failures
|
306
|
+
#
|
307
|
+
# The result depends on the value for Autobuild.debug. It is either
|
308
|
+
# :exit if debug is false, or :raise if it is true
|
309
|
+
def self.default_report_on_package_failures
|
310
|
+
if Autobuild.debug then :raise
|
311
|
+
else :exit
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
# @api private
|
316
|
+
#
|
317
|
+
# Handle how Reporting.report is meant to finish in case of error(s)
|
318
|
+
#
|
319
|
+
# @param [Symbol] on_package_failures how does the reporting should behave.
|
320
|
+
#
|
321
|
+
def self.report_finish_on_error(errors, on_package_failures: default_report_on_package_failures, interrupted_by: nil)
|
322
|
+
if ![:raise, :report_silent, :exit_silent].include?(on_package_failures)
|
323
|
+
errors.each { |e| error(e) }
|
324
|
+
end
|
325
|
+
fatal = errors.any?(&:fatal?)
|
326
|
+
if !fatal
|
327
|
+
if interrupted_by
|
328
|
+
raise interrupted_by
|
329
|
+
else
|
330
|
+
return errors
|
331
|
+
end
|
301
332
|
end
|
302
333
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
334
|
+
if on_package_failures == :raise
|
335
|
+
if interrupted_by
|
336
|
+
raise interrupted_by
|
337
|
+
end
|
338
|
+
|
339
|
+
e = if errors.size == 1 then errors.first
|
340
|
+
else CompositeException.new(errors)
|
341
|
+
end
|
342
|
+
raise e
|
343
|
+
elsif [:report_silent, :report].include?(on_package_failures)
|
344
|
+
if interrupted_by
|
345
|
+
raise interrupted_by
|
308
346
|
else
|
309
|
-
|
347
|
+
return errors
|
310
348
|
end
|
349
|
+
elsif [:exit, :exit_silent].include?(on_package_failures)
|
350
|
+
exit 1
|
351
|
+
else
|
352
|
+
raise ArgumentError, "unexpected value for on_package_failures: #{on_package_failures}"
|
311
353
|
end
|
312
354
|
end
|
313
|
-
|
355
|
+
|
314
356
|
## Reports a successful build to the user
|
315
357
|
def self.success
|
316
358
|
each_reporter { |rep| rep.success }
|
@@ -334,9 +376,9 @@ def self.clear_reporters
|
|
334
376
|
@@reporters.clear
|
335
377
|
end
|
336
378
|
|
337
|
-
|
338
|
-
|
339
|
-
|
379
|
+
def self.each_reporter(&iter)
|
380
|
+
@@reporters.each(&iter)
|
381
|
+
end
|
340
382
|
|
341
383
|
## Iterate on all log files
|
342
384
|
def self.each_log(&block)
|
@@ -363,4 +405,3 @@ def success
|
|
363
405
|
end
|
364
406
|
end
|
365
407
|
end
|
366
|
-
|
data/lib/autobuild/subcommand.rb
CHANGED
@@ -160,6 +160,16 @@ def initialize(status, do_retry)
|
|
160
160
|
CONTROL_UNEXPECTED = 2
|
161
161
|
CONTROL_INTERRUPT = 3
|
162
162
|
|
163
|
+
@transparent_mode = false
|
164
|
+
|
165
|
+
def self.transparent_mode?
|
166
|
+
@transparent_mode
|
167
|
+
end
|
168
|
+
|
169
|
+
def self.transparent_mode=(flag)
|
170
|
+
@transparent_mode = flag
|
171
|
+
end
|
172
|
+
|
163
173
|
# Run a subcommand and return its standard output
|
164
174
|
#
|
165
175
|
# The command's standard and error outputs, as well as the full command line
|
@@ -383,15 +393,15 @@ def self.run(target, phase, *command)
|
|
383
393
|
line = line.chomp
|
384
394
|
subcommand_output << line
|
385
395
|
|
386
|
-
if Autobuild.verbose
|
387
|
-
STDOUT.puts line
|
388
|
-
end
|
389
396
|
logfile.puts line
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
397
|
+
|
398
|
+
if Autobuild.verbose || transparent_mode?
|
399
|
+
STDOUT.puts "#{target_name}:#{phase}: #{line}"
|
400
|
+
elsif block_given?
|
401
|
+
# Do not yield
|
402
|
+
# would mix the progress output with the actual command
|
403
|
+
# output. Assume that if the user wants the command output,
|
404
|
+
# the autobuild progress output is unnecessary
|
395
405
|
yield(line)
|
396
406
|
end
|
397
407
|
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.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Joyeux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -247,4 +247,3 @@ signing_key:
|
|
247
247
|
specification_version: 4
|
248
248
|
summary: Library to handle build systems and import mechanisms
|
249
249
|
test_files: []
|
250
|
-
has_rdoc:
|