autoproj 2.13.0 → 2.15.2

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 +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 +224 -199
  15. data/bin/autoproj_bootstrap.in +7 -8
  16. data/bin/autoproj_install +223 -198
  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 +64 -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/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 +213 -204
  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 +45 -39
  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 +35 -37
  58. data/lib/autoproj/cli/utility.rb +11 -10
  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 +77 -85
  65. data/lib/autoproj/default.osdeps +18 -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 +137 -130
  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 +525 -507
  80. data/lib/autoproj/ops/import.rb +76 -64
  81. data/lib/autoproj/ops/install.rb +217 -191
  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 +144 -113
  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 +127 -104
  125. data/lib/autoproj/variable_expansion.rb +7 -9
  126. data/lib/autoproj/vcs_definition.rb +35 -32
  127. data/lib/autoproj/version.rb +1 -1
  128. data/lib/autoproj/workspace.rb +142 -108
  129. data/lib/autoproj/zsh_completion.rb +8 -9
  130. data/lib/autoproj.rb +55 -55
  131. data/samples/autoproj/init.rb +1 -2
  132. metadata +80 -46
  133. data/.travis.yml +0 -24
@@ -1,11 +1,11 @@
1
- require 'thor'
2
- require 'tty/color'
3
- require 'autoproj/cli/main_doc'
4
- require 'autoproj/cli/main_test'
5
- require 'autoproj/cli/main_plugin'
6
- require 'autoproj/cli/main_global'
7
- require 'autoproj/cli'
8
- require 'autoproj/reporter'
1
+ require "thor"
2
+ require "tty/color"
3
+ require "autoproj/cli/main_doc"
4
+ require "autoproj/cli/main_test"
5
+ require "autoproj/cli/main_plugin"
6
+ require "autoproj/cli/main_global"
7
+ require "autoproj/cli"
8
+ require "autoproj/reporter"
9
9
 
10
10
  module Autoproj
11
11
  module CLI
@@ -14,26 +14,24 @@ module Autoproj
14
14
  Encoding.default_external = Encoding::UTF_8
15
15
 
16
16
  argv = ARGV.find_all { |arg| arg != "--no-plugins" }
17
- if argv.size == ARGV.size
18
- Autoproj::CLI.load_plugins
19
- end
17
+ Autoproj::CLI.load_plugins if argv.size == ARGV.size
20
18
  argv
21
19
  end
22
20
 
23
21
  class Main < Thor
24
22
  class_option :verbose, type: :boolean, default: false,
25
- desc: 'turns verbose output'
23
+ desc: "turns verbose output"
26
24
  class_option :debug, type: :boolean, default: false,
27
- desc: 'turns debugging output'
25
+ desc: "turns debugging output"
28
26
  class_option :silent, type: :boolean, default: false,
29
- desc: 'tell autoproj to not display anything'
27
+ desc: "tell autoproj to not display anything"
30
28
  class_option :color, type: :boolean, default: TTY::Color.color?,
31
- desc: 'enables or disables colored display (enabled by default if the terminal supports it)'
29
+ desc: "enables or disables colored display (enabled by default if the terminal supports it)"
32
30
  class_option :progress, type: :boolean, default: TTY::Color.color?,
33
- desc: 'enables or disables progress display (enabled by default if the terminal supports it)'
34
- class_option 'interactive', type: :boolean,
35
- default: (ENV['AUTOPROJ_NONINTERACTIVE'] != '1'),
36
- desc: 'tell autoproj to run (non)interactively'
31
+ desc: "enables or disables progress display (enabled by default if the terminal supports it)"
32
+ class_option "interactive", type: :boolean,
33
+ default: (ENV["AUTOPROJ_NONINTERACTIVE"] != "1"),
34
+ desc: "tell autoproj to run (non)interactively"
37
35
 
38
36
  stop_on_unknown_option! :exec
39
37
  check_unknown_options! except: :exec
@@ -109,7 +107,8 @@ module Autoproj
109
107
  flags = []
110
108
  %i[color progress debug interactive].each do |option|
111
109
  if options[option] then flags << "--#{option}"
112
- else flags << "--no-#{option}"
110
+ else
111
+ flags << "--no-#{option}"
113
112
  end
114
113
  end
115
114
  flags
@@ -117,7 +116,8 @@ module Autoproj
117
116
 
118
117
  def run_autoproj_cli(filename, classname, report_options, *args, tool_failure_mode: :exit_silent, **extra_options)
119
118
  require "autoproj/cli/#{filename}"
120
- if Autobuild::Subprocess.transparent_mode = options[:tool]
119
+ if options[:tool]
120
+ Autobuild::Subprocess.transparent_mode = true
121
121
  Autobuild.silent = true
122
122
  Autobuild.color = false
123
123
  report_options[:silent] = true
@@ -129,8 +129,8 @@ module Autoproj
129
129
  options = self.options.dup
130
130
  # We use --local on the CLI but the APIs are expecting
131
131
  # only_local
132
- if options.has_key?('local')
133
- options[:only_local] = options.delete('local')
132
+ if options.has_key?("local")
133
+ options[:only_local] = options.delete("local")
134
134
  end
135
135
  cli = CLI.const_get(classname).new
136
136
  begin
@@ -138,163 +138,161 @@ module Autoproj
138
138
  kw = (kw || {}).transform_keys(&:to_sym)
139
139
  cli.run(*run_args, **kw)
140
140
  ensure
141
- cli.notify_env_sh_updated if cli.respond_to?(:notify_env_sh_updated)
141
+ if cli.respond_to?(:notify_env_sh_updated)
142
+ cli.notify_env_sh_updated
143
+ end
142
144
  end
143
145
  end
144
146
  end
145
147
  end
146
148
 
147
- desc 'bootstrap VCS_TYPE VCS_URL VCS_OPTIONS', 'bootstraps a new autoproj installation. This is usually not called directly, but called from the autoproj_bootstrap standalone script'
148
- option :reuse, banner: 'DIR',
149
- desc: 'reuse packages already built within the DIR autoproj workspace in this installation, if DIR is not given, reuses the installation whose env.sh is currently sourced'
150
- option :seed_config, banner: 'SEED_CONFIG',
151
- desc: "a configuration file used to seed the bootstrap's configuration"
149
+ desc "bootstrap VCS_TYPE VCS_URL VCS_OPTIONS", "bootstraps a new autoproj installation. This is usually not called directly, but called from the autoproj_bootstrap standalone script"
150
+ option :reuse, banner: "DIR",
151
+ desc: "reuse packages already built within the DIR autoproj workspace in this installation, if DIR is not given, reuses the installation whose env.sh is currently sourced"
152
+ option :seed_config, banner: "SEED_CONFIG",
153
+ desc: "a configuration file used to seed the bootstrap's configuration"
152
154
  def bootstrap(*args)
153
- if !File.directory?(File.join(Dir.pwd, '.autoproj'))
154
- require 'autoproj/ops/install'
155
+ unless File.directory?(File.join(Dir.pwd, ".autoproj"))
156
+ require "autoproj/ops/install"
155
157
  ops = Autoproj::Ops::Install.new(Dir.pwd)
156
158
  bootstrap_options = ops.parse_options(thor_options_to_optparse + args)
157
159
  ops.run
158
- exec Gem.ruby, $0, 'bootstrap', *bootstrap_options
160
+ exec Gem.ruby, $0, "bootstrap", *bootstrap_options
159
161
  end
160
162
  run_autoproj_cli(:bootstrap, :Bootstrap, Hash[], *args)
161
163
  end
162
164
 
163
- desc 'envsh', 'update the environment files'
165
+ desc "envsh", "update the environment files"
164
166
  def envsh
165
167
  run_autoproj_cli(:envsh, :Envsh, Hash[])
166
168
  end
167
169
 
168
- desc 'watch', 'watch workspace for changes', hide: true
170
+ desc "watch", "watch workspace for changes", hide: true
169
171
  option :show_events, type: :boolean, default: false,
170
- desc: "whether detected events should be displayed"
172
+ desc: "whether detected events should be displayed"
171
173
  def watch
172
174
  run_autoproj_cli(:watch, :Watch, Hash[])
173
175
  end
174
176
 
175
- desc 'status [PACKAGES]', 'displays synchronization status between this workspace and the package(s) source'
177
+ desc "status [PACKAGES]", "displays synchronization status between this workspace and the package(s) source"
176
178
  option :local, type: :boolean, default: false,
177
- desc: 'only use locally available information (mainly for distributed version control systems such as git)'
179
+ desc: "only use locally available information (mainly for distributed version control systems such as git)"
178
180
  option :mainline, type: :string,
179
- desc: "compare to the given baseline. if 'true', the comparison will ignore any override, otherwise it will take into account overrides only up to the given package set"
181
+ desc: "compare to the given baseline. if 'true', the comparison will ignore any override, otherwise it will take into account overrides only up to the given package set"
180
182
  option :snapshot, type: :boolean, default: false,
181
- desc: "use the VCS information as 'versions --no-local' would detect it instead of the one in the configuration"
183
+ desc: "use the VCS information as 'versions --no-local' would detect it instead of the one in the configuration"
182
184
  option :parallel, aliases: :p, type: :numeric,
183
- desc: 'maximum number of parallel jobs'
185
+ desc: "maximum number of parallel jobs"
184
186
  option :deps, type: :boolean, default: true,
185
- desc: 'whether only the status of the given packages should be displayed, or of their dependencies as well. -n is a shortcut for --no-deps'
186
- option :no_deps_shortcut, hide: true, aliases: '-n', type: :boolean,
187
- desc: 'provide -n for --no-deps'
187
+ desc: "whether only the status of the given packages should be displayed, or of their dependencies as well. -n is a shortcut for --no-deps"
188
+ option :no_deps_shortcut, hide: true, aliases: "-n", type: :boolean,
189
+ desc: "provide -n for --no-deps"
188
190
  def status(*packages)
189
191
  run_autoproj_cli(:status, :Status, Hash[], *packages)
190
192
  end
191
193
 
192
- desc 'update [PACKAGES]', 'update packages'
194
+ desc "update [PACKAGES]", "update packages"
193
195
  option :aup, default: false, hide: true, type: :boolean,
194
- desc: 'behave like aup'
196
+ desc: "behave like aup"
195
197
  option :all, default: false, hide: true, type: :boolean,
196
- desc: 'when in aup mode, update all packages instead of only the local one'
197
- option :keep_going, aliases: :k, type: :boolean, banner: '',
198
- desc: 'do not stop on build or checkout errors'
198
+ desc: "when in aup mode, update all packages instead of only the local one"
199
+ option :keep_going, aliases: :k, type: :boolean, banner: "",
200
+ desc: "do not stop on build or checkout errors"
199
201
  option :config, type: :boolean,
200
- desc: "(do not) update configuration. The default is to update configuration if explicitely selected or if no additional arguments are given on the command line, and to not do it if packages are explicitely selected on the command line"
202
+ desc: "(do not) update configuration. The default is to update configuration if explicitely selected or if no additional arguments are given on the command line, and to not do it if packages are explicitely selected on the command line"
201
203
  option :bundler, type: :boolean,
202
- desc: "(do not) update bundler. This is automatically enabled only if no arguments are given on the command line"
204
+ desc: "(do not) update bundler. This is automatically enabled only if no arguments are given on the command line"
203
205
  option :autoproj, type: :boolean,
204
- desc: "(do not) update autoproj. This is automatically enabled only if no arguments are given on the command line"
206
+ desc: "(do not) update autoproj. This is automatically enabled only if no arguments are given on the command line"
205
207
  option :osdeps, type: :boolean, default: true,
206
- desc: "enable or disable osdeps handling"
208
+ desc: "enable or disable osdeps handling"
207
209
  option :from, type: :string,
208
- desc: 'use this existing autoproj installation to check out the packages (for importers that support this)'
210
+ desc: "use this existing autoproj installation to check out the packages (for importers that support this)"
209
211
  option :checkout_only, aliases: :c, type: :boolean, default: false,
210
- desc: "only checkout packages, do not update existing ones"
212
+ desc: "only checkout packages, do not update existing ones"
211
213
  option :local, type: :boolean, default: false,
212
- desc: "use only local information for the update (for importers that support it)"
214
+ desc: "use only local information for the update (for importers that support it)"
213
215
  option :osdeps_filter_uptodate, default: true, type: :boolean,
214
- desc: 'controls whether the osdeps subsystem should filter up-to-date packages or not'
216
+ desc: "controls whether the osdeps subsystem should filter up-to-date packages or not"
215
217
  option :deps, default: true, type: :boolean,
216
- desc: 'whether the package dependencies should be recursively updated (the default) or not. -n is a shortcut for --no-deps'
217
- option :no_deps_shortcut, hide: true, aliases: '-n', type: :boolean,
218
- desc: 'provide -n for --no-deps'
218
+ desc: "whether the package dependencies should be recursively updated (the default) or not. -n is a shortcut for --no-deps"
219
+ option :no_deps_shortcut, hide: true, aliases: "-n", type: :boolean,
220
+ desc: "provide -n for --no-deps"
219
221
  option :reset, default: false, type: :boolean,
220
- desc: "forcefully resets the repository to the state expected by autoproj's configuration",
221
- long_desc: "The default is to update the repository if possible, and leave it alone otherwise. With --reset, autoproj update might come back to an older commit than the repository's current state"
222
+ desc: "forcefully resets the repository to the state expected by autoproj's configuration",
223
+ long_desc: "The default is to update the repository if possible, and leave it alone otherwise. With --reset, autoproj update might come back to an older commit than the repository's current state"
222
224
  option :force_reset, default: false, type: :boolean,
223
- desc: "like --reset, but bypasses tests that ensure you won't lose data"
225
+ desc: "like --reset, but bypasses tests that ensure you won't lose data"
224
226
  option :retry_count, default: nil, type: :numeric,
225
- desc: "force the importer's retry count to this value"
227
+ desc: "force the importer's retry count to this value"
226
228
  option :parallel, aliases: :p, type: :numeric,
227
- desc: 'maximum number of parallel jobs'
229
+ desc: "maximum number of parallel jobs"
228
230
  option :mainline, type: :string,
229
- desc: "compare to the given baseline. if 'true', the comparison will ignore any override, otherwise it will take into account overrides only up to the given package set"
231
+ desc: "compare to the given baseline. if 'true', the comparison will ignore any override, otherwise it will take into account overrides only up to the given package set"
230
232
  option :auto_exclude, type: :boolean,
231
- desc: 'if true, packages that fail to import will be excluded from the build'
233
+ desc: "if true, packages that fail to import will be excluded from the build"
232
234
  option :ask, type: :boolean, default: false,
233
- desc: 'ask whether each package should or should not be updated'
235
+ desc: "ask whether each package should or should not be updated"
234
236
  def update(*packages)
235
237
  report_options = Hash[silent: false, on_package_failures: default_report_on_package_failures]
236
- if options[:auto_exclude]
237
- report_options[:on_package_failures] = :report
238
- end
238
+ report_options[:on_package_failures] = :report if options[:auto_exclude]
239
239
 
240
240
  run_autoproj_cli(:update, :Update, report_options, *packages, run_hook: true)
241
241
  end
242
242
 
243
- desc 'build [PACKAGES]', 'build packages'
243
+ desc "build [PACKAGES]", "build packages"
244
244
  option :amake, default: false, hide: true, type: :boolean,
245
- desc: 'behave like amake'
245
+ desc: "behave like amake"
246
246
  option :all, default: false, hide: true, type: :boolean,
247
- desc: 'when in amake mode, build all packages instead of only the local one'
247
+ desc: "when in amake mode, build all packages instead of only the local one"
248
248
  option :keep_going, aliases: :k, type: :boolean, default: false,
249
- desc: 'do not stop on build or checkout errors'
249
+ desc: "do not stop on build or checkout errors"
250
250
  option :force, type: :boolean, default: false,
251
- desc: 'force reconfiguration-build cycle on the requested packages, even if they do not seem to need it'
251
+ desc: "force reconfiguration-build cycle on the requested packages, even if they do not seem to need it"
252
252
  option :rebuild, type: :boolean, default: false,
253
- desc: 'clean and build the requested packages'
253
+ desc: "clean and build the requested packages"
254
254
  option :osdeps, type: :boolean,
255
- desc: 'controls whether missing osdeps should be installed. In rebuild mode, also controls whether the osdeps should be reinstalled or not (the default is to reinstall them)'
255
+ desc: "controls whether missing osdeps should be installed. In rebuild mode, also controls whether the osdeps should be reinstalled or not (the default is to reinstall them)"
256
256
  option :deps, type: :boolean,
257
- desc: "controls whether the operation should apply to the package's dependencies as well. -n is a shortcut for --no-deps",
258
- long_desc: <<-EOD
257
+ desc: "controls whether the operation should apply to the package's dependencies as well. -n is a shortcut for --no-deps",
258
+ long_desc: <<-EOD
259
259
  Without --force or --rebuild, the default is true (the build will apply to all packages).
260
260
  With --force or --rebuild, control whether the force/rebuild action should apply
261
261
  only on the packages given on the command line, or on their dependencies as well.
262
262
  In this case, the default is false
263
- EOD
264
- option :no_deps_shortcut, hide: true, aliases: '-n', type: :boolean,
265
- desc: 'provide -n for --no-deps'
263
+ EOD
264
+ option :no_deps_shortcut, hide: true, aliases: "-n", type: :boolean,
265
+ desc: "provide -n for --no-deps"
266
266
  option :parallel, aliases: :p, type: :numeric,
267
- desc: 'maximum number of parallel jobs'
267
+ desc: "maximum number of parallel jobs"
268
268
  option :auto_exclude, type: :boolean,
269
- desc: 'if true, packages that fail to import will be excluded from the build'
269
+ desc: "if true, packages that fail to import will be excluded from the build"
270
270
  option :tool, type: :boolean,
271
- desc: "act as a build tool, transparently passing the subcommand's outputs to STDOUT"
271
+ desc: "act as a build tool, transparently passing the subcommand's outputs to STDOUT"
272
272
  option :confirm, type: :boolean, default: nil,
273
- desc: '--force and --rebuild will ask confirmation if applied to the whole workspace. Use --no-confirm to disable this confirmation'
273
+ desc: "--force and --rebuild will ask confirmation if applied to the whole workspace. Use --no-confirm to disable this confirmation"
274
274
  option :not, type: :array, default: nil,
275
- desc: 'do not build the packages listed'
275
+ desc: "do not build the packages listed"
276
276
  def build(*packages)
277
277
  report_options = Hash[silent: false, on_package_failures: default_report_on_package_failures]
278
- if options[:auto_exclude]
279
- report_options[:on_package_failures] = :report
280
- end
278
+ report_options[:on_package_failures] = :report if options[:auto_exclude]
281
279
 
282
280
  failures = run_autoproj_cli(:build, :Build, report_options, *packages,
283
- tool_failure_mode: :report_silent)
284
- if !failures.empty?
281
+ tool_failure_mode: :report_silent)
282
+ unless failures.empty?
285
283
  Autobuild.silent = false
286
284
  package_failures, config_failures = failures.partition do |e|
287
285
  e.respond_to?(:target) && e.target.respond_to?(:name)
288
286
  end
289
287
 
290
- packages_failed = package_failures.
291
- map do |e|
292
- if e.respond_to?(:target) && e.target.respond_to?(:name)
293
- e.target.name
294
- end
295
- end.compact
296
- if !packages_failed.empty?
297
- Autobuild.error "#{packages_failed.size} packages failed: #{packages_failed.sort.join(", ")}"
288
+ packages_failed = package_failures
289
+ .map do |e|
290
+ if e.respond_to?(:target) && e.target.respond_to?(:name)
291
+ e.target.name
292
+ end
293
+ end.compact
294
+ unless packages_failed.empty?
295
+ Autobuild.error "#{packages_failed.size} packages failed: #{packages_failed.sort.join(', ')}"
298
296
  end
299
297
  config_failures.each do |e|
300
298
  Autobuild.error(e)
@@ -303,39 +301,39 @@ In this case, the default is false
303
301
  end
304
302
  end
305
303
 
306
- desc 'cache CACHE_DIR', 'create or update a cache directory that '\
307
- 'can be given to AUTOBUILD_CACHE_DIR'
304
+ desc "cache CACHE_DIR", "create or update a cache directory that "\
305
+ "can be given to AUTOBUILD_CACHE_DIR"
308
306
  option :keep_going,
309
307
  aliases: :k,
310
- desc: 'do not stop on errors'
308
+ desc: "do not stop on errors"
311
309
  option :checkout_only,
312
310
  aliases: :c, type: :boolean, default: false,
313
- desc: 'only checkout packages, do not update already-cached ones'
311
+ desc: "only checkout packages, do not update already-cached ones"
314
312
  option :all,
315
313
  type: :boolean, default: true,
316
- desc: 'cache all defined packages (the default), '\
317
- ' or only the selected ones'
314
+ desc: "cache all defined packages (the default), "\
315
+ " or only the selected ones"
318
316
  option :packages,
319
317
  type: :boolean, default: true,
320
- desc: 'update the package cache'
318
+ desc: "update the package cache"
321
319
  option :gems,
322
320
  type: :boolean, default: false,
323
- desc: 'update the gems cache'
321
+ desc: "update the gems cache"
324
322
  option :gems_compile_force,
325
323
  type: :boolean, default: false,
326
- desc: 'with --gems-compile, recompile existing gems as well'
324
+ desc: "with --gems-compile, recompile existing gems as well"
327
325
  option :gems_compile,
328
326
  type: :array,
329
- desc: 'pre-compile the following gems. This requires gem-compiler '\
330
- 'to be available in the workspace. Use GEM_NAME+ARTIFACT'\
331
- '[+ARTIFACT] to add files or directories to the precompiled '\
332
- 'gems beyond what gem-compiler auto-adds (which is mostly '\
333
- 'dynamic libraries)'
327
+ desc: "pre-compile the following gems. This requires gem-compiler "\
328
+ "to be available in the workspace. Use GEM_NAME+ARTIFACT"\
329
+ "[+ARTIFACT] to add files or directories to the precompiled "\
330
+ "gems beyond what gem-compiler auto-adds (which is mostly "\
331
+ "dynamic libraries)"
334
332
  def cache(*args)
335
333
  run_autoproj_cli(:cache, :Cache, Hash[], *args)
336
334
  end
337
335
 
338
- desc 'clean [PACKAGES]', 'remove build byproducts for the given packages'
336
+ desc "clean [PACKAGES]", "remove build byproducts for the given packages"
339
337
  long_desc <<-EODESC
340
338
  Remove build byproducts from disk
341
339
 
@@ -350,72 +348,72 @@ In this case, the default is false
350
348
  these defaults.
351
349
  EODESC
352
350
  option :deps, type: :boolean,
353
- desc: "clean the given packages as well as their dependencies"
351
+ desc: "clean the given packages as well as their dependencies"
354
352
  option :all, type: :boolean,
355
- desc: 'bypass the safety question when you mean to clean all packages'
353
+ desc: "bypass the safety question when you mean to clean all packages"
356
354
  def clean(*packages)
357
355
  run_autoproj_cli(:clean, :Clean, Hash[], *packages)
358
356
  end
359
357
 
360
- desc 'locate [PACKAGE]', 'return the path to the given package, or the path to the root if no packages are given on the command line'
358
+ desc "locate [PACKAGE]", "return the path to the given package, or the path to the root if no packages are given on the command line"
361
359
  option :cache, type: :boolean,
362
- desc: 'controls whether the resolution should be done by loading the whole configuration (false, slow) or through a cache file (the default)'
360
+ desc: "controls whether the resolution should be done by loading the whole configuration (false, slow) or through a cache file (the default)"
363
361
  option :prefix, aliases: :p, type: :boolean,
364
- desc: "outputs the package's prefix directory instead of its source directory"
362
+ desc: "outputs the package's prefix directory instead of its source directory"
365
363
  option :build, aliases: :b, type: :boolean,
366
- desc: "outputs the package's build directory instead of its source directory"
364
+ desc: "outputs the package's build directory instead of its source directory"
367
365
  option :log, aliases: :l,
368
- desc: "outputs the path to a package's log file"
366
+ desc: "outputs the path to a package's log file"
369
367
  def locate(*packages)
370
368
  run_autoproj_cli(:locate, :Locate, Hash[], *packages)
371
369
  end
372
370
 
373
- desc 'reconfigure', 'pass through all configuration questions'
371
+ desc "reconfigure", "pass through all configuration questions"
374
372
  option :separate_prefixes, type: :boolean,
375
- desc: "sets or clears autoproj's separate prefixes mode"
373
+ desc: "sets or clears autoproj's separate prefixes mode"
376
374
  def reconfigure
377
375
  run_autoproj_cli(:reconfigure, :Reconfigure, Hash[])
378
376
  end
379
377
 
380
- desc 'test', 'interface for running tests'
381
- subcommand 'test', MainTest
378
+ desc "test", "interface for running tests"
379
+ subcommand "test", MainTest
382
380
 
383
- desc 'doc', 'interface for generating documentation'
384
- subcommand 'doc', MainDoc
381
+ desc "doc", "interface for generating documentation"
382
+ subcommand "doc", MainDoc
385
383
 
386
- desc 'show [PACKAGES]', 'show informations about package(s)'
384
+ desc "show [PACKAGES]", "show informations about package(s)"
387
385
  option :mainline, type: :string,
388
- desc: "compare to the given baseline. if 'true', the comparison will ignore any override, otherwise it will take into account overrides only up to the given package set"
386
+ desc: "compare to the given baseline. if 'true', the comparison will ignore any override, otherwise it will take into account overrides only up to the given package set"
389
387
  option :env, type: :boolean,
390
- desc: "display the package's own environment", default: false
388
+ desc: "display the package's own environment", default: false
391
389
  option :short,
392
- desc: 'display a package summary with one package line'
390
+ desc: "display a package summary with one package line"
393
391
  option :recursive, type: :boolean, default: false,
394
- desc: 'display the package and their dependencies (the default is to only display selected packages)'
392
+ desc: "display the package and their dependencies (the default is to only display selected packages)"
395
393
  def show(*packages)
396
394
  run_autoproj_cli(:show, :Show, Hash[], *packages)
397
395
  end
398
396
 
399
- desc 'osdeps [PACKAGES]', 'install/update OS dependencies that are required by the given package (or for the whole installation if no packages are given'
397
+ desc "osdeps [PACKAGES]", "install/update OS dependencies that are required by the given package (or for the whole installation if no packages are given"
400
398
  option :system_info, type: :boolean,
401
- desc: 'show information about the osdep system and quit'
399
+ desc: "show information about the osdep system and quit"
402
400
  option :update, type: :boolean, default: true,
403
- desc: 'whether already installed packages should be updated or not'
401
+ desc: "whether already installed packages should be updated or not"
404
402
  def osdeps(*packages)
405
403
  run_autoproj_cli(:osdeps, :OSDeps, Hash[silent: options[:system_info]], *packages)
406
404
  end
407
405
 
408
- desc 'version', 'display the current version of autobuild and optionally with dependencies'
409
- option :deps, type: :boolean, default: false, banner:'',
410
- desc: "controls whether to list dependant gems as well"
406
+ desc "version", "display the current version of autobuild and optionally with dependencies"
407
+ option :deps, type: :boolean, default: false, banner: "",
408
+ desc: "controls whether to list dependant gems as well"
411
409
  def version(*args)
412
410
  run_autoproj_cli(:version, :Version, Hash[], *args)
413
411
  end
414
412
 
415
- desc 'versions [PACKAGES]', 'generate a version file for the given packages, or all packages if none are given'
416
- option :config, type: :boolean, default: nil, banner: '',
417
- desc: "controls whether the package sets should be versioned as well",
418
- long_desc: <<-EOD
413
+ desc "versions [PACKAGES]", "generate a version file for the given packages, or all packages if none are given"
414
+ option :config, type: :boolean, default: nil, banner: "",
415
+ desc: "controls whether the package sets should be versioned as well",
416
+ long_desc: <<-EOD
419
417
  This is the default if no packages are given on the command line, or if the
420
418
  autoproj main configuration directory is. Note that if --config but no packages
421
419
  are given, the packages will not be versioned. In other words,
@@ -423,65 +421,65 @@ are given, the packages will not be versioned. In other words,
423
421
  autoproj versions --config # versions only the configuration
424
422
  autoproj versions autoproj/ # versions only the configuration
425
423
  autoproj versions autoproj a/package # versions the configuration and the specified package(s)
426
- EOD
427
- option :keep_going, aliases: :k, type: :boolean, default: false, banner: '',
428
- desc: 'do not stop if some package cannot be versioned'
424
+ EOD
425
+ option :keep_going, aliases: :k, type: :boolean, default: false, banner: "",
426
+ desc: "do not stop if some package cannot be versioned"
429
427
  option :replace, type: :boolean, default: false,
430
- desc: 'in combination with --save, controls whether an existing file should be updated or replaced'
428
+ desc: "in combination with --save, controls whether an existing file should be updated or replaced"
431
429
  option :deps, type: :boolean, default: false,
432
- desc: 'whether both packages and their dependencies should be versioned, or only the selected packages (the latter is the default)'
430
+ desc: "whether both packages and their dependencies should be versioned, or only the selected packages (the latter is the default)"
433
431
  option :local, type: :boolean, default: false,
434
- desc: 'whether we should access the remote server to verify that the snapshotted state is present'
432
+ desc: "whether we should access the remote server to verify that the snapshotted state is present"
435
433
  option :save, type: :string,
436
- desc: 'save to the given file instead of displaying it on the standard output'
434
+ desc: "save to the given file instead of displaying it on the standard output"
437
435
  option :fingerprint, type: :boolean, default: false,
438
- desc: 'calculate unique fingerprint for each package'
436
+ desc: "calculate unique fingerprint for each package"
439
437
  def versions(*packages)
440
438
  run_autoproj_cli(:versions, :Versions, Hash[], *packages, deps: true)
441
439
  end
442
440
 
443
441
  stop_on_unknown_option! :log
444
- desc 'log [REF]', "shows the log of autoproj updates"
442
+ desc "log [REF]", "shows the log of autoproj updates"
445
443
  option :since, type: :string, default: nil,
446
- desc: 'show what got updated since the given version'
444
+ desc: "show what got updated since the given version"
447
445
  option :diff, type: :boolean, default: false,
448
- desc: 'show the difference between two stages in the log'
446
+ desc: "show the difference between two stages in the log"
449
447
  def log(*args)
450
448
  run_autoproj_cli(:log, :Log, Hash[], *args)
451
449
  end
452
450
 
453
- desc 'reset VERSION_ID', 'resets packages to the state stored in the required version'
451
+ desc "reset VERSION_ID", "resets packages to the state stored in the required version"
454
452
  long_desc <<-EOD
455
453
  reset VERSION_ID will infer the state of packages from the state stored in the requested version,
456
454
  and reset the packages to these versions. VERSION_ID can be:
457
455
  - an autoproj log entry (e.g. autoproj@{10})
458
456
  - a branch or tag from the autoproj main build configuration
459
- EOD
457
+ EOD
460
458
  option :freeze, type: :boolean, default: false,
461
- desc: 'whether the version we reset to should be saved in overrides.d or not'
459
+ desc: "whether the version we reset to should be saved in overrides.d or not"
462
460
  def reset(version_id)
463
461
  run_autoproj_cli(:reset, :Reset, Hash[], version_id)
464
462
  end
465
463
 
466
- desc 'tag [TAG_NAME] [PACKAGES]', 'save the package current versions as a tag, or lists the available tags if given no arguments.'
464
+ desc "tag [TAG_NAME] [PACKAGES]", "save the package current versions as a tag, or lists the available tags if given no arguments."
467
465
  long_desc <<-EOD
468
466
  The tag subcommand stores the state of all packages (or of the packages selected
469
467
  on the command line) into a tag in the build configuration. This state can be
470
468
  retrieved later on by using "autoproj reset"
471
469
 
472
470
  If given no arguments, will list the existing tags
473
- EOD
471
+ EOD
474
472
  option :package_sets, type: :boolean,
475
- desc: 'commit the package set state as well (enabled by default)'
476
- option :keep_going, aliases: :k, type: :boolean, banner: '',
477
- desc: 'do not stop on build or checkout errors'
473
+ desc: "commit the package set state as well (enabled by default)"
474
+ option :keep_going, aliases: :k, type: :boolean, banner: "",
475
+ desc: "do not stop on build or checkout errors"
478
476
  option :message, aliases: :m, type: :string,
479
- desc: 'the message to use for the new commit (the default is to mention the creation of the tag)'
477
+ desc: "the message to use for the new commit (the default is to mention the creation of the tag)"
480
478
  def tag(tag_name = nil, *packages)
481
479
  run_autoproj_cli(:tag, :Tag, Hash[], tag_name, *packages)
482
480
  end
483
481
 
484
- desc 'commit [TAG_NAME] [PACKAGES]', 'save the package current versions as a new commit in the main build configuration'
482
+ desc "commit [TAG_NAME] [PACKAGES]", "save the package current versions as a new commit in the main build configuration"
485
483
  long_desc <<-EOD
486
484
  The commit subcommand stores the state of all packages (or of the packages
487
485
  selected on the command line) into a new commit in the currently checked-out
@@ -489,20 +487,20 @@ branch of the build configuration. This state can be retrieved later on by using
489
487
  "autoproj reset". If a TAG_NAME is provided, the commit will be tagged.
490
488
 
491
489
  If given no arguments, will list the existing tags
492
- EOD
490
+ EOD
493
491
  option :package_sets, type: :boolean,
494
- desc: 'commit the package set state as well (enabled by default)'
495
- option :keep_going, aliases: :k, type: :boolean, banner: '',
496
- desc: 'do not stop on build or checkout errors'
492
+ desc: "commit the package set state as well (enabled by default)"
493
+ option :keep_going, aliases: :k, type: :boolean, banner: "",
494
+ desc: "do not stop on build or checkout errors"
497
495
  option :tag, aliases: :t, type: :string,
498
- desc: 'the tag name to use'
496
+ desc: "the tag name to use"
499
497
  option :message, aliases: :m, type: :string,
500
- desc: 'the message to use for the new commit (the default is to mention the creation of the tag)'
498
+ desc: "the message to use for the new commit (the default is to mention the creation of the tag)"
501
499
  def commit(*packages)
502
500
  run_autoproj_cli(:commit, :Commit, Hash[], *packages, deps: true)
503
501
  end
504
502
 
505
- desc 'switch-config VCS URL [OPTIONS]', 'switches the main build configuration'
503
+ desc "switch-config VCS URL [OPTIONS]", "switches the main build configuration"
506
504
  long_desc <<-EOD
507
505
  Changes source of the main configuration that is checked out in autoproj/
508
506
 
@@ -526,7 +524,7 @@ option without deleting the folder. Simply omit the VCS type and URL:
526
524
  run_autoproj_cli(:switch_config, :SwitchConfig, Hash[], *args)
527
525
  end
528
526
 
529
- desc 'query [QUERY]', 'searches for packages matching a query string. With no query string, matches all packages.'
527
+ desc "query [QUERY]", "searches for packages matching a query string. With no query string, matches all packages."
530
528
  long_desc <<-EOD
531
529
  Finds packages that match query_string and displays information about them (one per line)
532
530
  By default, only the package name is displayed. It can be customized with the --format option
@@ -551,78 +549,89 @@ The format is a string in which special values can be expanded using a $VARNAME
551
549
  PREFIX: the full path to the package installation directory
552
550
  EOD
553
551
  option :search_all, type: :boolean,
554
- desc: 'search in all defined packages instead of only in those selected selected in the layout'
552
+ desc: "search in all defined packages instead of only in those selected selected in the layout"
555
553
  option :format, type: :string,
556
- desc: "customize what should be displayed. See FORMAT SPECIFICATION above"
554
+ desc: "customize what should be displayed. See FORMAT SPECIFICATION above"
557
555
  def query(query_string = nil)
558
556
  run_autoproj_cli(:query, :Query, Hash[], *Array(query_string))
559
557
  end
560
558
 
561
- desc 'install_stage2 ROOT_DIR [ENVVAR=VALUE ...]', 'used by autoproj_install to finalize the installation',
562
- hide: true
559
+ desc "install_stage2 ROOT_DIR [ENVVAR=VALUE ...]", "used by autoproj_install to finalize the installation",
560
+ hide: true
563
561
  def install_stage2(root_dir, *vars)
564
- require 'autoproj/ops/install'
562
+ require "autoproj/ops/install"
565
563
  ops = Autoproj::Ops::Install.new(root_dir)
566
564
  ops.parse_options(thor_options_to_optparse)
567
565
  ops.stage2(*vars)
568
566
  end
569
567
 
570
- desc 'plugin', 'interface to manage autoproj plugins'
571
- subcommand 'plugin', MainPlugin
568
+ desc "plugin", "interface to manage autoproj plugins"
569
+ subcommand "plugin", MainPlugin
572
570
 
573
- desc 'global', 'global management of the known workspaces'
574
- subcommand 'global', MainGlobal
571
+ desc "global", "global management of the known workspaces"
572
+ subcommand "global", MainGlobal
575
573
 
576
- desc 'patch', 'applies patches necessary for the selected package',
577
- hide: true
574
+ desc "patch", "applies patches necessary for the selected package",
575
+ hide: true
578
576
  def patch(*packages)
579
577
  run_autoproj_cli(:patcher, :Patcher, Hash[], *packages, patch: true)
580
578
  end
581
579
 
582
- desc 'unpatch', 'remove any patch applied on the selected package',
583
- hide: true
580
+ desc "unpatch", "remove any patch applied on the selected package",
581
+ hide: true
584
582
  def unpatch(*packages)
585
583
  run_autoproj_cli(:patcher, :Patcher, Hash[], *packages, patch: false)
586
584
  end
587
585
 
588
- desc 'manifest', 'select or displays the active manifest'
586
+ desc "manifest", "select or displays the active manifest"
589
587
  def manifest(*name)
590
588
  run_autoproj_cli(:manifest, :Manifest, Hash[silent: true], *name)
591
589
  end
592
590
 
593
- desc 'exec', "runs a command, applying the workspace's environment first"
591
+ desc "exec", "runs a command, applying the workspace's environment first"
592
+ option :chdir, type: :string, default: nil,
593
+ desc: "change to this directory first. This is interpreted relatively "\
594
+ "to the folder specified by --package (if given)"
595
+ option :package, type: :string, default: nil,
596
+ desc: "interpret --chdir with respect to a package directory (or, "\
597
+ "if --chdir is not given, chdir to the package directory). Use "\
598
+ "PACKAGE or srcdir:PACKAGE for the source dir, builddir:PACKAGE "\
599
+ "for the build dir and prefix:PACKAGE for the prefix. If --chdir "\
600
+ "is not given, autoproj will chdir to this folder"
594
601
  option :use_cache, type: :boolean, default: nil,
595
- desc: "use the cached environment instead of "\
596
- "loading the whole configuration"
602
+ desc: "use the cached environment instead of "\
603
+ "loading the whole configuration"
597
604
  def exec(*args)
598
- require 'autoproj/cli/exec'
599
- Autoproj.report(on_package_failures: default_report_on_package_failures, debug: options[:debug], silent: true) do
600
- opts = Hash.new
605
+ require "autoproj/cli/exec"
606
+ Autoproj.report(
607
+ on_package_failures: default_report_on_package_failures,
608
+ debug: options[:debug],
609
+ silent: true
610
+ ) do
611
+ opts = {}
601
612
  use_cache = options[:use_cache]
602
- if !use_cache.nil?
603
- opts[:use_cached_env] = use_cache
604
- end
613
+ opts[:interactive] = options[:interactive]
614
+ opts[:chdir] = options[:chdir]
615
+ opts[:package] = options[:package]
616
+ opts[:use_cached_env] = use_cache unless use_cache.nil?
605
617
  CLI::Exec.new.run(*args, **opts)
606
618
  end
607
619
  end
608
620
 
609
- desc 'which', "resolves the full path to a command "\
610
- " within the Autoproj workspace"
621
+ desc "which", "resolves the full path to a command "\
622
+ " within the Autoproj workspace"
611
623
  option :use_cache, type: :boolean, default: nil,
612
- desc: "use the cached environment instead of "\
613
- "loading the whole configuration"
624
+ desc: "use the cached environment instead of "\
625
+ "loading the whole configuration"
614
626
  def which(cmd)
615
- require 'autoproj/cli/which'
627
+ require "autoproj/cli/which"
616
628
  Autoproj.report(on_package_failures: default_report_on_package_failures, debug: options[:debug], silent: true) do
617
629
  opts = Hash.new
618
630
  use_cache = options[:use_cache]
619
- if !use_cache.nil?
620
- opts[:use_cached_env] = use_cache
621
- end
631
+ opts[:use_cached_env] = use_cache unless use_cache.nil?
622
632
  CLI::Which.new.run(cmd, **opts)
623
633
  end
624
634
  end
625
635
  end
626
636
  end
627
637
  end
628
-