autoproj 2.10.1 → 2.13.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/.rubocop.yml +5 -8
- data/.travis.yml +5 -3
- data/autoproj.gemspec +7 -6
- data/bin/alog +1 -0
- data/bin/autoproj +1 -1
- data/bin/autoproj_bootstrap +149 -86
- data/bin/autoproj_bootstrap.in +9 -7
- data/bin/autoproj_install +148 -82
- data/bin/autoproj_install.in +8 -3
- data/lib/autoproj.rb +3 -0
- data/lib/autoproj/aruba_minitest.rb +15 -0
- data/lib/autoproj/autobuild_extensions/dsl.rb +61 -27
- data/lib/autoproj/base.rb +35 -6
- data/lib/autoproj/cli/base.rb +1 -1
- data/lib/autoproj/cli/build.rb +9 -3
- data/lib/autoproj/cli/cache.rb +79 -7
- data/lib/autoproj/cli/doc.rb +4 -18
- data/lib/autoproj/cli/inspection_tool.rb +5 -6
- data/lib/autoproj/cli/main.rb +41 -18
- data/lib/autoproj/cli/main_doc.rb +86 -0
- data/lib/autoproj/cli/main_plugin.rb +3 -0
- data/lib/autoproj/cli/main_test.rb +15 -0
- data/lib/autoproj/cli/show.rb +12 -18
- data/lib/autoproj/cli/status.rb +15 -9
- data/lib/autoproj/cli/test.rb +13 -84
- data/lib/autoproj/cli/update.rb +77 -19
- data/lib/autoproj/cli/utility.rb +136 -0
- data/lib/autoproj/configuration.rb +28 -4
- data/lib/autoproj/default.osdeps +18 -0
- data/lib/autoproj/installation_manifest.rb +7 -5
- data/lib/autoproj/manifest.rb +15 -21
- data/lib/autoproj/ops/build.rb +23 -27
- data/lib/autoproj/ops/cache.rb +151 -33
- data/lib/autoproj/ops/cached_env.rb +2 -2
- data/lib/autoproj/ops/import.rb +146 -80
- data/lib/autoproj/ops/install.rb +140 -79
- data/lib/autoproj/ops/phase_reporting.rb +49 -0
- data/lib/autoproj/ops/snapshot.rb +2 -1
- data/lib/autoproj/ops/tools.rb +2 -2
- data/lib/autoproj/os_package_installer.rb +19 -11
- data/lib/autoproj/package_definition.rb +29 -10
- data/lib/autoproj/package_managers/apt_dpkg_manager.rb +49 -28
- data/lib/autoproj/package_managers/bundler_manager.rb +257 -87
- data/lib/autoproj/package_managers/homebrew_manager.rb +2 -2
- data/lib/autoproj/package_managers/shell_script_manager.rb +44 -24
- data/lib/autoproj/package_manifest.rb +49 -34
- data/lib/autoproj/package_set.rb +48 -29
- data/lib/autoproj/repository_managers/apt.rb +0 -1
- data/lib/autoproj/test.rb +29 -10
- data/lib/autoproj/variable_expansion.rb +3 -1
- data/lib/autoproj/vcs_definition.rb +30 -15
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +55 -13
- metadata +32 -28
@@ -9,7 +9,7 @@ def self.cached_env_path(root_dir)
|
|
9
9
|
def self.load_cached_env(root_dir)
|
10
10
|
path = cached_env_path(root_dir)
|
11
11
|
if File.file?(path)
|
12
|
-
env = YAML.
|
12
|
+
env = YAML.safe_load(File.read(path))
|
13
13
|
Autobuild::Environment::ExportedEnvironment.new(
|
14
14
|
env['set'], env['unset'], env['update'])
|
15
15
|
end
|
@@ -20,7 +20,7 @@ def self.save_cached_env(root_dir, env)
|
|
20
20
|
path = cached_env_path(root_dir)
|
21
21
|
existing =
|
22
22
|
begin
|
23
|
-
YAML.
|
23
|
+
YAML.safe_load(File.read(path))
|
24
24
|
rescue Exception
|
25
25
|
end
|
26
26
|
|
data/lib/autoproj/ops/import.rb
CHANGED
@@ -12,9 +12,10 @@ def auto_exclude?
|
|
12
12
|
end
|
13
13
|
attr_writer :auto_exclude
|
14
14
|
|
15
|
-
def initialize(ws)
|
15
|
+
def initialize(ws, report_path: nil)
|
16
16
|
@ws = ws
|
17
17
|
@auto_exclude = false
|
18
|
+
@report_path = report_path
|
18
19
|
end
|
19
20
|
|
20
21
|
def mark_exclusion_along_revdeps(pkg_name, revdeps, chain = [], reason = nil)
|
@@ -22,24 +23,24 @@ def mark_exclusion_along_revdeps(pkg_name, revdeps, chain = [], reason = nil)
|
|
22
23
|
chain.unshift pkg_name
|
23
24
|
if root
|
24
25
|
reason = ws.manifest.exclusion_reason(pkg_name)
|
26
|
+
elsif chain.size == 1
|
27
|
+
ws.manifest.exclude_package(pkg_name, "its dependency #{reason}")
|
25
28
|
else
|
26
|
-
|
27
|
-
|
28
|
-
else
|
29
|
-
ws.manifest.exclude_package(pkg_name, "#{reason} (dependency chain: #{chain.join(">")})")
|
30
|
-
end
|
29
|
+
ws.manifest.exclude_package(pkg_name, "#{reason} (dependency chain: "\
|
30
|
+
"#{chain.join('>')})")
|
31
31
|
end
|
32
32
|
|
33
|
-
return
|
33
|
+
return unless revdeps.key?(pkg_name)
|
34
|
+
|
34
35
|
revdeps[pkg_name].each do |dep_name|
|
35
|
-
|
36
|
+
unless ws.manifest.excluded?(dep_name)
|
36
37
|
mark_exclusion_along_revdeps(dep_name, revdeps, chain.dup, reason)
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
41
42
|
VALID_OSDEP_AVAILABILITY =
|
42
|
-
[OSPackageResolver::AVAILABLE, OSPackageResolver::IGNORE]
|
43
|
+
[OSPackageResolver::AVAILABLE, OSPackageResolver::IGNORE].freeze
|
43
44
|
|
44
45
|
def import_next_step(pkg, reverse_dependencies)
|
45
46
|
new_packages = []
|
@@ -85,23 +86,32 @@ def pre_package_import(selection, manifest, pkg, reverse_dependencies)
|
|
85
86
|
elsif manifest.ignored?(pkg.name)
|
86
87
|
false
|
87
88
|
elsif !pkg.importer && !File.directory?(pkg.srcdir)
|
88
|
-
raise ConfigError.new, "#{pkg.name} has no VCS, but is not
|
89
|
+
raise ConfigError.new, "#{pkg.name} has no VCS, but is not "\
|
90
|
+
"checked out in #{pkg.srcdir}"
|
89
91
|
else
|
90
92
|
true
|
91
93
|
end
|
92
94
|
end
|
93
95
|
|
94
|
-
def post_package_import(selection, manifest, pkg, reverse_dependencies,
|
95
|
-
|
96
|
+
def post_package_import(selection, manifest, pkg, reverse_dependencies,
|
97
|
+
auto_exclude: auto_exclude?)
|
98
|
+
Rake::Task["#{pkg.name}-import"]
|
99
|
+
.instance_variable_set(:@already_invoked, true)
|
96
100
|
if pkg.checked_out?
|
97
101
|
begin
|
98
102
|
manifest.load_package_manifest(pkg.name)
|
99
|
-
rescue
|
100
|
-
raise
|
101
|
-
|
103
|
+
rescue StandardError => e
|
104
|
+
raise unless auto_exclude
|
105
|
+
|
106
|
+
manifest.add_exclusion(pkg.name, "#{pkg.name} failed to import "\
|
107
|
+
"with #{e} and auto_exclude was true")
|
102
108
|
end
|
103
109
|
end
|
104
110
|
|
111
|
+
if !manifest.excluded?(pkg.name) && !manifest.ignored?(pkg.name)
|
112
|
+
process_post_import_blocks(pkg) if pkg.checked_out?
|
113
|
+
end
|
114
|
+
|
105
115
|
# The package setup mechanisms might have added an exclusion
|
106
116
|
# on this package. Handle this.
|
107
117
|
if manifest.excluded?(pkg.name)
|
@@ -113,10 +123,8 @@ def post_package_import(selection, manifest, pkg, reverse_dependencies, auto_exc
|
|
113
123
|
elsif manifest.ignored?(pkg.name)
|
114
124
|
false
|
115
125
|
else
|
116
|
-
|
117
|
-
|
118
|
-
end
|
119
|
-
import_next_step(pkg, reverse_dependencies)
|
126
|
+
pkg.apply_dependencies_from_manifest
|
127
|
+
import_next_step(pkg.autobuild, reverse_dependencies)
|
120
128
|
end
|
121
129
|
end
|
122
130
|
|
@@ -163,16 +171,16 @@ def install_internal_dependencies_for(*packages, **osdeps_options)
|
|
163
171
|
# @param [Integer] retry_count the number of retries that are
|
164
172
|
# allowed. Set to zero for no retry
|
165
173
|
# @param [Hash] import_options options passed to {Autobuild::Importer#import}
|
166
|
-
def queue_import_work(executor, completion_queue, pkg,
|
167
|
-
|
174
|
+
def queue_import_work(executor, completion_queue, pkg,
|
175
|
+
retry_count: nil, **import_options)
|
176
|
+
import_future = Concurrent::Future
|
177
|
+
.new(executor: executor, args: [pkg]) do |import_pkg|
|
168
178
|
## COMPLETELY BYPASS RAKE HERE
|
169
179
|
# The reason is that the ordering of import/prepare between
|
170
180
|
# packages is not important BUT the ordering of import vs.
|
171
181
|
# prepare in one package IS important: prepare is the method
|
172
182
|
# that takes into account dependencies.
|
173
|
-
if retry_count
|
174
|
-
import_pkg.autobuild.importer.retry_count = retry_count
|
175
|
-
end
|
183
|
+
import_pkg.autobuild.importer.retry_count = retry_count if retry_count
|
176
184
|
import_pkg.autobuild.import(**import_options)
|
177
185
|
end
|
178
186
|
import_future.add_observer do |time, result, reason|
|
@@ -191,10 +199,13 @@ def import_selected_packages(selection,
|
|
191
199
|
install_vcs_packages: Hash.new,
|
192
200
|
non_imported_packages: :checkout,
|
193
201
|
auto_exclude: auto_exclude?,
|
202
|
+
filter: ->(package) { true },
|
194
203
|
**import_options)
|
195
204
|
|
196
|
-
|
197
|
-
raise ArgumentError, "invalid value for 'non_imported_packages'.
|
205
|
+
unless %i[checkout ignore return].include?(non_imported_packages)
|
206
|
+
raise ArgumentError, "invalid value for 'non_imported_packages'. "\
|
207
|
+
"Expected one of :checkout, :ignore or :return "\
|
208
|
+
"but got #{non_imported_packages}"
|
198
209
|
end
|
199
210
|
|
200
211
|
# This is used in the ensure block, initialize as early as
|
@@ -220,32 +231,44 @@ def import_selected_packages(selection,
|
|
220
231
|
all_processed_packages = Set.new
|
221
232
|
main_thread_imports = Array.new
|
222
233
|
package_queue = selected_packages.to_a.sort_by(&:name)
|
234
|
+
|
223
235
|
failures = Array.new
|
224
236
|
missing_vcs = Array.new
|
225
237
|
installed_vcs_packages = Set['none', 'local']
|
226
238
|
while failures.empty? || keep_going
|
239
|
+
# Allow 'filter' to parallelize as well
|
240
|
+
if filter.respond_to?(:lookahead)
|
241
|
+
package_queue.each { |pkg| filter.lookahead(pkg) }
|
242
|
+
end
|
243
|
+
|
227
244
|
# Queue work for all packages in the queue
|
228
245
|
package_queue.each do |pkg|
|
229
246
|
# Remove packages that have already been processed
|
230
247
|
next if all_processed_packages.include?(pkg)
|
231
|
-
|
248
|
+
|
249
|
+
vcs_installed = installed_vcs_packages.include?(pkg.vcs.type)
|
250
|
+
if (non_imported_packages != :checkout) && !pkg.checked_out?
|
251
|
+
all_processed_packages << pkg
|
232
252
|
if non_imported_packages == :return
|
233
|
-
all_processed_packages << pkg
|
234
253
|
completion_queue << [pkg, Time.now, false, nil]
|
235
|
-
next
|
236
254
|
else
|
237
|
-
all_processed_packages << pkg
|
238
255
|
ws.manifest.ignore_package(pkg.name)
|
239
|
-
next
|
240
256
|
end
|
241
|
-
|
257
|
+
next
|
258
|
+
elsif install_vcs_packages && !vcs_installed
|
242
259
|
missing_vcs << pkg
|
243
260
|
next
|
244
261
|
end
|
245
262
|
all_processed_packages << pkg
|
246
263
|
|
264
|
+
unless filter.call(pkg)
|
265
|
+
completion_queue << [pkg, Time.now]
|
266
|
+
next
|
267
|
+
end
|
268
|
+
|
247
269
|
importer = pkg.autobuild.importer
|
248
|
-
if !pre_package_import(selection, manifest, pkg.autobuild,
|
270
|
+
if !pre_package_import(selection, manifest, pkg.autobuild,
|
271
|
+
reverse_dependencies)
|
249
272
|
next
|
250
273
|
elsif !importer
|
251
274
|
# The validity of this is checked in
|
@@ -255,28 +278,33 @@ def import_selected_packages(selection,
|
|
255
278
|
elsif importer.interactive?
|
256
279
|
main_thread_imports << pkg
|
257
280
|
next
|
258
|
-
elsif pkg.
|
281
|
+
elsif pkg.checked_out? && import_options[:checkout_only]
|
259
282
|
main_thread_imports << pkg
|
260
283
|
next
|
261
284
|
end
|
262
285
|
|
263
|
-
pending_packages << pkg
|
264
286
|
begin
|
287
|
+
pending_packages << pkg
|
265
288
|
queue_import_work(
|
266
|
-
executor, completion_queue, pkg,
|
289
|
+
executor, completion_queue, pkg,
|
290
|
+
retry_count: retry_count,
|
267
291
|
**import_options.merge(allow_interactive: false))
|
268
292
|
rescue Exception
|
269
293
|
pending_packages.delete(pkg)
|
270
294
|
raise
|
271
295
|
end
|
272
|
-
true
|
273
296
|
end
|
274
297
|
package_queue.clear
|
275
298
|
|
276
299
|
if completion_queue.empty? && pending_packages.empty?
|
277
|
-
|
300
|
+
unless missing_vcs.empty?
|
278
301
|
installed_vcs_packages.merge(
|
279
|
-
install_vcs_packages_for(
|
302
|
+
install_vcs_packages_for(
|
303
|
+
*missing_vcs,
|
304
|
+
install_only: import_options[:checkout_only],
|
305
|
+
**install_vcs_packages
|
306
|
+
)
|
307
|
+
)
|
280
308
|
package_queue.concat(missing_vcs)
|
281
309
|
missing_vcs.clear
|
282
310
|
next
|
@@ -289,15 +317,17 @@ def import_selected_packages(selection,
|
|
289
317
|
break
|
290
318
|
else
|
291
319
|
main_thread_imports.delete_if do |pkg|
|
320
|
+
# rubocop:disable Lint/HandleExceptions
|
292
321
|
begin
|
293
322
|
if retry_count
|
294
323
|
pkg.autobuild.importer.retry_count = retry_count
|
295
324
|
end
|
296
325
|
result = pkg.autobuild.import(
|
297
326
|
**import_options.merge(allow_interactive: true))
|
298
|
-
rescue
|
327
|
+
rescue StandardError => e
|
299
328
|
end
|
300
|
-
completion_queue << [pkg, Time.now, result,
|
329
|
+
completion_queue << [pkg, Time.now, result, e]
|
330
|
+
# rubocop:enable Lint/HandleExceptions
|
301
331
|
end
|
302
332
|
end
|
303
333
|
end
|
@@ -309,20 +339,21 @@ def import_selected_packages(selection,
|
|
309
339
|
if reason.kind_of?(Autobuild::InteractionRequired)
|
310
340
|
main_thread_imports << pkg
|
311
341
|
elsif auto_exclude
|
312
|
-
manifest.add_exclusion(
|
342
|
+
manifest.add_exclusion(
|
343
|
+
pkg.name, "#{pkg.name} failed to import with "\
|
344
|
+
"#{reason} and auto_exclude was true")
|
313
345
|
selection.filter_excluded_and_ignored_packages(manifest)
|
314
346
|
else
|
315
347
|
# One importer failed... terminate
|
316
348
|
Autoproj.error "import of #{pkg.name} failed"
|
317
|
-
|
318
|
-
Autoproj.error "#{reason}"
|
319
|
-
end
|
349
|
+
Autoproj.error reason.to_s unless reason.kind_of?(Interrupt)
|
320
350
|
failures << reason
|
321
351
|
end
|
322
352
|
else
|
323
|
-
|
324
|
-
|
325
|
-
|
353
|
+
new_packages = post_package_import(
|
354
|
+
selection, manifest, pkg, reverse_dependencies,
|
355
|
+
auto_exclude: auto_exclude)
|
356
|
+
if new_packages
|
326
357
|
# Excluded dependencies might have caused the package to be
|
327
358
|
# excluded as well ... do not add any dependency to the
|
328
359
|
# processing queue if it is the case
|
@@ -336,10 +367,10 @@ def import_selected_packages(selection,
|
|
336
367
|
end
|
337
368
|
|
338
369
|
all_processed_packages.delete_if do |processed_pkg|
|
339
|
-
ws.manifest.excluded?(processed_pkg.name) ||
|
370
|
+
ws.manifest.excluded?(processed_pkg.name) ||
|
371
|
+
ws.manifest.ignored?(processed_pkg.name)
|
340
372
|
end
|
341
|
-
|
342
|
-
|
373
|
+
[all_processed_packages, failures]
|
343
374
|
ensure
|
344
375
|
if failures && !failures.empty? && !keep_going
|
345
376
|
Autoproj.error "waiting for pending import jobs to finish"
|
@@ -350,17 +381,22 @@ def import_selected_packages(selection,
|
|
350
381
|
end
|
351
382
|
end
|
352
383
|
|
353
|
-
def finalize_package_load(processed_packages,
|
384
|
+
def finalize_package_load(processed_packages,
|
385
|
+
ignore_optional_dependencies: false,
|
386
|
+
auto_exclude: auto_exclude?)
|
354
387
|
manifest = ws.manifest
|
355
388
|
|
356
389
|
all = Set.new
|
357
|
-
package_queue =
|
390
|
+
package_queue =
|
391
|
+
manifest.all_layout_packages(false)
|
392
|
+
.each_source_package_name.to_a +
|
358
393
|
processed_packages.map(&:name).to_a
|
359
|
-
|
394
|
+
|
395
|
+
until package_queue.empty?
|
360
396
|
pkg_name = package_queue.shift
|
361
397
|
next if all.include?(pkg_name)
|
362
|
-
all << pkg_name
|
363
398
|
|
399
|
+
all << pkg_name
|
364
400
|
next if manifest.ignored?(pkg_name) || manifest.excluded?(pkg_name)
|
365
401
|
|
366
402
|
pkg_definition = manifest.find_package_definition(pkg_name)
|
@@ -370,27 +406,28 @@ def finalize_package_load(processed_packages, auto_exclude: auto_exclude?)
|
|
370
406
|
manifest.load_package_manifest(pkg.name)
|
371
407
|
process_post_import_blocks(pkg)
|
372
408
|
rescue Exception => e
|
373
|
-
raise
|
374
|
-
|
409
|
+
raise unless auto_exclude
|
410
|
+
|
411
|
+
manifest.exclude_package(
|
412
|
+
pkg.name, "#{pkg.name} had an error when "\
|
413
|
+
"being loaded (#{e.message}) and "\
|
414
|
+
"auto_exclude is true")
|
375
415
|
next
|
376
416
|
end
|
377
417
|
end
|
378
418
|
|
379
419
|
packages, osdeps = pkg.partition_optional_dependencies
|
380
|
-
packages.each do |dep_pkg_name|
|
381
|
-
if
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
osdeps.each do |osdep_pkg_name|
|
386
|
-
if !manifest.ignored?(osdep_pkg_name) && !manifest.excluded?(osdep_pkg_name)
|
387
|
-
pkg.os_packages << osdep_pkg_name
|
388
|
-
end
|
420
|
+
(packages + osdeps).each do |dep_pkg_name|
|
421
|
+
next if manifest.ignored?(dep_pkg_name)
|
422
|
+
next if manifest.excluded?(dep_pkg_name)
|
423
|
+
|
424
|
+
pkg.depends_on dep_pkg_name
|
389
425
|
end
|
390
426
|
|
391
427
|
if File.directory?(pkg.srcdir)
|
392
428
|
pkg.prepare
|
393
|
-
Rake::Task["#{pkg.name}-prepare"]
|
429
|
+
Rake::Task["#{pkg.name}-prepare"]
|
430
|
+
.instance_variable_set(:@already_invoked, true)
|
394
431
|
end
|
395
432
|
pkg.update_environment
|
396
433
|
package_queue.concat(pkg.dependencies)
|
@@ -406,6 +443,7 @@ def import_packages(selection,
|
|
406
443
|
keep_going: false,
|
407
444
|
install_vcs_packages: Hash.new,
|
408
445
|
auto_exclude: auto_exclude?,
|
446
|
+
filter: ->(pkg) { true },
|
409
447
|
**import_options)
|
410
448
|
|
411
449
|
manifest = ws.manifest
|
@@ -417,11 +455,10 @@ def import_packages(selection,
|
|
417
455
|
recursive: recursive,
|
418
456
|
install_vcs_packages: install_vcs_packages,
|
419
457
|
auto_exclude: auto_exclude,
|
458
|
+
filter: filter,
|
420
459
|
**import_options)
|
421
460
|
|
422
|
-
if !keep_going && !failures.empty?
|
423
|
-
raise failures.first
|
424
|
-
end
|
461
|
+
raise failures.first if !keep_going && !failures.empty?
|
425
462
|
|
426
463
|
install_internal_dependencies_for(*all_processed_packages)
|
427
464
|
finalize_package_load(all_processed_packages, auto_exclude: auto_exclude)
|
@@ -437,14 +474,17 @@ def import_packages(selection,
|
|
437
474
|
if warn_about_excluded_packages
|
438
475
|
selection.exclusions.each do |sel, pkg_names|
|
439
476
|
pkg_names.sort.each do |pkg_name|
|
440
|
-
Autoproj.warn "#{pkg_name}, which was selected
|
477
|
+
Autoproj.warn "#{pkg_name}, which was selected "\
|
478
|
+
"for #{sel}, cannot be built: "\
|
479
|
+
"#{manifest.exclusion_reason(pkg_name)}", :bold
|
441
480
|
end
|
442
481
|
end
|
443
482
|
end
|
444
483
|
if warn_about_ignored_packages
|
445
484
|
selection.ignores.each do |sel, pkg_names|
|
446
485
|
pkg_names.sort.each do |pkg_name|
|
447
|
-
Autoproj.warn "#{pkg_name}, which was selected for #{sel},
|
486
|
+
Autoproj.warn "#{pkg_name}, which was selected for #{sel}, "\
|
487
|
+
"is ignored", :bold
|
448
488
|
end
|
449
489
|
end
|
450
490
|
end
|
@@ -452,41 +492,67 @@ def import_packages(selection,
|
|
452
492
|
if !failures.empty?
|
453
493
|
raise PackageImportFailed.new(
|
454
494
|
failures, source_packages: all_enabled_sources,
|
455
|
-
|
495
|
+
osdep_packages: all_enabled_osdeps)
|
456
496
|
else
|
457
497
|
return all_enabled_sources, all_enabled_osdeps
|
458
498
|
end
|
459
|
-
|
460
499
|
ensure
|
461
|
-
|
462
|
-
|
500
|
+
create_report(all_processed_packages || []) if @report_path
|
501
|
+
|
502
|
+
update_log = ws.config.import_log_enabled? &&
|
503
|
+
Autoproj::Ops::Snapshot.update_log_available?(manifest)
|
504
|
+
if update_log
|
505
|
+
update_log_for_processed_packages(
|
506
|
+
all_processed_packages || Array.new, $!)
|
463
507
|
end
|
464
508
|
end
|
465
509
|
|
510
|
+
# Call post-import blcoks registered for the given package
|
511
|
+
#
|
512
|
+
# @param [PackageDefinition] pkg
|
466
513
|
def process_post_import_blocks(pkg)
|
467
514
|
Autoproj.each_post_import_block(pkg) do |block|
|
468
515
|
block.call(pkg)
|
469
516
|
end
|
470
517
|
end
|
471
518
|
|
519
|
+
def create_report(package_list)
|
520
|
+
FileUtils.mkdir_p File.dirname(@report_path)
|
521
|
+
|
522
|
+
packages = package_list.each_with_object({}) do |pkg_name, h|
|
523
|
+
pkg = @ws.manifest.find_autobuild_package(pkg_name)
|
524
|
+
|
525
|
+
h[pkg.name] = {
|
526
|
+
invoked: !!pkg.import_invoked?,
|
527
|
+
success: !!pkg.imported?
|
528
|
+
}
|
529
|
+
end
|
530
|
+
|
531
|
+
report = JSON.pretty_generate({
|
532
|
+
import_report: {
|
533
|
+
timestamp: Time.now,
|
534
|
+
packages: packages
|
535
|
+
}
|
536
|
+
})
|
537
|
+
IO.write(@report_path, report)
|
538
|
+
end
|
539
|
+
|
472
540
|
def update_log_for_processed_packages(all_processed_packages, exception)
|
473
541
|
all_updated_packages = all_processed_packages.find_all do |processed_pkg|
|
474
542
|
processed_pkg.autobuild.updated?
|
475
543
|
end
|
476
544
|
|
477
|
-
|
545
|
+
unless all_updated_packages.empty?
|
478
546
|
failure_message =
|
479
547
|
if exception
|
480
548
|
" (#{exception.message.split("\n").first})"
|
481
549
|
end
|
482
550
|
ops = Ops::Snapshot.new(ws.manifest, keep_going: true)
|
483
551
|
ops.update_package_import_state(
|
484
|
-
"#{$0} #{ARGV.join(
|
552
|
+
"#{$0} #{ARGV.join(' ')}#{failure_message}",
|
485
553
|
all_updated_packages.map(&:name))
|
486
554
|
end
|
487
555
|
end
|
488
556
|
end
|
489
557
|
end
|
490
558
|
end
|
491
|
-
|
492
|
-
|