autoproj 2.12.1 → 2.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) 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 +24 -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 +3 -3
  14. data/bin/autoproj_bootstrap +225 -200
  15. data/bin/autoproj_bootstrap.in +7 -8
  16. data/bin/autoproj_install +224 -199
  17. data/bin/autoproj_install.in +6 -7
  18. data/lib/autoproj/aruba_minitest.rb +6 -11
  19. data/lib/autoproj/autobuild.rb +9 -6
  20. data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
  21. data/lib/autoproj/autobuild_extensions/dsl.rb +66 -36
  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/python.rb +18 -0
  25. data/lib/autoproj/autobuild_extensions/svn.rb +1 -2
  26. data/lib/autoproj/base.rb +1 -1
  27. data/lib/autoproj/bash_completion.rb +5 -6
  28. data/lib/autoproj/build_option.rb +22 -24
  29. data/lib/autoproj/cli/base.rb +26 -26
  30. data/lib/autoproj/cli/bootstrap.rb +14 -16
  31. data/lib/autoproj/cli/build.rb +10 -7
  32. data/lib/autoproj/cli/cache.rb +11 -11
  33. data/lib/autoproj/cli/clean.rb +10 -10
  34. data/lib/autoproj/cli/commit.rb +7 -8
  35. data/lib/autoproj/cli/doc.rb +2 -2
  36. data/lib/autoproj/cli/envsh.rb +1 -2
  37. data/lib/autoproj/cli/exec.rb +60 -20
  38. data/lib/autoproj/cli/inspection_tool.rb +13 -7
  39. data/lib/autoproj/cli/locate.rb +30 -41
  40. data/lib/autoproj/cli/log.rb +7 -7
  41. data/lib/autoproj/cli/main.rb +217 -205
  42. data/lib/autoproj/cli/main_doc.rb +22 -21
  43. data/lib/autoproj/cli/main_global.rb +44 -19
  44. data/lib/autoproj/cli/main_plugin.rb +18 -18
  45. data/lib/autoproj/cli/main_test.rb +28 -27
  46. data/lib/autoproj/cli/manifest.rb +7 -7
  47. data/lib/autoproj/cli/osdeps.rb +12 -11
  48. data/lib/autoproj/cli/patcher.rb +2 -3
  49. data/lib/autoproj/cli/query.rb +17 -18
  50. data/lib/autoproj/cli/reconfigure.rb +1 -2
  51. data/lib/autoproj/cli/reset.rb +9 -12
  52. data/lib/autoproj/cli/show.rb +38 -39
  53. data/lib/autoproj/cli/status.rb +56 -44
  54. data/lib/autoproj/cli/switch_config.rb +5 -6
  55. data/lib/autoproj/cli/tag.rb +12 -11
  56. data/lib/autoproj/cli/test.rb +7 -7
  57. data/lib/autoproj/cli/update.rb +97 -43
  58. data/lib/autoproj/cli/utility.rb +14 -12
  59. data/lib/autoproj/cli/version.rb +42 -40
  60. data/lib/autoproj/cli/versions.rb +14 -15
  61. data/lib/autoproj/cli/watch.rb +33 -37
  62. data/lib/autoproj/cli/which.rb +16 -20
  63. data/lib/autoproj/cli.rb +4 -2
  64. data/lib/autoproj/configuration.rb +78 -86
  65. data/lib/autoproj/default.osdeps +29 -3
  66. data/lib/autoproj/environment.rb +42 -23
  67. data/lib/autoproj/exceptions.rb +9 -3
  68. data/lib/autoproj/find_workspace.rb +20 -25
  69. data/lib/autoproj/git_server_configuration.rb +40 -44
  70. data/lib/autoproj/gitorious.rb +1 -1
  71. data/lib/autoproj/installation_manifest.rb +64 -29
  72. data/lib/autoproj/local_package_set.rb +13 -11
  73. data/lib/autoproj/manifest.rb +139 -132
  74. data/lib/autoproj/metapackage.rb +2 -6
  75. data/lib/autoproj/ops/atomic_write.rb +7 -6
  76. data/lib/autoproj/ops/build.rb +4 -6
  77. data/lib/autoproj/ops/cache.rb +41 -43
  78. data/lib/autoproj/ops/cached_env.rb +5 -4
  79. data/lib/autoproj/ops/configuration.rb +519 -507
  80. data/lib/autoproj/ops/import.rb +88 -63
  81. data/lib/autoproj/ops/install.rb +218 -192
  82. data/lib/autoproj/ops/loader.rb +77 -76
  83. data/lib/autoproj/ops/main_config_switcher.rb +36 -45
  84. data/lib/autoproj/ops/phase_reporting.rb +4 -4
  85. data/lib/autoproj/ops/snapshot.rb +250 -247
  86. data/lib/autoproj/ops/tools.rb +76 -78
  87. data/lib/autoproj/ops/watch.rb +6 -6
  88. data/lib/autoproj/ops/which.rb +17 -14
  89. data/lib/autoproj/options.rb +13 -2
  90. data/lib/autoproj/os_package_installer.rb +102 -92
  91. data/lib/autoproj/os_package_query.rb +7 -13
  92. data/lib/autoproj/os_package_resolver.rb +189 -140
  93. data/lib/autoproj/os_repository_installer.rb +4 -4
  94. data/lib/autoproj/os_repository_resolver.rb +8 -6
  95. data/lib/autoproj/package_definition.rb +12 -13
  96. data/lib/autoproj/package_managers/apt_dpkg_manager.rb +19 -11
  97. data/lib/autoproj/package_managers/bundler_manager.rb +186 -129
  98. data/lib/autoproj/package_managers/debian_version.rb +25 -21
  99. data/lib/autoproj/package_managers/emerge_manager.rb +2 -3
  100. data/lib/autoproj/package_managers/gem_manager.rb +68 -77
  101. data/lib/autoproj/package_managers/homebrew_manager.rb +3 -4
  102. data/lib/autoproj/package_managers/manager.rb +8 -3
  103. data/lib/autoproj/package_managers/pacman_manager.rb +2 -3
  104. data/lib/autoproj/package_managers/pip_manager.rb +30 -28
  105. data/lib/autoproj/package_managers/pkg_manager.rb +3 -4
  106. data/lib/autoproj/package_managers/port_manager.rb +2 -3
  107. data/lib/autoproj/package_managers/shell_script_manager.rb +47 -25
  108. data/lib/autoproj/package_managers/unknown_os_manager.rb +5 -8
  109. data/lib/autoproj/package_managers/yum_manager.rb +12 -15
  110. data/lib/autoproj/package_managers/zypper_manager.rb +11 -14
  111. data/lib/autoproj/package_manifest.rb +28 -74
  112. data/lib/autoproj/package_selection.rb +187 -187
  113. data/lib/autoproj/package_set.rb +145 -114
  114. data/lib/autoproj/python.rb +297 -0
  115. data/lib/autoproj/query_base.rb +20 -14
  116. data/lib/autoproj/reporter.rb +19 -19
  117. data/lib/autoproj/repository_managers/apt.rb +102 -68
  118. data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
  119. data/lib/autoproj/ros_condition_parser.rb +84 -0
  120. data/lib/autoproj/ros_package_manifest.rb +125 -0
  121. data/lib/autoproj/shell_completion.rb +16 -13
  122. data/lib/autoproj/source_package_query.rb +29 -36
  123. data/lib/autoproj/system.rb +32 -21
  124. data/lib/autoproj/test.rb +131 -106
  125. data/lib/autoproj/variable_expansion.rb +10 -10
  126. data/lib/autoproj/vcs_definition.rb +53 -37
  127. data/lib/autoproj/version.rb +1 -1
  128. data/lib/autoproj/workspace.rb +143 -108
  129. data/lib/autoproj/zsh_completion.rb +8 -9
  130. data/lib/autoproj.rb +55 -53
  131. data/samples/autoproj/init.rb +1 -2
  132. metadata +86 -65
  133. 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
@@ -290,8 +304,8 @@ module Autoproj
290
304
  installed_vcs_packages.merge(
291
305
  install_vcs_packages_for(
292
306
  *missing_vcs,
293
- install_only: import_options[:checkout_only],
294
- **install_vcs_packages
307
+ install_only: import_options[:checkout_only],
308
+ **install_vcs_packages
295
309
  )
296
310
  )
297
311
  package_queue.concat(missing_vcs)
@@ -306,17 +320,17 @@ module Autoproj
306
320
  break
307
321
  else
308
322
  main_thread_imports.delete_if do |pkg|
309
- # rubocop:disable Lint/HandleExceptions
310
323
  begin
311
324
  if retry_count
312
325
  pkg.autobuild.importer.retry_count = retry_count
313
326
  end
314
327
  result = pkg.autobuild.import(
315
- **import_options.merge(allow_interactive: true))
328
+ **import_options.merge(allow_interactive: true)
329
+ )
316
330
  rescue StandardError => e
317
331
  end
318
- completion_queue << [pkg, Time.now, result, e]
319
- # rubocop:enable Lint/HandleExceptions
332
+ completion_queue << [pkg,
333
+ Time.now, result, e]
320
334
  end
321
335
  end
322
336
  end
@@ -330,7 +344,8 @@ module Autoproj
330
344
  elsif auto_exclude
331
345
  manifest.add_exclusion(
332
346
  pkg.name, "#{pkg.name} failed to import with "\
333
- "#{reason} and auto_exclude was true")
347
+ "#{reason} and auto_exclude was true"
348
+ )
334
349
  selection.filter_excluded_and_ignored_packages(manifest)
335
350
  else
336
351
  # One importer failed... terminate
@@ -341,7 +356,8 @@ module Autoproj
341
356
  else
342
357
  new_packages = post_package_import(
343
358
  selection, manifest, pkg, reverse_dependencies,
344
- auto_exclude: auto_exclude)
359
+ auto_exclude: auto_exclude
360
+ )
345
361
  if new_packages
346
362
  # Excluded dependencies might have caused the package to be
347
363
  # excluded as well ... do not add any dependency to the
@@ -371,8 +387,8 @@ module Autoproj
371
387
  end
372
388
 
373
389
  def finalize_package_load(processed_packages,
374
- ignore_optional_dependencies: false,
375
- auto_exclude: auto_exclude?)
390
+ ignore_optional_dependencies: false,
391
+ auto_exclude: auto_exclude?)
376
392
  manifest = ws.manifest
377
393
 
378
394
  all = Set.new
@@ -400,7 +416,8 @@ module Autoproj
400
416
  manifest.exclude_package(
401
417
  pkg.name, "#{pkg.name} had an error when "\
402
418
  "being loaded (#{e.message}) and "\
403
- "auto_exclude is true")
419
+ "auto_exclude is true"
420
+ )
404
421
  next
405
422
  end
406
423
  end
@@ -425,14 +442,15 @@ module Autoproj
425
442
  end
426
443
 
427
444
  def import_packages(selection,
428
- non_imported_packages: :checkout,
429
- warn_about_ignored_packages: true,
430
- warn_about_excluded_packages: true,
431
- recursive: true,
432
- keep_going: false,
433
- install_vcs_packages: Hash.new,
434
- auto_exclude: auto_exclude?,
435
- **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)
436
454
 
437
455
  manifest = ws.manifest
438
456
 
@@ -443,11 +461,15 @@ module Autoproj
443
461
  recursive: recursive,
444
462
  install_vcs_packages: install_vcs_packages,
445
463
  auto_exclude: auto_exclude,
446
- **import_options)
464
+ filter: filter,
465
+ **import_options
466
+ )
447
467
 
448
468
  raise failures.first if !keep_going && !failures.empty?
449
469
 
450
- install_internal_dependencies_for(*all_processed_packages)
470
+ install_internal_dependencies_for(
471
+ *all_processed_packages, install_only: import_options[:checkout_only]
472
+ )
451
473
  finalize_package_load(all_processed_packages, auto_exclude: auto_exclude)
452
474
 
453
475
  all_enabled_osdeps = selection.each_osdep_package_name.to_set
@@ -476,12 +498,13 @@ module Autoproj
476
498
  end
477
499
  end
478
500
 
479
- if !failures.empty?
501
+ if failures.empty?
502
+ [all_enabled_sources, all_enabled_osdeps]
503
+ else
480
504
  raise PackageImportFailed.new(
481
505
  failures, source_packages: all_enabled_sources,
482
- osdep_packages: all_enabled_osdeps)
483
- else
484
- return all_enabled_sources, all_enabled_osdeps
506
+ osdep_packages: all_enabled_osdeps
507
+ )
485
508
  end
486
509
  ensure
487
510
  create_report(all_processed_packages || []) if @report_path
@@ -490,7 +513,8 @@ module Autoproj
490
513
  Autoproj::Ops::Snapshot.update_log_available?(manifest)
491
514
  if update_log
492
515
  update_log_for_processed_packages(
493
- all_processed_packages || Array.new, $!)
516
+ all_processed_packages || Array.new, $!
517
+ )
494
518
  end
495
519
  end
496
520
 
@@ -515,13 +539,15 @@ module Autoproj
515
539
  }
516
540
  end
517
541
 
518
- report = JSON.pretty_generate({
519
- import_report: {
520
- timestamp: Time.now,
521
- packages: packages
542
+ report = JSON.pretty_generate(
543
+ {
544
+ import_report: {
545
+ timestamp: Time.now,
546
+ packages: packages
547
+ }
522
548
  }
523
- })
524
- IO.write(@report_path, report)
549
+ )
550
+ File.write(@report_path, report)
525
551
  end
526
552
 
527
553
  def update_log_for_processed_packages(all_processed_packages, exception)
@@ -531,13 +557,12 @@ module Autoproj
531
557
 
532
558
  unless all_updated_packages.empty?
533
559
  failure_message =
534
- if exception
535
- " (#{exception.message.split("\n").first})"
536
- end
560
+ (" (#{exception.message.split("\n").first})" if exception)
537
561
  ops = Ops::Snapshot.new(ws.manifest, keep_going: true)
538
562
  ops.update_package_import_state(
539
563
  "#{$0} #{ARGV.join(' ')}#{failure_message}",
540
- all_updated_packages.map(&:name))
564
+ all_updated_packages.map(&:name)
565
+ )
541
566
  end
542
567
  end
543
568
  end