autoproj 2.12.0 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) 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 +79 -91
  5. data/.rubocop_todo.yml +1473 -0
  6. data/Gemfile +9 -9
  7. data/Rakefile +24 -24
  8. data/autoproj.gemspec +22 -22
  9. data/bin/alocate +4 -4
  10. data/bin/alog +6 -7
  11. data/bin/amake +4 -4
  12. data/bin/aup +4 -4
  13. data/bin/autoproj +2 -2
  14. data/bin/autoproj_bootstrap +186 -183
  15. data/bin/autoproj_bootstrap.in +7 -8
  16. data/bin/autoproj_install +185 -182
  17. data/bin/autoproj_install.in +6 -7
  18. data/lib/autoproj/aruba_minitest.rb +6 -11
  19. data/lib/autoproj/autobuild.rb +5 -6
  20. data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
  21. data/lib/autoproj/autobuild_extensions/dsl.rb +61 -44
  22. data/lib/autoproj/autobuild_extensions/git.rb +27 -26
  23. data/lib/autoproj/autobuild_extensions/package.rb +23 -22
  24. data/lib/autoproj/autobuild_extensions/svn.rb +1 -2
  25. data/lib/autoproj/base.rb +1 -1
  26. data/lib/autoproj/bash_completion.rb +5 -6
  27. data/lib/autoproj/build_option.rb +22 -24
  28. data/lib/autoproj/cli/base.rb +27 -27
  29. data/lib/autoproj/cli/bootstrap.rb +14 -16
  30. data/lib/autoproj/cli/build.rb +18 -10
  31. data/lib/autoproj/cli/cache.rb +51 -8
  32. data/lib/autoproj/cli/clean.rb +10 -10
  33. data/lib/autoproj/cli/commit.rb +7 -8
  34. data/lib/autoproj/cli/doc.rb +2 -2
  35. data/lib/autoproj/cli/envsh.rb +1 -2
  36. data/lib/autoproj/cli/exec.rb +60 -20
  37. data/lib/autoproj/cli/inspection_tool.rb +18 -13
  38. data/lib/autoproj/cli/locate.rb +30 -41
  39. data/lib/autoproj/cli/log.rb +7 -7
  40. data/lib/autoproj/cli/main.rb +217 -205
  41. data/lib/autoproj/cli/main_doc.rb +22 -21
  42. data/lib/autoproj/cli/main_global.rb +44 -19
  43. data/lib/autoproj/cli/main_plugin.rb +18 -18
  44. data/lib/autoproj/cli/main_test.rb +28 -27
  45. data/lib/autoproj/cli/manifest.rb +7 -7
  46. data/lib/autoproj/cli/osdeps.rb +12 -11
  47. data/lib/autoproj/cli/patcher.rb +2 -3
  48. data/lib/autoproj/cli/query.rb +17 -18
  49. data/lib/autoproj/cli/reconfigure.rb +1 -2
  50. data/lib/autoproj/cli/reset.rb +9 -12
  51. data/lib/autoproj/cli/show.rb +48 -55
  52. data/lib/autoproj/cli/status.rb +56 -44
  53. data/lib/autoproj/cli/switch_config.rb +5 -6
  54. data/lib/autoproj/cli/tag.rb +12 -11
  55. data/lib/autoproj/cli/test.rb +7 -7
  56. data/lib/autoproj/cli/update.rb +104 -51
  57. data/lib/autoproj/cli/utility.rb +14 -12
  58. data/lib/autoproj/cli/version.rb +42 -40
  59. data/lib/autoproj/cli/versions.rb +14 -15
  60. data/lib/autoproj/cli/watch.rb +33 -37
  61. data/lib/autoproj/cli/which.rb +16 -20
  62. data/lib/autoproj/cli.rb +4 -2
  63. data/lib/autoproj/configuration.rb +78 -85
  64. data/lib/autoproj/default.osdeps +29 -3
  65. data/lib/autoproj/environment.rb +42 -23
  66. data/lib/autoproj/exceptions.rb +9 -3
  67. data/lib/autoproj/find_workspace.rb +20 -25
  68. data/lib/autoproj/git_server_configuration.rb +40 -44
  69. data/lib/autoproj/gitorious.rb +1 -1
  70. data/lib/autoproj/installation_manifest.rb +64 -29
  71. data/lib/autoproj/local_package_set.rb +13 -11
  72. data/lib/autoproj/manifest.rb +145 -135
  73. data/lib/autoproj/metapackage.rb +2 -6
  74. data/lib/autoproj/ops/atomic_write.rb +7 -6
  75. data/lib/autoproj/ops/build.rb +4 -6
  76. data/lib/autoproj/ops/cache.rb +64 -53
  77. data/lib/autoproj/ops/cached_env.rb +7 -6
  78. data/lib/autoproj/ops/configuration.rb +511 -506
  79. data/lib/autoproj/ops/import.rb +90 -61
  80. data/lib/autoproj/ops/install.rb +179 -175
  81. data/lib/autoproj/ops/loader.rb +77 -76
  82. data/lib/autoproj/ops/main_config_switcher.rb +36 -45
  83. data/lib/autoproj/ops/phase_reporting.rb +4 -4
  84. data/lib/autoproj/ops/snapshot.rb +250 -247
  85. data/lib/autoproj/ops/tools.rb +76 -78
  86. data/lib/autoproj/ops/watch.rb +6 -6
  87. data/lib/autoproj/ops/which.rb +17 -14
  88. data/lib/autoproj/options.rb +13 -2
  89. data/lib/autoproj/os_package_installer.rb +102 -92
  90. data/lib/autoproj/os_package_query.rb +7 -13
  91. data/lib/autoproj/os_package_resolver.rb +189 -140
  92. data/lib/autoproj/os_repository_installer.rb +4 -4
  93. data/lib/autoproj/os_repository_resolver.rb +8 -6
  94. data/lib/autoproj/package_definition.rb +12 -13
  95. data/lib/autoproj/package_managers/apt_dpkg_manager.rb +46 -31
  96. data/lib/autoproj/package_managers/bundler_manager.rb +156 -118
  97. data/lib/autoproj/package_managers/debian_version.rb +25 -21
  98. data/lib/autoproj/package_managers/emerge_manager.rb +2 -3
  99. data/lib/autoproj/package_managers/gem_manager.rb +68 -77
  100. data/lib/autoproj/package_managers/homebrew_manager.rb +3 -4
  101. data/lib/autoproj/package_managers/manager.rb +8 -3
  102. data/lib/autoproj/package_managers/pacman_manager.rb +2 -3
  103. data/lib/autoproj/package_managers/pip_manager.rb +37 -27
  104. data/lib/autoproj/package_managers/pkg_manager.rb +3 -4
  105. data/lib/autoproj/package_managers/port_manager.rb +2 -3
  106. data/lib/autoproj/package_managers/shell_script_manager.rb +66 -36
  107. data/lib/autoproj/package_managers/unknown_os_manager.rb +5 -8
  108. data/lib/autoproj/package_managers/yum_manager.rb +12 -15
  109. data/lib/autoproj/package_managers/zypper_manager.rb +11 -14
  110. data/lib/autoproj/package_manifest.rb +66 -53
  111. data/lib/autoproj/package_selection.rb +187 -187
  112. data/lib/autoproj/package_set.rb +128 -114
  113. data/lib/autoproj/python.rb +285 -0
  114. data/lib/autoproj/query_base.rb +20 -14
  115. data/lib/autoproj/reporter.rb +19 -19
  116. data/lib/autoproj/repository_managers/apt.rb +101 -67
  117. data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
  118. data/lib/autoproj/shell_completion.rb +16 -13
  119. data/lib/autoproj/source_package_query.rb +29 -36
  120. data/lib/autoproj/system.rb +32 -21
  121. data/lib/autoproj/test.rb +131 -106
  122. data/lib/autoproj/variable_expansion.rb +10 -10
  123. data/lib/autoproj/vcs_definition.rb +53 -37
  124. data/lib/autoproj/version.rb +1 -1
  125. data/lib/autoproj/workspace.rb +162 -117
  126. data/lib/autoproj/zsh_completion.rb +8 -9
  127. data/lib/autoproj.rb +53 -53
  128. data/samples/autoproj/init.rb +1 -2
  129. metadata +62 -72
  130. data/.travis.yml +0 -22
@@ -94,7 +94,7 @@ module Autoproj
94
94
  end
95
95
 
96
96
  def post_package_import(selection, manifest, pkg, reverse_dependencies,
97
- auto_exclude: auto_exclude?)
97
+ auto_exclude: auto_exclude?)
98
98
  Rake::Task["#{pkg.name}-import"]
99
99
  .instance_variable_set(:@already_invoked, true)
100
100
  if pkg.checked_out?
@@ -103,8 +103,10 @@ module Autoproj
103
103
  rescue StandardError => e
104
104
  raise unless auto_exclude
105
105
 
106
- manifest.add_exclusion(pkg.name, "#{pkg.name} failed to import "\
107
- "with #{e} and auto_exclude was true")
106
+ manifest.add_exclusion(
107
+ pkg.name, "#{pkg.name} failed to import "\
108
+ "with #{e} and auto_exclude was true"
109
+ )
108
110
  end
109
111
  end
110
112
 
@@ -172,34 +174,35 @@ module Autoproj
172
174
  # allowed. Set to zero for no retry
173
175
  # @param [Hash] import_options options passed to {Autobuild::Importer#import}
174
176
  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|
178
- ## COMPLETELY BYPASS RAKE HERE
179
- # The reason is that the ordering of import/prepare between
180
- # packages is not important BUT the ordering of import vs.
181
- # prepare in one package IS important: prepare is the method
182
- # that takes into account dependencies.
183
- import_pkg.autobuild.importer.retry_count = retry_count if retry_count
184
- import_pkg.autobuild.import(**import_options)
185
- end
186
- import_future.add_observer do |time, result, reason|
177
+ retry_count: nil, **import_options)
178
+ import_future =
179
+ Concurrent::Promises.future_on(executor) do
180
+ ## COMPLETELY BYPASS RAKE HERE
181
+ # The reason is that the ordering of import/prepare between
182
+ # packages is not important BUT the ordering of import vs.
183
+ # prepare in one package IS important: prepare is the method
184
+ # that takes into account dependencies.
185
+ pkg.autobuild.importer.retry_count = retry_count if retry_count
186
+ pkg.autobuild.import(**import_options)
187
+ end
188
+
189
+ import_future.on_resolution! do |time, result, reason|
187
190
  completion_queue << [pkg, time, result, reason]
188
191
  end
189
- import_future.execute
190
192
  end
191
193
 
192
194
  # Import all packages from the given selection, and their
193
195
  # dependencies
194
196
  def import_selected_packages(selection,
195
- parallel: ws.config.parallel_import_level,
196
- recursive: true,
197
- retry_count: nil,
198
- keep_going: false,
199
- install_vcs_packages: Hash.new,
200
- non_imported_packages: :checkout,
201
- auto_exclude: auto_exclude?,
202
- **import_options)
197
+ parallel: ws.config.parallel_import_level,
198
+ recursive: true,
199
+ retry_count: nil,
200
+ keep_going: false,
201
+ install_vcs_packages: Hash.new,
202
+ non_imported_packages: :checkout,
203
+ auto_exclude: auto_exclude?,
204
+ filter: ->(package) { true },
205
+ **import_options)
203
206
 
204
207
  unless %i[checkout ignore return].include?(non_imported_packages)
205
208
  raise ArgumentError, "invalid value for 'non_imported_packages'. "\
@@ -233,8 +236,13 @@ module Autoproj
233
236
 
234
237
  failures = Array.new
235
238
  missing_vcs = Array.new
236
- installed_vcs_packages = Set['none', 'local']
239
+ installed_vcs_packages = Set["none", "local"]
237
240
  while failures.empty? || keep_going
241
+ # Allow 'filter' to parallelize as well
242
+ if filter.respond_to?(:lookahead)
243
+ package_queue.each { |pkg| filter.lookahead(pkg) }
244
+ end
245
+
238
246
  # Queue work for all packages in the queue
239
247
  package_queue.each do |pkg|
240
248
  # Remove packages that have already been processed
@@ -255,6 +263,11 @@ module Autoproj
255
263
  end
256
264
  all_processed_packages << pkg
257
265
 
266
+ unless filter.call(pkg)
267
+ completion_queue << [pkg, Time.now]
268
+ next
269
+ end
270
+
258
271
  importer = pkg.autobuild.importer
259
272
  if !pre_package_import(selection, manifest, pkg.autobuild,
260
273
  reverse_dependencies)
@@ -272,12 +285,13 @@ module Autoproj
272
285
  next
273
286
  end
274
287
 
275
- pending_packages << pkg
276
288
  begin
289
+ pending_packages << pkg
277
290
  queue_import_work(
278
291
  executor, completion_queue, pkg,
279
292
  retry_count: retry_count,
280
- **import_options.merge(allow_interactive: false))
293
+ **import_options.merge(allow_interactive: false)
294
+ )
281
295
  rescue Exception
282
296
  pending_packages.delete(pkg)
283
297
  raise
@@ -288,8 +302,12 @@ module Autoproj
288
302
  if completion_queue.empty? && pending_packages.empty?
289
303
  unless missing_vcs.empty?
290
304
  installed_vcs_packages.merge(
291
- install_vcs_packages_for(*missing_vcs,
292
- **install_vcs_packages))
305
+ install_vcs_packages_for(
306
+ *missing_vcs,
307
+ install_only: import_options[:checkout_only],
308
+ **install_vcs_packages
309
+ )
310
+ )
293
311
  package_queue.concat(missing_vcs)
294
312
  missing_vcs.clear
295
313
  next
@@ -302,17 +320,17 @@ module Autoproj
302
320
  break
303
321
  else
304
322
  main_thread_imports.delete_if do |pkg|
305
- # rubocop:disable Lint/HandleExceptions
306
323
  begin
307
324
  if retry_count
308
325
  pkg.autobuild.importer.retry_count = retry_count
309
326
  end
310
327
  result = pkg.autobuild.import(
311
- **import_options.merge(allow_interactive: true))
328
+ **import_options.merge(allow_interactive: true)
329
+ )
312
330
  rescue StandardError => e
313
331
  end
314
- completion_queue << [pkg, Time.now, result, e]
315
- # rubocop:enable Lint/HandleExceptions
332
+ completion_queue << [pkg,
333
+ Time.now, result, e]
316
334
  end
317
335
  end
318
336
  end
@@ -326,7 +344,8 @@ module Autoproj
326
344
  elsif auto_exclude
327
345
  manifest.add_exclusion(
328
346
  pkg.name, "#{pkg.name} failed to import with "\
329
- "#{reason} and auto_exclude was true")
347
+ "#{reason} and auto_exclude was true"
348
+ )
330
349
  selection.filter_excluded_and_ignored_packages(manifest)
331
350
  else
332
351
  # One importer failed... terminate
@@ -337,7 +356,8 @@ module Autoproj
337
356
  else
338
357
  new_packages = post_package_import(
339
358
  selection, manifest, pkg, reverse_dependencies,
340
- auto_exclude: auto_exclude)
359
+ auto_exclude: auto_exclude
360
+ )
341
361
  if new_packages
342
362
  # Excluded dependencies might have caused the package to be
343
363
  # excluded as well ... do not add any dependency to the
@@ -366,7 +386,9 @@ module Autoproj
366
386
  end
367
387
  end
368
388
 
369
- def finalize_package_load(processed_packages, auto_exclude: auto_exclude?)
389
+ def finalize_package_load(processed_packages,
390
+ ignore_optional_dependencies: false,
391
+ auto_exclude: auto_exclude?)
370
392
  manifest = ws.manifest
371
393
 
372
394
  all = Set.new
@@ -394,7 +416,8 @@ module Autoproj
394
416
  manifest.exclude_package(
395
417
  pkg.name, "#{pkg.name} had an error when "\
396
418
  "being loaded (#{e.message}) and "\
397
- "auto_exclude is true")
419
+ "auto_exclude is true"
420
+ )
398
421
  next
399
422
  end
400
423
  end
@@ -419,14 +442,15 @@ module Autoproj
419
442
  end
420
443
 
421
444
  def import_packages(selection,
422
- non_imported_packages: :checkout,
423
- warn_about_ignored_packages: true,
424
- warn_about_excluded_packages: true,
425
- recursive: true,
426
- keep_going: false,
427
- install_vcs_packages: Hash.new,
428
- auto_exclude: auto_exclude?,
429
- **import_options)
445
+ non_imported_packages: :checkout,
446
+ warn_about_ignored_packages: true,
447
+ warn_about_excluded_packages: true,
448
+ recursive: true,
449
+ keep_going: false,
450
+ install_vcs_packages: Hash.new,
451
+ auto_exclude: auto_exclude?,
452
+ filter: ->(pkg) { true },
453
+ **import_options)
430
454
 
431
455
  manifest = ws.manifest
432
456
 
@@ -437,7 +461,9 @@ module Autoproj
437
461
  recursive: recursive,
438
462
  install_vcs_packages: install_vcs_packages,
439
463
  auto_exclude: auto_exclude,
440
- **import_options)
464
+ filter: filter,
465
+ **import_options
466
+ )
441
467
 
442
468
  raise failures.first if !keep_going && !failures.empty?
443
469
 
@@ -470,12 +496,13 @@ module Autoproj
470
496
  end
471
497
  end
472
498
 
473
- if !failures.empty?
499
+ if failures.empty?
500
+ [all_enabled_sources, all_enabled_osdeps]
501
+ else
474
502
  raise PackageImportFailed.new(
475
503
  failures, source_packages: all_enabled_sources,
476
- osdep_packages: all_enabled_osdeps)
477
- else
478
- return all_enabled_sources, all_enabled_osdeps
504
+ osdep_packages: all_enabled_osdeps
505
+ )
479
506
  end
480
507
  ensure
481
508
  create_report(all_processed_packages || []) if @report_path
@@ -484,7 +511,8 @@ module Autoproj
484
511
  Autoproj::Ops::Snapshot.update_log_available?(manifest)
485
512
  if update_log
486
513
  update_log_for_processed_packages(
487
- all_processed_packages || Array.new, $!)
514
+ all_processed_packages || Array.new, $!
515
+ )
488
516
  end
489
517
  end
490
518
 
@@ -509,13 +537,15 @@ module Autoproj
509
537
  }
510
538
  end
511
539
 
512
- report = JSON.pretty_generate({
513
- import_report: {
514
- timestamp: Time.now,
515
- packages: packages
540
+ report = JSON.pretty_generate(
541
+ {
542
+ import_report: {
543
+ timestamp: Time.now,
544
+ packages: packages
545
+ }
516
546
  }
517
- })
518
- IO.write(@report_path, report)
547
+ )
548
+ File.write(@report_path, report)
519
549
  end
520
550
 
521
551
  def update_log_for_processed_packages(all_processed_packages, exception)
@@ -525,13 +555,12 @@ module Autoproj
525
555
 
526
556
  unless all_updated_packages.empty?
527
557
  failure_message =
528
- if exception
529
- " (#{exception.message.split("\n").first})"
530
- end
558
+ (" (#{exception.message.split("\n").first})" if exception)
531
559
  ops = Ops::Snapshot.new(ws.manifest, keep_going: true)
532
560
  ops.update_package_import_state(
533
561
  "#{$0} #{ARGV.join(' ')}#{failure_message}",
534
- all_updated_packages.map(&:name))
562
+ all_updated_packages.map(&:name)
563
+ )
535
564
  end
536
565
  end
537
566
  end