autobuild 1.21.0 → 1.22.0
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/.github/workflows/lint.yml +25 -0
- data/.github/workflows/test.yml +30 -0
- data/.rubocop.yml +14 -7
- data/autobuild.gemspec +1 -1
- data/bin/autobuild +1 -1
- data/lib/autobuild/build_logfile.rb +1 -2
- data/lib/autobuild/config.rb +5 -5
- data/lib/autobuild/environment.rb +28 -45
- data/lib/autobuild/exceptions.rb +11 -5
- data/lib/autobuild/import/archive.rb +31 -22
- data/lib/autobuild/import/cvs.rb +6 -6
- data/lib/autobuild/import/darcs.rb +4 -4
- data/lib/autobuild/import/git-lfs.rb +4 -4
- data/lib/autobuild/import/git.rb +139 -66
- data/lib/autobuild/import/hg.rb +7 -7
- data/lib/autobuild/import/svn.rb +15 -9
- data/lib/autobuild/importer.rb +33 -37
- data/lib/autobuild/mail_reporter.rb +5 -2
- data/lib/autobuild/package.rb +14 -12
- data/lib/autobuild/packages/autotools.rb +3 -8
- data/lib/autobuild/packages/cmake.rb +11 -8
- data/lib/autobuild/packages/dummy.rb +0 -4
- data/lib/autobuild/packages/gnumake.rb +1 -1
- data/lib/autobuild/packages/orogen.rb +11 -4
- data/lib/autobuild/packages/pkgconfig.rb +2 -2
- data/lib/autobuild/packages/python.rb +1 -2
- data/lib/autobuild/packages/ruby.rb +5 -5
- data/lib/autobuild/parallel.rb +7 -16
- data/lib/autobuild/pkgconfig.rb +1 -0
- data/lib/autobuild/progress_display.rb +5 -9
- data/lib/autobuild/rake_task_extension.rb +6 -0
- data/lib/autobuild/reporting.rb +7 -7
- data/lib/autobuild/subcommand.rb +24 -23
- data/lib/autobuild/timestamps.rb +3 -3
- data/lib/autobuild/utility.rb +3 -3
- data/lib/autobuild/version.rb +1 -1
- data/lib/autobuild.rb +0 -3
- metadata +5 -4
- data/.travis.yml +0 -21
@@ -95,7 +95,7 @@ module Autobuild
|
|
95
95
|
def self.make_subcommand(pkg, phase, *options, &block)
|
96
96
|
invoke_make_parallel(pkg, Autobuild.tool(:make)) do |*make_parallel_options|
|
97
97
|
pkg.run(phase, Autobuild.tool(:make),
|
98
|
-
|
98
|
+
*make_parallel_options, *options, &block)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
@@ -97,19 +97,19 @@ module Autobuild
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
attr_writer :corba
|
100
|
+
attr_writer :corba, :orogen_file
|
101
|
+
|
101
102
|
def corba
|
102
103
|
@corba || (@corba.nil? && Orogen.corba)
|
103
104
|
end
|
104
105
|
|
105
106
|
# Overrides the global Orocos.extended_states for this particular package
|
106
107
|
attr_writer :extended_states
|
108
|
+
|
107
109
|
def extended_states
|
108
110
|
@extended_states || (@extended_states.nil? && Orogen.extended_states)
|
109
111
|
end
|
110
112
|
|
111
|
-
attr_writer :orogen_file
|
112
|
-
|
113
113
|
# Path to the orogen file used for this package
|
114
114
|
#
|
115
115
|
# If not set, the class will look for a .orogen file in the package
|
@@ -128,7 +128,7 @@ module Autobuild
|
|
128
128
|
return File.basename(path)
|
129
129
|
end
|
130
130
|
raise ArgumentError,
|
131
|
-
|
131
|
+
"cannot find an oroGen specification file in #{srcdir}"
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
@@ -235,6 +235,13 @@ module Autobuild
|
|
235
235
|
cmdline << "--type-export-policy=#{Orogen.default_type_export_policy}"
|
236
236
|
cmdline << "--transports=#{Orogen.transports.sort.uniq.join(',')}"
|
237
237
|
end
|
238
|
+
if version >= "1.2"
|
239
|
+
cmdline << "--parallel-codegen=#{parallel_build_level}"
|
240
|
+
if (job_server = Autobuild.parallel_task_manager&.job_server)
|
241
|
+
fds = "#{job_server.rio.fileno},#{job_server.wio.fileno}"
|
242
|
+
cmdline << "--jobserver-auth=#{fds}"
|
243
|
+
end
|
244
|
+
end
|
238
245
|
|
239
246
|
# Now, add raw options
|
240
247
|
#
|
@@ -2,8 +2,7 @@ require 'autobuild/pkgconfig'
|
|
2
2
|
|
3
3
|
module Autobuild
|
4
4
|
class InstalledPkgConfig < Package
|
5
|
-
attr_reader :pkgconfig
|
6
|
-
attr_reader :prefix
|
5
|
+
attr_reader :pkgconfig, :prefix
|
7
6
|
|
8
7
|
def initialize(name)
|
9
8
|
@pkgconfig = PkgConfig.new(name)
|
@@ -23,6 +22,7 @@ module Autobuild
|
|
23
22
|
pcfile
|
24
23
|
end
|
25
24
|
end
|
25
|
+
|
26
26
|
def self.installed_pkgconfig(name, &block)
|
27
27
|
InstalledPkgConfig.new(name, &block)
|
28
28
|
end
|
@@ -9,8 +9,7 @@ module Autobuild
|
|
9
9
|
|
10
10
|
# Handler class to build python-based packages
|
11
11
|
class Python < Configurable
|
12
|
-
attr_accessor
|
13
|
-
attr_accessor :installflags
|
12
|
+
attr_accessor :buildflags, :installflags
|
14
13
|
|
15
14
|
def configurestamp
|
16
15
|
"#{builddir}/configure-autobuild-stamp"
|
@@ -40,7 +40,7 @@ module Autobuild
|
|
40
40
|
done_message: 'generated documentation for %s' do
|
41
41
|
run 'doc',
|
42
42
|
Autobuild.tool_in_path('ruby'), '-S',
|
43
|
-
|
43
|
+
Autobuild.tool('rake'), rake_doc_task,
|
44
44
|
working_directory: srcdir
|
45
45
|
end
|
46
46
|
end
|
@@ -52,7 +52,7 @@ module Autobuild
|
|
52
52
|
done_message: 'tests passed for %s' do
|
53
53
|
run 'test',
|
54
54
|
Autobuild.tool_in_path('ruby'), '-S',
|
55
|
-
|
55
|
+
Autobuild.tool('rake'), rake_test_task, *rake_test_options,
|
56
56
|
working_directory: srcdir
|
57
57
|
end
|
58
58
|
end
|
@@ -62,7 +62,7 @@ module Autobuild
|
|
62
62
|
if setup_task && File.file?(File.join(srcdir, 'Rakefile'))
|
63
63
|
run 'post-install',
|
64
64
|
Autobuild.tool_in_path('ruby'), '-S',
|
65
|
-
|
65
|
+
Autobuild.tool('rake'), setup_task,
|
66
66
|
working_directory: srcdir
|
67
67
|
end
|
68
68
|
end
|
@@ -80,7 +80,7 @@ module Autobuild
|
|
80
80
|
%w[ext tmp].each do |extdir|
|
81
81
|
if File.directory?(extdir)
|
82
82
|
Find.find(extdir) do |file|
|
83
|
-
next if file !~
|
83
|
+
next if file !~ /<Makefile>|<CMakeCache.txt>$/
|
84
84
|
|
85
85
|
FileUtils.rm_rf file
|
86
86
|
end
|
@@ -94,7 +94,7 @@ module Autobuild
|
|
94
94
|
begin
|
95
95
|
run 'clean',
|
96
96
|
Autobuild.tool_in_path('ruby'), '-S',
|
97
|
-
|
97
|
+
Autobuild.tool('rake'), rake_clean_task,
|
98
98
|
working_directory: srcdir
|
99
99
|
rescue Autobuild::SubcommandFailed => e
|
100
100
|
warn "%s: clean failed. If this package does not need a clean target,"
|
data/lib/autobuild/parallel.rb
CHANGED
@@ -4,15 +4,10 @@ module Autobuild
|
|
4
4
|
# Since autobuild does not use task arguments, we don't support them for
|
5
5
|
# simplicity
|
6
6
|
class RakeTaskParallelism
|
7
|
-
attr_reader :available_workers
|
8
|
-
attr_reader :finished_workers
|
9
|
-
attr_reader :workers
|
10
|
-
|
11
|
-
attr_reader :job_server
|
7
|
+
attr_reader :available_workers, :finished_workers, :workers, :job_server
|
12
8
|
|
13
9
|
class JobServer
|
14
|
-
attr_reader :rio
|
15
|
-
attr_reader :wio
|
10
|
+
attr_reader :rio, :wio
|
16
11
|
|
17
12
|
def initialize(level)
|
18
13
|
@rio, @wio = IO.pipe
|
@@ -76,14 +71,10 @@ module Autobuild
|
|
76
71
|
end
|
77
72
|
|
78
73
|
class ProcessingState
|
79
|
-
attr_reader :reverse_dependencies
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
attr_reader :queue
|
84
|
-
attr_reader :priorities
|
85
|
-
|
86
|
-
def initialize(reverse_dependencies, completion_callback: proc { })
|
74
|
+
attr_reader :reverse_dependencies, :processed, :started_packages,
|
75
|
+
:active_tasks, :queue, :priorities
|
76
|
+
|
77
|
+
def initialize(reverse_dependencies, completion_callback: proc {})
|
87
78
|
@reverse_dependencies = reverse_dependencies
|
88
79
|
@completion_callback = completion_callback
|
89
80
|
@processed = Set.new
|
@@ -156,7 +147,7 @@ module Autobuild
|
|
156
147
|
|
157
148
|
# Invokes the provided tasks. Unlike the rake code, this is a toplevel
|
158
149
|
# algorithm that does not use recursion
|
159
|
-
def invoke_parallel(required_tasks, completion_callback: proc {
|
150
|
+
def invoke_parallel(required_tasks, completion_callback: proc {})
|
160
151
|
tasks = Set.new
|
161
152
|
reverse_dependencies = Hash.new { |h, k| h[k] = Set.new }
|
162
153
|
required_tasks.each do |t|
|
data/lib/autobuild/pkgconfig.rb
CHANGED
@@ -45,7 +45,7 @@ module Autobuild
|
|
45
45
|
# Valid progress modes
|
46
46
|
#
|
47
47
|
# @see progress_mode=
|
48
|
-
PROGRESS_MODES = %I[single_line newline off]
|
48
|
+
PROGRESS_MODES = %I[single_line newline off].freeze
|
49
49
|
|
50
50
|
# Sets how progress messages will be displayed
|
51
51
|
#
|
@@ -57,7 +57,7 @@ module Autobuild
|
|
57
57
|
unless PROGRESS_MODES.include?(mode)
|
58
58
|
raise ArgumentError,
|
59
59
|
"#{mode} is not a valid mode, expected one of "\
|
60
|
-
"#{PROGRESS_MODES.join(
|
60
|
+
"#{PROGRESS_MODES.join(', ')}"
|
61
61
|
end
|
62
62
|
@progress_mode = mode
|
63
63
|
end
|
@@ -72,9 +72,7 @@ module Autobuild
|
|
72
72
|
@silent
|
73
73
|
end
|
74
74
|
|
75
|
-
|
76
|
-
@silent = flag
|
77
|
-
end
|
75
|
+
attr_writer :silent
|
78
76
|
|
79
77
|
def silent
|
80
78
|
silent = @silent
|
@@ -156,7 +154,7 @@ module Autobuild
|
|
156
154
|
if changed
|
157
155
|
if message
|
158
156
|
message(" #{message}")
|
159
|
-
#
|
157
|
+
# NOTE: message updates the display already
|
160
158
|
else
|
161
159
|
refresh_display
|
162
160
|
end
|
@@ -178,9 +176,7 @@ module Autobuild
|
|
178
176
|
# Display queued messages
|
179
177
|
until @message_queue.empty?
|
180
178
|
message, args, io = @message_queue.pop
|
181
|
-
if @progress_mode == :single_line
|
182
|
-
io.print @cursor.clear_screen_down
|
183
|
-
end
|
179
|
+
io.print @cursor.clear_screen_down if @progress_mode == :single_line
|
184
180
|
io.puts @color.call(message, *args)
|
185
181
|
|
186
182
|
io.flush if @io != io
|
@@ -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
|
data/lib/autobuild/reporting.rb
CHANGED
@@ -105,8 +105,8 @@ module Autobuild
|
|
105
105
|
interrupted = e
|
106
106
|
rescue Autobuild::Exception => e
|
107
107
|
return report_finish_on_error([e],
|
108
|
-
|
109
|
-
|
108
|
+
on_package_failures: on_package_failures,
|
109
|
+
interrupted_by: interrupted)
|
110
110
|
end
|
111
111
|
|
112
112
|
# If ignore_erorrs is true, check if some packages have failed
|
@@ -118,8 +118,8 @@ module Autobuild
|
|
118
118
|
end
|
119
119
|
|
120
120
|
report_finish_on_error(errors,
|
121
|
-
|
122
|
-
|
121
|
+
on_package_failures: on_package_failures,
|
122
|
+
interrupted_by: interrupted)
|
123
123
|
end
|
124
124
|
|
125
125
|
# @api private
|
@@ -170,7 +170,7 @@ module Autobuild
|
|
170
170
|
if interrupted_by
|
171
171
|
raise interrupted_by
|
172
172
|
else
|
173
|
-
|
173
|
+
errors
|
174
174
|
end
|
175
175
|
elsif %i[exit exit_silent].include?(on_package_failures)
|
176
176
|
exit 1
|
@@ -244,8 +244,8 @@ module Autobuild
|
|
244
244
|
scaled_size = (size / scale)
|
245
245
|
if scaled_size > 1
|
246
246
|
return format("%3.1<scaled>f%<scale_name>s",
|
247
|
-
|
248
|
-
|
247
|
+
scaled: scaled_size,
|
248
|
+
scale_name: name)
|
249
249
|
end
|
250
250
|
end
|
251
251
|
end
|
data/lib/autobuild/subcommand.rb
CHANGED
@@ -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
|
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(
|
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
|
-
|
316
|
-
|
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
|
-
|
344
|
-
|
345
|
-
|
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
|
-
|
351
|
+
rescue Interrupt
|
349
352
|
cwrite.write([CONTROL_INTERRUPT].pack('I'))
|
350
353
|
exit(100)
|
351
|
-
|
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
|
-
|
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.
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
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
|
-
|
443
|
+
"'#{command.join(' ')}' terminated by signal #{status.termsig}"
|
443
444
|
else
|
444
445
|
raise Failed.new(status.exitstatus, nil),
|
445
|
-
|
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
|
-
|
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
|
data/lib/autobuild/timestamps.rb
CHANGED
@@ -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
|
-
|
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)
|