autoproj 2.14.0 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) 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 +5 -7
  11. data/bin/amake +4 -4
  12. data/bin/aup +4 -4
  13. data/bin/autoproj +3 -3
  14. data/bin/autoproj_bootstrap +185 -182
  15. data/bin/autoproj_bootstrap.in +7 -8
  16. data/bin/autoproj_install +184 -181
  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 +38 -34
  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 +26 -26
  29. data/lib/autoproj/cli/bootstrap.rb +14 -16
  30. data/lib/autoproj/cli/build.rb +10 -7
  31. data/lib/autoproj/cli/cache.rb +11 -11
  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 +13 -7
  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 +213 -204
  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 +38 -39
  52. data/lib/autoproj/cli/status.rb +45 -39
  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 +35 -37
  57. data/lib/autoproj/cli/utility.rb +11 -10
  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 +77 -84
  64. data/lib/autoproj/environment.rb +28 -13
  65. data/lib/autoproj/exceptions.rb +9 -3
  66. data/lib/autoproj/find_workspace.rb +20 -25
  67. data/lib/autoproj/git_server_configuration.rb +40 -44
  68. data/lib/autoproj/gitorious.rb +1 -1
  69. data/lib/autoproj/installation_manifest.rb +64 -29
  70. data/lib/autoproj/local_package_set.rb +13 -11
  71. data/lib/autoproj/manifest.rb +132 -130
  72. data/lib/autoproj/metapackage.rb +2 -6
  73. data/lib/autoproj/ops/atomic_write.rb +7 -6
  74. data/lib/autoproj/ops/build.rb +4 -6
  75. data/lib/autoproj/ops/cache.rb +41 -43
  76. data/lib/autoproj/ops/cached_env.rb +5 -4
  77. data/lib/autoproj/ops/configuration.rb +511 -506
  78. data/lib/autoproj/ops/import.rb +73 -63
  79. data/lib/autoproj/ops/install.rb +178 -174
  80. data/lib/autoproj/ops/loader.rb +77 -76
  81. data/lib/autoproj/ops/main_config_switcher.rb +36 -45
  82. data/lib/autoproj/ops/phase_reporting.rb +4 -4
  83. data/lib/autoproj/ops/snapshot.rb +250 -247
  84. data/lib/autoproj/ops/tools.rb +76 -78
  85. data/lib/autoproj/ops/watch.rb +6 -6
  86. data/lib/autoproj/ops/which.rb +17 -14
  87. data/lib/autoproj/options.rb +13 -2
  88. data/lib/autoproj/os_package_installer.rb +102 -92
  89. data/lib/autoproj/os_package_query.rb +7 -13
  90. data/lib/autoproj/os_package_resolver.rb +189 -140
  91. data/lib/autoproj/os_repository_installer.rb +4 -4
  92. data/lib/autoproj/os_repository_resolver.rb +8 -6
  93. data/lib/autoproj/package_definition.rb +12 -13
  94. data/lib/autoproj/package_managers/apt_dpkg_manager.rb +10 -10
  95. data/lib/autoproj/package_managers/bundler_manager.rb +147 -111
  96. data/lib/autoproj/package_managers/debian_version.rb +25 -21
  97. data/lib/autoproj/package_managers/emerge_manager.rb +2 -3
  98. data/lib/autoproj/package_managers/gem_manager.rb +68 -77
  99. data/lib/autoproj/package_managers/homebrew_manager.rb +3 -4
  100. data/lib/autoproj/package_managers/manager.rb +8 -3
  101. data/lib/autoproj/package_managers/pacman_manager.rb +2 -3
  102. data/lib/autoproj/package_managers/pip_manager.rb +20 -22
  103. data/lib/autoproj/package_managers/pkg_manager.rb +3 -4
  104. data/lib/autoproj/package_managers/port_manager.rb +2 -3
  105. data/lib/autoproj/package_managers/shell_script_manager.rb +32 -22
  106. data/lib/autoproj/package_managers/unknown_os_manager.rb +5 -8
  107. data/lib/autoproj/package_managers/yum_manager.rb +12 -15
  108. data/lib/autoproj/package_managers/zypper_manager.rb +11 -14
  109. data/lib/autoproj/package_manifest.rb +27 -26
  110. data/lib/autoproj/package_selection.rb +187 -187
  111. data/lib/autoproj/package_set.rb +127 -113
  112. data/lib/autoproj/python.rb +55 -55
  113. data/lib/autoproj/query_base.rb +20 -14
  114. data/lib/autoproj/reporter.rb +19 -19
  115. data/lib/autoproj/repository_managers/apt.rb +101 -67
  116. data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
  117. data/lib/autoproj/shell_completion.rb +16 -13
  118. data/lib/autoproj/source_package_query.rb +29 -36
  119. data/lib/autoproj/system.rb +32 -21
  120. data/lib/autoproj/test.rb +127 -104
  121. data/lib/autoproj/variable_expansion.rb +7 -9
  122. data/lib/autoproj/vcs_definition.rb +35 -32
  123. data/lib/autoproj/version.rb +1 -1
  124. data/lib/autoproj/workspace.rb +123 -107
  125. data/lib/autoproj/zsh_completion.rb +8 -9
  126. data/lib/autoproj.rb +53 -55
  127. data/samples/autoproj/init.rb +1 -2
  128. metadata +53 -51
  129. data/.travis.yml +0 -24
@@ -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,35 +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
- filter: ->(package) { true },
203
- **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)
204
206
 
205
207
  unless %i[checkout ignore return].include?(non_imported_packages)
206
208
  raise ArgumentError, "invalid value for 'non_imported_packages'. "\
@@ -234,7 +236,7 @@ module Autoproj
234
236
 
235
237
  failures = Array.new
236
238
  missing_vcs = Array.new
237
- installed_vcs_packages = Set['none', 'local']
239
+ installed_vcs_packages = Set["none", "local"]
238
240
  while failures.empty? || keep_going
239
241
  # Allow 'filter' to parallelize as well
240
242
  if filter.respond_to?(:lookahead)
@@ -288,7 +290,8 @@ module Autoproj
288
290
  queue_import_work(
289
291
  executor, completion_queue, pkg,
290
292
  retry_count: retry_count,
291
- **import_options.merge(allow_interactive: false))
293
+ **import_options.merge(allow_interactive: false)
294
+ )
292
295
  rescue Exception
293
296
  pending_packages.delete(pkg)
294
297
  raise
@@ -301,8 +304,8 @@ module Autoproj
301
304
  installed_vcs_packages.merge(
302
305
  install_vcs_packages_for(
303
306
  *missing_vcs,
304
- install_only: import_options[:checkout_only],
305
- **install_vcs_packages
307
+ install_only: import_options[:checkout_only],
308
+ **install_vcs_packages
306
309
  )
307
310
  )
308
311
  package_queue.concat(missing_vcs)
@@ -317,17 +320,17 @@ module Autoproj
317
320
  break
318
321
  else
319
322
  main_thread_imports.delete_if do |pkg|
320
- # rubocop:disable Lint/HandleExceptions
321
323
  begin
322
324
  if retry_count
323
325
  pkg.autobuild.importer.retry_count = retry_count
324
326
  end
325
327
  result = pkg.autobuild.import(
326
- **import_options.merge(allow_interactive: true))
328
+ **import_options.merge(allow_interactive: true)
329
+ )
327
330
  rescue StandardError => e
328
331
  end
329
- completion_queue << [pkg, Time.now, result, e]
330
- # rubocop:enable Lint/HandleExceptions
332
+ completion_queue << [pkg,
333
+ Time.now, result, e]
331
334
  end
332
335
  end
333
336
  end
@@ -341,7 +344,8 @@ module Autoproj
341
344
  elsif auto_exclude
342
345
  manifest.add_exclusion(
343
346
  pkg.name, "#{pkg.name} failed to import with "\
344
- "#{reason} and auto_exclude was true")
347
+ "#{reason} and auto_exclude was true"
348
+ )
345
349
  selection.filter_excluded_and_ignored_packages(manifest)
346
350
  else
347
351
  # One importer failed... terminate
@@ -352,7 +356,8 @@ module Autoproj
352
356
  else
353
357
  new_packages = post_package_import(
354
358
  selection, manifest, pkg, reverse_dependencies,
355
- auto_exclude: auto_exclude)
359
+ auto_exclude: auto_exclude
360
+ )
356
361
  if new_packages
357
362
  # Excluded dependencies might have caused the package to be
358
363
  # excluded as well ... do not add any dependency to the
@@ -382,8 +387,8 @@ module Autoproj
382
387
  end
383
388
 
384
389
  def finalize_package_load(processed_packages,
385
- ignore_optional_dependencies: false,
386
- auto_exclude: auto_exclude?)
390
+ ignore_optional_dependencies: false,
391
+ auto_exclude: auto_exclude?)
387
392
  manifest = ws.manifest
388
393
 
389
394
  all = Set.new
@@ -411,7 +416,8 @@ module Autoproj
411
416
  manifest.exclude_package(
412
417
  pkg.name, "#{pkg.name} had an error when "\
413
418
  "being loaded (#{e.message}) and "\
414
- "auto_exclude is true")
419
+ "auto_exclude is true"
420
+ )
415
421
  next
416
422
  end
417
423
  end
@@ -436,15 +442,15 @@ module Autoproj
436
442
  end
437
443
 
438
444
  def import_packages(selection,
439
- non_imported_packages: :checkout,
440
- warn_about_ignored_packages: true,
441
- warn_about_excluded_packages: true,
442
- recursive: true,
443
- keep_going: false,
444
- install_vcs_packages: Hash.new,
445
- auto_exclude: auto_exclude?,
446
- filter: ->(pkg) { true },
447
- **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)
448
454
 
449
455
  manifest = ws.manifest
450
456
 
@@ -456,7 +462,8 @@ module Autoproj
456
462
  install_vcs_packages: install_vcs_packages,
457
463
  auto_exclude: auto_exclude,
458
464
  filter: filter,
459
- **import_options)
465
+ **import_options
466
+ )
460
467
 
461
468
  raise failures.first if !keep_going && !failures.empty?
462
469
 
@@ -489,12 +496,13 @@ module Autoproj
489
496
  end
490
497
  end
491
498
 
492
- if !failures.empty?
499
+ if failures.empty?
500
+ [all_enabled_sources, all_enabled_osdeps]
501
+ else
493
502
  raise PackageImportFailed.new(
494
503
  failures, source_packages: all_enabled_sources,
495
- osdep_packages: all_enabled_osdeps)
496
- else
497
- return all_enabled_sources, all_enabled_osdeps
504
+ osdep_packages: all_enabled_osdeps
505
+ )
498
506
  end
499
507
  ensure
500
508
  create_report(all_processed_packages || []) if @report_path
@@ -503,7 +511,8 @@ module Autoproj
503
511
  Autoproj::Ops::Snapshot.update_log_available?(manifest)
504
512
  if update_log
505
513
  update_log_for_processed_packages(
506
- all_processed_packages || Array.new, $!)
514
+ all_processed_packages || Array.new, $!
515
+ )
507
516
  end
508
517
  end
509
518
 
@@ -528,13 +537,15 @@ module Autoproj
528
537
  }
529
538
  end
530
539
 
531
- report = JSON.pretty_generate({
532
- import_report: {
533
- timestamp: Time.now,
534
- packages: packages
540
+ report = JSON.pretty_generate(
541
+ {
542
+ import_report: {
543
+ timestamp: Time.now,
544
+ packages: packages
545
+ }
535
546
  }
536
- })
537
- IO.write(@report_path, report)
547
+ )
548
+ File.write(@report_path, report)
538
549
  end
539
550
 
540
551
  def update_log_for_processed_packages(all_processed_packages, exception)
@@ -544,13 +555,12 @@ module Autoproj
544
555
 
545
556
  unless all_updated_packages.empty?
546
557
  failure_message =
547
- if exception
548
- " (#{exception.message.split("\n").first})"
549
- end
558
+ (" (#{exception.message.split("\n").first})" if exception)
550
559
  ops = Ops::Snapshot.new(ws.manifest, keep_going: true)
551
560
  ops.update_package_import_state(
552
561
  "#{$0} #{ARGV.join(' ')}#{failure_message}",
553
- all_updated_packages.map(&:name))
562
+ all_updated_packages.map(&:name)
563
+ )
554
564
  end
555
565
  end
556
566
  end