autobuild 1.19.0 → 1.22.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint.yml +25 -0
  3. data/.github/workflows/test.yml +30 -0
  4. data/.rubocop.yml +14 -7
  5. data/autobuild.gemspec +8 -6
  6. data/bin/autobuild +1 -1
  7. data/lib/autobuild/build_logfile.rb +1 -2
  8. data/lib/autobuild/config.rb +18 -5
  9. data/lib/autobuild/configurable.rb +3 -1
  10. data/lib/autobuild/environment.rb +28 -45
  11. data/lib/autobuild/exceptions.rb +11 -5
  12. data/lib/autobuild/import/archive.rb +31 -22
  13. data/lib/autobuild/import/cvs.rb +6 -6
  14. data/lib/autobuild/import/darcs.rb +4 -4
  15. data/lib/autobuild/import/git-lfs.rb +4 -4
  16. data/lib/autobuild/import/git.rb +149 -70
  17. data/lib/autobuild/import/hg.rb +7 -7
  18. data/lib/autobuild/import/svn.rb +15 -9
  19. data/lib/autobuild/importer.rb +38 -38
  20. data/lib/autobuild/mail_reporter.rb +5 -2
  21. data/lib/autobuild/package.rb +24 -14
  22. data/lib/autobuild/packages/autotools.rb +4 -9
  23. data/lib/autobuild/packages/cmake.rb +16 -7
  24. data/lib/autobuild/packages/dummy.rb +0 -4
  25. data/lib/autobuild/packages/gnumake.rb +1 -1
  26. data/lib/autobuild/packages/orogen.rb +11 -4
  27. data/lib/autobuild/packages/pkgconfig.rb +2 -2
  28. data/lib/autobuild/packages/python.rb +1 -2
  29. data/lib/autobuild/packages/ruby.rb +5 -5
  30. data/lib/autobuild/parallel.rb +12 -17
  31. data/lib/autobuild/pkgconfig.rb +1 -0
  32. data/lib/autobuild/progress_display.rb +130 -49
  33. data/lib/autobuild/rake_task_extension.rb +6 -0
  34. data/lib/autobuild/reporting.rb +20 -7
  35. data/lib/autobuild/subcommand.rb +24 -23
  36. data/lib/autobuild/test_utility.rb +2 -1
  37. data/lib/autobuild/timestamps.rb +3 -3
  38. data/lib/autobuild/utility.rb +29 -9
  39. data/lib/autobuild/version.rb +1 -1
  40. data/lib/autobuild.rb +0 -3
  41. metadata +42 -26
  42. data/.travis.yml +0 -19
@@ -1,5 +1,10 @@
1
1
  module Autobuild
2
2
  module RakeTaskExtension
3
+ def initialize(*, **)
4
+ super
5
+ @disabled = false
6
+ end
7
+
3
8
  def already_invoked?
4
9
  @already_invoked
5
10
  end
@@ -19,6 +24,7 @@ module Autobuild
19
24
  end
20
25
  end
21
26
  end
27
+
22
28
  class Rake::Task # rubocop:disable Style/ClassAndModuleChildren
23
29
  include Autobuild::RakeTaskExtension
24
30
  end
@@ -47,10 +47,23 @@ module Autobuild
47
47
  @display.progress_enabled?
48
48
  end
49
49
 
50
+ def self.progress_display_synchronize(&block)
51
+ @display.synchronize(&block)
52
+ end
53
+
54
+ # @deprecated use {progress_display_mode=} instead
50
55
  def self.progress_display_enabled=(value)
51
56
  @display.progress_enabled = value
52
57
  end
53
58
 
59
+ def self.progress_display_mode=(value)
60
+ @display.progress_mode = value
61
+ end
62
+
63
+ def self.progress_display_period=(value)
64
+ @display.progress_period = value
65
+ end
66
+
54
67
  def self.message(*args, **options)
55
68
  @display.message(*args, **options)
56
69
  end
@@ -92,8 +105,8 @@ module Autobuild
92
105
  interrupted = e
93
106
  rescue Autobuild::Exception => e
94
107
  return report_finish_on_error([e],
95
- on_package_failures: on_package_failures,
96
- interrupted_by: interrupted)
108
+ on_package_failures: on_package_failures,
109
+ interrupted_by: interrupted)
97
110
  end
98
111
 
99
112
  # If ignore_erorrs is true, check if some packages have failed
@@ -105,8 +118,8 @@ module Autobuild
105
118
  end
106
119
 
107
120
  report_finish_on_error(errors,
108
- on_package_failures: on_package_failures,
109
- interrupted_by: interrupted)
121
+ on_package_failures: on_package_failures,
122
+ interrupted_by: interrupted)
110
123
  end
111
124
 
112
125
  # @api private
@@ -157,7 +170,7 @@ module Autobuild
157
170
  if interrupted_by
158
171
  raise interrupted_by
159
172
  else
160
- return errors
173
+ errors
161
174
  end
162
175
  elsif %i[exit exit_silent].include?(on_package_failures)
163
176
  exit 1
@@ -231,8 +244,8 @@ module Autobuild
231
244
  scaled_size = (size / scale)
232
245
  if scaled_size > 1
233
246
  return format("%3.1<scaled>f%<scale_name>s",
234
- scaled: scaled_size,
235
- scale_name: name)
247
+ scaled: scaled_size,
248
+ scale_name: name)
236
249
  end
237
250
  end
238
251
  end
@@ -161,6 +161,7 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
161
161
  def initialize(status, do_retry)
162
162
  @status = status
163
163
  @retry = do_retry
164
+ super()
164
165
  end
165
166
  end
166
167
 
@@ -222,12 +223,14 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
222
223
 
223
224
  if command.last.kind_of?(Hash)
224
225
  options = command.pop
225
- options = Kernel.validate_options options,
226
+ options = Kernel.validate_options(
227
+ options,
226
228
  input: nil, working_directory: nil, retry: false,
227
229
  input_streams: [],
228
230
  env: ENV.to_hash,
229
231
  env_inherit: true,
230
232
  encoding: 'BINARY'
233
+ )
231
234
 
232
235
  input_streams << File.open(options[:input]) if options[:input]
233
236
  input_streams.concat(options[:input_streams]) if options[:input_streams]
@@ -255,8 +258,8 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
255
258
  options[:working_directory] ||= target.working_directory
256
259
  end
257
260
 
258
- logname = File.join(logdir, "#{target_name.gsub(/[:]/, '_')}-"\
259
- "#{phase.to_s.gsub(/[:]/, '_')}.log")
261
+ logname = File.join(logdir, "#{target_name.gsub(/:/, '_')}-"\
262
+ "#{phase.to_s.gsub(/:/, '_')}.log")
260
263
  unless File.directory?(File.dirname(logname))
261
264
  FileUtils.mkdir_p File.dirname(logname)
262
265
  end
@@ -312,8 +315,9 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
312
315
  if Autobuild.windows?
313
316
  Dir.chdir(options[:working_directory]) do
314
317
  unless system(*command)
315
- raise Failed.new($CHILD_STATUS.exitstatus, nil),
316
- "'#{command.join(' ')}' returned status #{status.exitstatus}"
318
+ exit_code = $CHILD_STATUS.exitstatus
319
+ raise Failed.new(exit_code, nil),
320
+ "'#{command.join(' ')}' returned status #{exit_code}"
317
321
  end
318
322
  end
319
323
  return # rubocop:disable Lint/NonLocalExitFromIterator
@@ -322,7 +326,6 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
322
326
  cwrite.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
323
327
 
324
328
  pid = fork do
325
- begin
326
329
  logfile.puts "in directory #{options[:working_directory] || Dir.pwd}"
327
330
 
328
331
  cwrite.sync = true
@@ -340,20 +343,19 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
340
343
  end
341
344
 
342
345
  exec(env, *command,
343
- chdir: options[:working_directory] || Dir.pwd,
344
- close_others: false)
345
- rescue Errno::ENOENT
346
+ chdir: options[:working_directory] || Dir.pwd,
347
+ close_others: false)
348
+ rescue Errno::ENOENT
346
349
  cwrite.write([CONTROL_COMMAND_NOT_FOUND].pack('I'))
347
350
  exit(100)
348
- rescue Interrupt
351
+ rescue Interrupt
349
352
  cwrite.write([CONTROL_INTERRUPT].pack('I'))
350
353
  exit(100)
351
- rescue ::Exception => e
354
+ rescue ::Exception => e
352
355
  STDERR.puts e
353
356
  STDERR.puts e.backtrace.join("\n ")
354
357
  cwrite.write([CONTROL_UNEXPECTED].pack('I'))
355
358
  exit(100)
356
- end
357
359
  end
358
360
 
359
361
  readbuffer = StringIO.new
@@ -372,7 +374,7 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
372
374
  end
373
375
  rescue Errno::ENOENT => e
374
376
  raise Failed.new(nil, false),
375
- "cannot open input files: #{e.message}", retry: false
377
+ "cannot open input files: #{e.message}", retry: false
376
378
  end
377
379
  pwrite.close
378
380
  end
@@ -382,15 +384,14 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
382
384
  value = cread.read(4)
383
385
  if value
384
386
  # An error occured
385
- value = value.unpack('I').first
386
- if value == CONTROL_COMMAND_NOT_FOUND
387
- raise Failed.new(nil, false),
388
- "command '#{command.first}' not found"
389
- elsif value == CONTROL_INTERRUPT
387
+ value = value.unpack1('I')
388
+ case value
389
+ when CONTROL_COMMAND_NOT_FOUND
390
+ raise Failed.new(nil, false), "command '#{command.first}' not found"
391
+ when CONTROL_INTERRUPT
390
392
  raise Interrupt, "command '#{command.first}': interrupted by user"
391
393
  else
392
- raise Failed.new(nil, false),
393
- "something unexpected happened"
394
+ raise Failed.new(nil, false), "something unexpected happened"
394
395
  end
395
396
  end
396
397
 
@@ -439,10 +440,10 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
439
440
 
440
441
  if status.termsig
441
442
  raise Failed.new(status.exitstatus, nil),
442
- "'#{command.join(' ')}' terminated by signal #{status.termsig}"
443
+ "'#{command.join(' ')}' terminated by signal #{status.termsig}"
443
444
  else
444
445
  raise Failed.new(status.exitstatus, nil),
445
- "'#{command.join(' ')}' returned status #{status.exitstatus}"
446
+ "'#{command.join(' ')}' returned status #{status.exitstatus}"
446
447
  end
447
448
  end
448
449
 
@@ -458,7 +459,7 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
458
459
  subcommand_output
459
460
  rescue Failed => e
460
461
  error = Autobuild::SubcommandFailed.new(target, command.join(" "),
461
- logname, e.status, subcommand_output)
462
+ logname, e.status, subcommand_output)
462
463
  error.retry = if e.retry?.nil? then options[:retry]
463
464
  else e.retry?
464
465
  end
@@ -73,7 +73,8 @@ module Autobuild
73
73
  def coverage_target_dir
74
74
  if @coverage_target_dir
75
75
  File.expand_path(@coverage_target_dir, package.prefix)
76
- else File.join(target_dir, 'coverage')
76
+ elsif (target_dir = self.target_dir)
77
+ File.join(target_dir, 'coverage')
77
78
  end
78
79
  end
79
80
 
@@ -58,8 +58,7 @@ module Autobuild
58
58
  class SourceTreeTask < Rake::Task
59
59
  attr_accessor :exclude
60
60
 
61
- attr_reader :newest_file
62
- attr_reader :newest_time
61
+ attr_reader :newest_file, :newest_time
63
62
 
64
63
  def initialize(*args, &block)
65
64
  @exclude = Autobuild.ignored_files.dup
@@ -71,10 +70,11 @@ module Autobuild
71
70
 
72
71
  @newest_file, @newest_time =
73
72
  Autobuild.tree_timestamp(name,
74
- %r{(?:^|/)(?:CVS|_darcs|\.svn)$}, *@exclude)
73
+ %r{(?:^|/)(?:CVS|_darcs|\.svn)$}, *@exclude)
75
74
  @newest_time
76
75
  end
77
76
  end
77
+
78
78
  def self.source_tree(path, &block)
79
79
  task = SourceTreeTask.define_task(path)
80
80
  block&.call(task)
@@ -30,6 +30,7 @@ module Autobuild
30
30
  @target_dir = nil
31
31
  @install_on_error = install_on_error
32
32
 
33
+ @no_results = false
33
34
  @invoked = false
34
35
  @success = false
35
36
  @installed = false
@@ -58,6 +59,23 @@ module Autobuild
58
59
  # not install anything
59
60
  attr_writer :target_dir
60
61
 
62
+ # Controls whether this utility generates results or not
63
+ #
64
+ # By default, Autobuild assumes that utilities generate report or
65
+ # artifact files, that are saved in {#target_dir}. Set this flag to
66
+ # true to disable this behavior, in which case the only report will
67
+ # be the console output during run
68
+ #
69
+ # @see no_results?
70
+ attr_writer :no_results
71
+
72
+ # Whether this utility generates results or not
73
+ #
74
+ # @see no_results=
75
+ def no_results?
76
+ @no_results
77
+ end
78
+
61
79
  # Absolute path to where the utility product files have to be installed.
62
80
  # Returns nil if {target_dir} is not set.
63
81
  #
@@ -66,7 +84,7 @@ module Autobuild
66
84
  if @target_dir
67
85
  utility_prefix = Autobuild.send("#{name}_prefix") || name
68
86
  File.expand_path(@target_dir,
69
- File.expand_path(utility_prefix, package.prefix))
87
+ File.expand_path(utility_prefix, package.prefix))
70
88
  else
71
89
  File.join(package.logdir, "#{name}-results", package.name)
72
90
  end
@@ -104,16 +122,18 @@ module Autobuild
104
122
  def call_task_block
105
123
  @invoked = true
106
124
 
107
- yield if block_given?
108
- @success = true
125
+ begin
126
+ yield if block_given?
127
+ @success = true
128
+ rescue StandardError => e
129
+ install if install_on_error? && !@installed && !no_results?
130
+ raise
131
+ end
109
132
 
110
133
  # Allow the user to install manually in the task
111
134
  # block
112
- install if !@installed && target_dir
113
- rescue Interrupt
114
- raise
115
- rescue ::Exception => e
116
- install if install_on_error? && !@installed && target_dir
135
+ install if !@installed && !no_results?
136
+ rescue StandardError => e
117
137
  @success = false
118
138
 
119
139
  if Autobuild.send("pass_#{name}_errors")
@@ -136,7 +156,7 @@ module Autobuild
136
156
  #
137
157
  # @return [Boolean]
138
158
  def available?
139
- @available && (source_dir && @task)
159
+ @available && @task && (no_results? || source_dir)
140
160
  end
141
161
 
142
162
  # True if this utility should be executed
@@ -1,3 +1,3 @@
1
1
  module Autobuild
2
- VERSION = "1.19.0".freeze unless defined? Autobuild::VERSION
2
+ VERSION = "1.22.1".freeze unless defined? Autobuild::VERSION
3
3
  end
data/lib/autobuild.rb CHANGED
@@ -17,11 +17,9 @@ require 'etc'
17
17
  require 'find'
18
18
  require 'pathname'
19
19
  require 'shellwords'
20
- require 'find'
21
20
  require 'rake/tasklib'
22
21
  require 'fileutils'
23
22
  require 'optparse'
24
- require 'rake'
25
23
  require 'singleton'
26
24
  require 'pastel'
27
25
  require 'tty-prompt'
@@ -43,7 +41,6 @@ require 'autobuild/config'
43
41
  require 'autobuild/importer'
44
42
  require 'autobuild/import/cvs'
45
43
  require 'autobuild/import/darcs'
46
- require 'autobuild/importer'
47
44
  require 'autobuild/import/git'
48
45
  require 'autobuild/import/hg'
49
46
  require 'autobuild/import/svn'
metadata CHANGED
@@ -1,33 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.0
4
+ version: 1.22.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-03 00:00:00.000000000 Z
11
+ date: 2021-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: pastel
14
+ name: concurrent-ruby
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.7.0
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 0.7.0
19
+ version: '1.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pastel
29
+ requirement: !ruby/object:Gem::Requirement
26
30
  requirements:
27
31
  - - "~>"
28
32
  - !ruby/object:Gem::Version
29
33
  version: 0.7.0
30
- - - ">="
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
31
39
  - !ruby/object:Gem::Version
32
40
  version: 0.7.0
33
41
  - !ruby/object:Gem::Dependency
@@ -36,62 +44,56 @@ dependencies:
36
44
  requirements:
37
45
  - - "~>"
38
46
  - !ruby/object:Gem::Version
39
- version: '12.0'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 12.3.0
47
+ version: '13.0'
43
48
  type: :runtime
44
49
  prerelease: false
45
50
  version_requirements: !ruby/object:Gem::Requirement
46
51
  requirements:
47
52
  - - "~>"
48
53
  - !ruby/object:Gem::Version
49
- version: '12.0'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 12.3.0
54
+ version: '13.0'
53
55
  - !ruby/object:Gem::Dependency
54
56
  name: tty-cursor
55
57
  requirement: !ruby/object:Gem::Requirement
56
58
  requirements:
57
59
  - - "~>"
58
60
  - !ruby/object:Gem::Version
59
- version: 0.5.0
61
+ version: 0.7.0
60
62
  type: :runtime
61
63
  prerelease: false
62
64
  version_requirements: !ruby/object:Gem::Requirement
63
65
  requirements:
64
66
  - - "~>"
65
67
  - !ruby/object:Gem::Version
66
- version: 0.5.0
68
+ version: 0.7.0
67
69
  - !ruby/object:Gem::Dependency
68
70
  name: tty-prompt
69
71
  requirement: !ruby/object:Gem::Requirement
70
72
  requirements:
71
73
  - - "~>"
72
74
  - !ruby/object:Gem::Version
73
- version: 0.15.0
75
+ version: 0.21.0
74
76
  type: :runtime
75
77
  prerelease: false
76
78
  version_requirements: !ruby/object:Gem::Requirement
77
79
  requirements:
78
80
  - - "~>"
79
81
  - !ruby/object:Gem::Version
80
- version: 0.15.0
82
+ version: 0.21.0
81
83
  - !ruby/object:Gem::Dependency
82
84
  name: tty-screen
83
85
  requirement: !ruby/object:Gem::Requirement
84
86
  requirements:
85
87
  - - "~>"
86
88
  - !ruby/object:Gem::Version
87
- version: 0.6.4
89
+ version: 0.8.0
88
90
  type: :runtime
89
91
  prerelease: false
90
92
  version_requirements: !ruby/object:Gem::Requirement
91
93
  requirements:
92
94
  - - "~>"
93
95
  - !ruby/object:Gem::Version
94
- version: 0.6.4
96
+ version: 0.8.0
95
97
  - !ruby/object:Gem::Dependency
96
98
  name: utilrb
97
99
  requirement: !ruby/object:Gem::Requirement
@@ -180,6 +182,20 @@ dependencies:
180
182
  - - ">="
181
183
  - !ruby/object:Gem::Version
182
184
  version: '0'
185
+ - !ruby/object:Gem::Dependency
186
+ name: timecop
187
+ requirement: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ type: :development
193
+ prerelease: false
194
+ version_requirements: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
183
199
  description: Collection of classes to handle build systems (CMake, autotools, ...)
184
200
  and import mechanisms (tarballs, CVS, SVN, git, ...). It also offers a Rake integration
185
201
  to import and build such software packages. It is the backbone of the autoproj (http://rock-robotics.org/autoproj)
@@ -190,9 +206,10 @@ extensions: []
190
206
  extra_rdoc_files: []
191
207
  files:
192
208
  - ".gitattributes"
209
+ - ".github/workflows/lint.yml"
210
+ - ".github/workflows/test.yml"
193
211
  - ".gitignore"
194
212
  - ".rubocop.yml"
195
- - ".travis.yml"
196
213
  - Changes.txt
197
214
  - Gemfile
198
215
  - Manifest.txt
@@ -253,15 +270,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
253
270
  requirements:
254
271
  - - ">="
255
272
  - !ruby/object:Gem::Version
256
- version: 2.3.0
273
+ version: 2.5.0
257
274
  required_rubygems_version: !ruby/object:Gem::Requirement
258
275
  requirements:
259
276
  - - ">="
260
277
  - !ruby/object:Gem::Version
261
278
  version: '0'
262
279
  requirements: []
263
- rubyforge_project:
264
- rubygems_version: 2.7.6.2
280
+ rubygems_version: 3.1.2
265
281
  signing_key:
266
282
  specification_version: 4
267
283
  summary: Library to handle build systems and import mechanisms