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
@@ -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,169 +129,170 @@ 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
137
- run_args = cli.validate_options(args, options.merge(extra_options))
138
- cli.run(*run_args)
137
+ *run_args, kw = cli.validate_options(args, options.merge(extra_options))
138
+ kw = (kw || {}).transform_keys(&:to_sym)
139
+ cli.run(*run_args, **kw)
139
140
  ensure
140
- 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
141
144
  end
142
145
  end
143
146
  end
144
147
  end
145
148
 
146
- 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'
147
- option :reuse, banner: 'DIR',
148
- 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'
149
- option :seed_config, banner: 'SEED_CONFIG',
150
- 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"
151
154
  def bootstrap(*args)
152
- if !File.directory?(File.join(Dir.pwd, '.autoproj'))
153
- require 'autoproj/ops/install'
155
+ unless File.directory?(File.join(Dir.pwd, ".autoproj"))
156
+ require "autoproj/ops/install"
154
157
  ops = Autoproj::Ops::Install.new(Dir.pwd)
155
158
  bootstrap_options = ops.parse_options(thor_options_to_optparse + args)
156
159
  ops.run
157
- exec Gem.ruby, $0, 'bootstrap', *bootstrap_options
160
+ exec Gem.ruby, $0, "bootstrap", *bootstrap_options
158
161
  end
159
162
  run_autoproj_cli(:bootstrap, :Bootstrap, Hash[], *args)
160
163
  end
161
164
 
162
- desc 'envsh', 'update the environment files'
165
+ desc "envsh", "update the environment files"
163
166
  def envsh
164
167
  run_autoproj_cli(:envsh, :Envsh, Hash[])
165
168
  end
166
169
 
167
- desc 'watch', 'watch workspace for changes', hide: true
170
+ desc "watch", "watch workspace for changes", hide: true
168
171
  option :show_events, type: :boolean, default: false,
169
- desc: "whether detected events should be displayed"
172
+ desc: "whether detected events should be displayed"
170
173
  def watch
171
174
  run_autoproj_cli(:watch, :Watch, Hash[])
172
175
  end
173
176
 
174
- 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"
175
178
  option :local, type: :boolean, default: false,
176
- 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)"
177
180
  option :mainline, type: :string,
178
- 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"
179
182
  option :snapshot, type: :boolean, default: false,
180
- 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"
181
184
  option :parallel, aliases: :p, type: :numeric,
182
- desc: 'maximum number of parallel jobs'
185
+ desc: "maximum number of parallel jobs"
183
186
  option :deps, type: :boolean, default: true,
184
- 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'
185
- option :no_deps_shortcut, hide: true, aliases: '-n', type: :boolean,
186
- 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"
187
190
  def status(*packages)
188
191
  run_autoproj_cli(:status, :Status, Hash[], *packages)
189
192
  end
190
193
 
191
- desc 'update [PACKAGES]', 'update packages'
194
+ desc "update [PACKAGES]", "update packages"
192
195
  option :aup, default: false, hide: true, type: :boolean,
193
- desc: 'behave like aup'
196
+ desc: "behave like aup"
194
197
  option :all, default: false, hide: true, type: :boolean,
195
- desc: 'when in aup mode, update all packages instead of only the local one'
196
- option :keep_going, aliases: :k, type: :boolean, banner: '',
197
- 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"
198
201
  option :config, type: :boolean,
199
- 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"
200
203
  option :bundler, type: :boolean,
201
- 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"
202
205
  option :autoproj, type: :boolean,
203
- 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"
204
207
  option :osdeps, type: :boolean, default: true,
205
- desc: "enable or disable osdeps handling"
208
+ desc: "enable or disable osdeps handling"
206
209
  option :from, type: :string,
207
- 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)"
208
211
  option :checkout_only, aliases: :c, type: :boolean, default: false,
209
- desc: "only checkout packages, do not update existing ones"
212
+ desc: "only checkout packages, do not update existing ones"
210
213
  option :local, type: :boolean, default: false,
211
- 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)"
212
215
  option :osdeps_filter_uptodate, default: true, type: :boolean,
213
- 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"
214
217
  option :deps, default: true, type: :boolean,
215
- desc: 'whether the package dependencies should be recursively updated (the default) or not. -n is a shortcut for --no-deps'
216
- option :no_deps_shortcut, hide: true, aliases: '-n', type: :boolean,
217
- 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"
218
221
  option :reset, default: false, type: :boolean,
219
- desc: "forcefully resets the repository to the state expected by autoproj's configuration",
220
- 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"
221
224
  option :force_reset, default: false, type: :boolean,
222
- 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"
223
226
  option :retry_count, default: nil, type: :numeric,
224
- desc: "force the importer's retry count to this value"
227
+ desc: "force the importer's retry count to this value"
225
228
  option :parallel, aliases: :p, type: :numeric,
226
- desc: 'maximum number of parallel jobs'
229
+ desc: "maximum number of parallel jobs"
227
230
  option :mainline, type: :string,
228
- 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"
229
232
  option :auto_exclude, type: :boolean,
230
- 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"
234
+ option :ask, type: :boolean, default: false,
235
+ desc: "ask whether each package should or should not be updated"
231
236
  def update(*packages)
232
237
  report_options = Hash[silent: false, on_package_failures: default_report_on_package_failures]
233
- if options[:auto_exclude]
234
- report_options[:on_package_failures] = :report
235
- end
238
+ report_options[:on_package_failures] = :report if options[:auto_exclude]
236
239
 
237
240
  run_autoproj_cli(:update, :Update, report_options, *packages, run_hook: true)
238
241
  end
239
242
 
240
- desc 'build [PACKAGES]', 'build packages'
243
+ desc "build [PACKAGES]", "build packages"
241
244
  option :amake, default: false, hide: true, type: :boolean,
242
- desc: 'behave like amake'
245
+ desc: "behave like amake"
243
246
  option :all, default: false, hide: true, type: :boolean,
244
- 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"
245
248
  option :keep_going, aliases: :k, type: :boolean, default: false,
246
- desc: 'do not stop on build or checkout errors'
249
+ desc: "do not stop on build or checkout errors"
247
250
  option :force, type: :boolean, default: false,
248
- 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"
249
252
  option :rebuild, type: :boolean, default: false,
250
- desc: 'clean and build the requested packages'
253
+ desc: "clean and build the requested packages"
251
254
  option :osdeps, type: :boolean,
252
- 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)"
253
256
  option :deps, type: :boolean,
254
- desc: "controls whether the operation should apply to the package's dependencies as well. -n is a shortcut for --no-deps",
255
- 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
256
259
  Without --force or --rebuild, the default is true (the build will apply to all packages).
257
260
  With --force or --rebuild, control whether the force/rebuild action should apply
258
261
  only on the packages given on the command line, or on their dependencies as well.
259
262
  In this case, the default is false
260
- EOD
261
- option :no_deps_shortcut, hide: true, aliases: '-n', type: :boolean,
262
- 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"
263
266
  option :parallel, aliases: :p, type: :numeric,
264
- desc: 'maximum number of parallel jobs'
267
+ desc: "maximum number of parallel jobs"
265
268
  option :auto_exclude, type: :boolean,
266
- 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"
267
270
  option :tool, type: :boolean,
268
- 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"
269
272
  option :confirm, type: :boolean, default: nil,
270
- 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"
271
274
  option :not, type: :array, default: nil,
272
- desc: 'do not build the packages listed'
275
+ desc: "do not build the packages listed"
273
276
  def build(*packages)
274
277
  report_options = Hash[silent: false, on_package_failures: default_report_on_package_failures]
275
- if options[:auto_exclude]
276
- report_options[:on_package_failures] = :report
277
- end
278
+ report_options[:on_package_failures] = :report if options[:auto_exclude]
278
279
 
279
280
  failures = run_autoproj_cli(:build, :Build, report_options, *packages,
280
- tool_failure_mode: :report_silent)
281
- if !failures.empty?
281
+ tool_failure_mode: :report_silent)
282
+ unless failures.empty?
282
283
  Autobuild.silent = false
283
284
  package_failures, config_failures = failures.partition do |e|
284
285
  e.respond_to?(:target) && e.target.respond_to?(:name)
285
286
  end
286
287
 
287
- packages_failed = package_failures.
288
- map do |e|
289
- if e.respond_to?(:target) && e.target.respond_to?(:name)
290
- e.target.name
291
- end
292
- end.compact
293
- if !packages_failed.empty?
294
- 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(', ')}"
295
296
  end
296
297
  config_failures.each do |e|
297
298
  Autobuild.error(e)
@@ -300,39 +301,39 @@ In this case, the default is false
300
301
  end
301
302
  end
302
303
 
303
- desc 'cache CACHE_DIR', 'create or update a cache directory that '\
304
- '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"
305
306
  option :keep_going,
306
307
  aliases: :k,
307
- desc: 'do not stop on errors'
308
+ desc: "do not stop on errors"
308
309
  option :checkout_only,
309
310
  aliases: :c, type: :boolean, default: false,
310
- desc: 'only checkout packages, do not update already-cached ones'
311
+ desc: "only checkout packages, do not update already-cached ones"
311
312
  option :all,
312
313
  type: :boolean, default: true,
313
- desc: 'cache all defined packages (the default), '\
314
- ' or only the selected ones'
314
+ desc: "cache all defined packages (the default), "\
315
+ " or only the selected ones"
315
316
  option :packages,
316
317
  type: :boolean, default: true,
317
- desc: 'update the package cache'
318
+ desc: "update the package cache"
318
319
  option :gems,
319
320
  type: :boolean, default: false,
320
- desc: 'update the gems cache'
321
+ desc: "update the gems cache"
321
322
  option :gems_compile_force,
322
323
  type: :boolean, default: false,
323
- desc: 'with --gems-compile, recompile existing gems as well'
324
+ desc: "with --gems-compile, recompile existing gems as well"
324
325
  option :gems_compile,
325
326
  type: :array,
326
- desc: 'pre-compile the following gems. This requires gem-compiler '\
327
- 'to be available in the workspace. Use GEM_NAME+ARTIFACT'\
328
- '[+ARTIFACT] to add files or directories to the precompiled '\
329
- 'gems beyond what gem-compiler auto-adds (which is mostly '\
330
- '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)"
331
332
  def cache(*args)
332
333
  run_autoproj_cli(:cache, :Cache, Hash[], *args)
333
334
  end
334
335
 
335
- desc 'clean [PACKAGES]', 'remove build byproducts for the given packages'
336
+ desc "clean [PACKAGES]", "remove build byproducts for the given packages"
336
337
  long_desc <<-EODESC
337
338
  Remove build byproducts from disk
338
339
 
@@ -347,72 +348,72 @@ In this case, the default is false
347
348
  these defaults.
348
349
  EODESC
349
350
  option :deps, type: :boolean,
350
- desc: "clean the given packages as well as their dependencies"
351
+ desc: "clean the given packages as well as their dependencies"
351
352
  option :all, type: :boolean,
352
- 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"
353
354
  def clean(*packages)
354
355
  run_autoproj_cli(:clean, :Clean, Hash[], *packages)
355
356
  end
356
357
 
357
- 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"
358
359
  option :cache, type: :boolean,
359
- 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)"
360
361
  option :prefix, aliases: :p, type: :boolean,
361
- 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"
362
363
  option :build, aliases: :b, type: :boolean,
363
- 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"
364
365
  option :log, aliases: :l,
365
- desc: "outputs the path to a package's log file"
366
+ desc: "outputs the path to a package's log file"
366
367
  def locate(*packages)
367
368
  run_autoproj_cli(:locate, :Locate, Hash[], *packages)
368
369
  end
369
370
 
370
- desc 'reconfigure', 'pass through all configuration questions'
371
+ desc "reconfigure", "pass through all configuration questions"
371
372
  option :separate_prefixes, type: :boolean,
372
- desc: "sets or clears autoproj's separate prefixes mode"
373
+ desc: "sets or clears autoproj's separate prefixes mode"
373
374
  def reconfigure
374
375
  run_autoproj_cli(:reconfigure, :Reconfigure, Hash[])
375
376
  end
376
377
 
377
- desc 'test', 'interface for running tests'
378
- subcommand 'test', MainTest
378
+ desc "test", "interface for running tests"
379
+ subcommand "test", MainTest
379
380
 
380
- desc 'doc', 'interface for generating documentation'
381
- subcommand 'doc', MainDoc
381
+ desc "doc", "interface for generating documentation"
382
+ subcommand "doc", MainDoc
382
383
 
383
- desc 'show [PACKAGES]', 'show informations about package(s)'
384
+ desc "show [PACKAGES]", "show informations about package(s)"
384
385
  option :mainline, type: :string,
385
- 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"
386
387
  option :env, type: :boolean,
387
- desc: "display the package's own environment", default: false
388
+ desc: "display the package's own environment", default: false
388
389
  option :short,
389
- desc: 'display a package summary with one package line'
390
+ desc: "display a package summary with one package line"
390
391
  option :recursive, type: :boolean, default: false,
391
- 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)"
392
393
  def show(*packages)
393
394
  run_autoproj_cli(:show, :Show, Hash[], *packages)
394
395
  end
395
396
 
396
- 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"
397
398
  option :system_info, type: :boolean,
398
- desc: 'show information about the osdep system and quit'
399
+ desc: "show information about the osdep system and quit"
399
400
  option :update, type: :boolean, default: true,
400
- desc: 'whether already installed packages should be updated or not'
401
+ desc: "whether already installed packages should be updated or not"
401
402
  def osdeps(*packages)
402
403
  run_autoproj_cli(:osdeps, :OSDeps, Hash[silent: options[:system_info]], *packages)
403
404
  end
404
405
 
405
- desc 'version', 'display the current version of autobuild and optionally with dependencies'
406
- option :deps, type: :boolean, default: false, banner:'',
407
- 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"
408
409
  def version(*args)
409
410
  run_autoproj_cli(:version, :Version, Hash[], *args)
410
411
  end
411
412
 
412
- desc 'versions [PACKAGES]', 'generate a version file for the given packages, or all packages if none are given'
413
- option :config, type: :boolean, default: nil, banner: '',
414
- desc: "controls whether the package sets should be versioned as well",
415
- 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
416
417
  This is the default if no packages are given on the command line, or if the
417
418
  autoproj main configuration directory is. Note that if --config but no packages
418
419
  are given, the packages will not be versioned. In other words,
@@ -420,65 +421,65 @@ are given, the packages will not be versioned. In other words,
420
421
  autoproj versions --config # versions only the configuration
421
422
  autoproj versions autoproj/ # versions only the configuration
422
423
  autoproj versions autoproj a/package # versions the configuration and the specified package(s)
423
- EOD
424
- option :keep_going, aliases: :k, type: :boolean, default: false, banner: '',
425
- 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"
426
427
  option :replace, type: :boolean, default: false,
427
- 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"
428
429
  option :deps, type: :boolean, default: false,
429
- 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)"
430
431
  option :local, type: :boolean, default: false,
431
- 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"
432
433
  option :save, type: :string,
433
- 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"
434
435
  option :fingerprint, type: :boolean, default: false,
435
- desc: 'calculate unique fingerprint for each package'
436
+ desc: "calculate unique fingerprint for each package"
436
437
  def versions(*packages)
437
438
  run_autoproj_cli(:versions, :Versions, Hash[], *packages, deps: true)
438
439
  end
439
440
 
440
441
  stop_on_unknown_option! :log
441
- desc 'log [REF]', "shows the log of autoproj updates"
442
+ desc "log [REF]", "shows the log of autoproj updates"
442
443
  option :since, type: :string, default: nil,
443
- desc: 'show what got updated since the given version'
444
+ desc: "show what got updated since the given version"
444
445
  option :diff, type: :boolean, default: false,
445
- desc: 'show the difference between two stages in the log'
446
+ desc: "show the difference between two stages in the log"
446
447
  def log(*args)
447
448
  run_autoproj_cli(:log, :Log, Hash[], *args)
448
449
  end
449
450
 
450
- 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"
451
452
  long_desc <<-EOD
452
453
  reset VERSION_ID will infer the state of packages from the state stored in the requested version,
453
454
  and reset the packages to these versions. VERSION_ID can be:
454
455
  - an autoproj log entry (e.g. autoproj@{10})
455
456
  - a branch or tag from the autoproj main build configuration
456
- EOD
457
+ EOD
457
458
  option :freeze, type: :boolean, default: false,
458
- 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"
459
460
  def reset(version_id)
460
461
  run_autoproj_cli(:reset, :Reset, Hash[], version_id)
461
462
  end
462
463
 
463
- 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."
464
465
  long_desc <<-EOD
465
466
  The tag subcommand stores the state of all packages (or of the packages selected
466
467
  on the command line) into a tag in the build configuration. This state can be
467
468
  retrieved later on by using "autoproj reset"
468
469
 
469
470
  If given no arguments, will list the existing tags
470
- EOD
471
+ EOD
471
472
  option :package_sets, type: :boolean,
472
- desc: 'commit the package set state as well (enabled by default)'
473
- option :keep_going, aliases: :k, type: :boolean, banner: '',
474
- 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"
475
476
  option :message, aliases: :m, type: :string,
476
- 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)"
477
478
  def tag(tag_name = nil, *packages)
478
479
  run_autoproj_cli(:tag, :Tag, Hash[], tag_name, *packages)
479
480
  end
480
481
 
481
- 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"
482
483
  long_desc <<-EOD
483
484
  The commit subcommand stores the state of all packages (or of the packages
484
485
  selected on the command line) into a new commit in the currently checked-out
@@ -486,20 +487,20 @@ branch of the build configuration. This state can be retrieved later on by using
486
487
  "autoproj reset". If a TAG_NAME is provided, the commit will be tagged.
487
488
 
488
489
  If given no arguments, will list the existing tags
489
- EOD
490
+ EOD
490
491
  option :package_sets, type: :boolean,
491
- desc: 'commit the package set state as well (enabled by default)'
492
- option :keep_going, aliases: :k, type: :boolean, banner: '',
493
- 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"
494
495
  option :tag, aliases: :t, type: :string,
495
- desc: 'the tag name to use'
496
+ desc: "the tag name to use"
496
497
  option :message, aliases: :m, type: :string,
497
- 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)"
498
499
  def commit(*packages)
499
500
  run_autoproj_cli(:commit, :Commit, Hash[], *packages, deps: true)
500
501
  end
501
502
 
502
- desc 'switch-config VCS URL [OPTIONS]', 'switches the main build configuration'
503
+ desc "switch-config VCS URL [OPTIONS]", "switches the main build configuration"
503
504
  long_desc <<-EOD
504
505
  Changes source of the main configuration that is checked out in autoproj/
505
506
 
@@ -523,7 +524,7 @@ option without deleting the folder. Simply omit the VCS type and URL:
523
524
  run_autoproj_cli(:switch_config, :SwitchConfig, Hash[], *args)
524
525
  end
525
526
 
526
- 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."
527
528
  long_desc <<-EOD
528
529
  Finds packages that match query_string and displays information about them (one per line)
529
530
  By default, only the package name is displayed. It can be customized with the --format option
@@ -548,78 +549,89 @@ The format is a string in which special values can be expanded using a $VARNAME
548
549
  PREFIX: the full path to the package installation directory
549
550
  EOD
550
551
  option :search_all, type: :boolean,
551
- 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"
552
553
  option :format, type: :string,
553
- desc: "customize what should be displayed. See FORMAT SPECIFICATION above"
554
+ desc: "customize what should be displayed. See FORMAT SPECIFICATION above"
554
555
  def query(query_string = nil)
555
556
  run_autoproj_cli(:query, :Query, Hash[], *Array(query_string))
556
557
  end
557
558
 
558
- desc 'install_stage2 ROOT_DIR [ENVVAR=VALUE ...]', 'used by autoproj_install to finalize the installation',
559
- hide: true
559
+ desc "install_stage2 ROOT_DIR [ENVVAR=VALUE ...]", "used by autoproj_install to finalize the installation",
560
+ hide: true
560
561
  def install_stage2(root_dir, *vars)
561
- require 'autoproj/ops/install'
562
+ require "autoproj/ops/install"
562
563
  ops = Autoproj::Ops::Install.new(root_dir)
563
564
  ops.parse_options(thor_options_to_optparse)
564
565
  ops.stage2(*vars)
565
566
  end
566
567
 
567
- desc 'plugin', 'interface to manage autoproj plugins'
568
- subcommand 'plugin', MainPlugin
568
+ desc "plugin", "interface to manage autoproj plugins"
569
+ subcommand "plugin", MainPlugin
569
570
 
570
- desc 'global', 'global management of the known workspaces'
571
- subcommand 'global', MainGlobal
571
+ desc "global", "global management of the known workspaces"
572
+ subcommand "global", MainGlobal
572
573
 
573
- desc 'patch', 'applies patches necessary for the selected package',
574
- hide: true
574
+ desc "patch", "applies patches necessary for the selected package",
575
+ hide: true
575
576
  def patch(*packages)
576
577
  run_autoproj_cli(:patcher, :Patcher, Hash[], *packages, patch: true)
577
578
  end
578
579
 
579
- desc 'unpatch', 'remove any patch applied on the selected package',
580
- hide: true
580
+ desc "unpatch", "remove any patch applied on the selected package",
581
+ hide: true
581
582
  def unpatch(*packages)
582
583
  run_autoproj_cli(:patcher, :Patcher, Hash[], *packages, patch: false)
583
584
  end
584
585
 
585
- desc 'manifest', 'select or displays the active manifest'
586
+ desc "manifest", "select or displays the active manifest"
586
587
  def manifest(*name)
587
588
  run_autoproj_cli(:manifest, :Manifest, Hash[silent: true], *name)
588
589
  end
589
590
 
590
- 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"
591
601
  option :use_cache, type: :boolean, default: nil,
592
- desc: "use the cached environment instead of "\
593
- "loading the whole configuration"
602
+ desc: "use the cached environment instead of "\
603
+ "loading the whole configuration"
594
604
  def exec(*args)
595
- require 'autoproj/cli/exec'
596
- Autoproj.report(on_package_failures: default_report_on_package_failures, debug: options[:debug], silent: true) do
597
- 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 = {}
598
612
  use_cache = options[:use_cache]
599
- if !use_cache.nil?
600
- opts[:use_cached_env] = use_cache
601
- 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?
602
617
  CLI::Exec.new.run(*args, **opts)
603
618
  end
604
619
  end
605
620
 
606
- desc 'which', "resolves the full path to a command "\
607
- " within the Autoproj workspace"
621
+ desc "which", "resolves the full path to a command "\
622
+ " within the Autoproj workspace"
608
623
  option :use_cache, type: :boolean, default: nil,
609
- desc: "use the cached environment instead of "\
610
- "loading the whole configuration"
624
+ desc: "use the cached environment instead of "\
625
+ "loading the whole configuration"
611
626
  def which(cmd)
612
- require 'autoproj/cli/which'
627
+ require "autoproj/cli/which"
613
628
  Autoproj.report(on_package_failures: default_report_on_package_failures, debug: options[:debug], silent: true) do
614
629
  opts = Hash.new
615
630
  use_cache = options[:use_cache]
616
- if !use_cache.nil?
617
- opts[:use_cached_env] = use_cache
618
- end
631
+ opts[:use_cached_env] = use_cache unless use_cache.nil?
619
632
  CLI::Which.new.run(cmd, **opts)
620
633
  end
621
634
  end
622
635
  end
623
636
  end
624
637
  end
625
-