autoproj 2.12.1 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 214fd95f143468744f972355eefe4d626db36b1b9682c47998fc33373f1e5af5
4
- data.tar.gz: 7fc8e361877c7ae1a66da15c00661e858cde213e6cf152c83799a7af71d910bf
3
+ metadata.gz: d0594abdc1c9523788d70185cef7fee0094e70aa0aad5a7c06432e78fd3f2324
4
+ data.tar.gz: 7fbde174feb043143cf9d64a23517858982216bd15e33c659954085f5168af64
5
5
  SHA512:
6
- metadata.gz: 75a492d69d8b5902468f0a21c20bf1b4cbfe19c86d438f879094d3684c31da6a14fa184aa839fe1607dad086bf3210fe43a572d488f99e1ecb85c56be04f9489
7
- data.tar.gz: d65b0bbbce89c696c913cddb23241b40a8d3acad47aabe7b93e9283701d3e7c1a82fde6544924d7b3f209a855aa9d065218303701c809b7a15e4fba3837193f6
6
+ metadata.gz: 82529e41b820b90048063019025470390718393f7479dfbf9714d4898abdc6d8a327306f1b672191f48e925b1af8c2e05e94583a4f9dde8a418f6aac11a99523
7
+ data.tar.gz: 9eeec00ec5b9aaaa565e85a65b2a07a22ba0701044657434d2a99c837174e0d87551a389f73d3ee55eff0f05ee2221b61c7f35e2b057c2fe5bbfbbe568015723
@@ -1,9 +1,11 @@
1
1
  sudo: true
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3.6
5
- - 2.4.3
6
- - 2.5.0
4
+ - "2.3"
5
+ - "2.4"
6
+ - "2.5"
7
+ - "2.6"
8
+ - "2.7"
7
9
  - jruby-9.1.15.0
8
10
  matrix:
9
11
  allow_failures:
@@ -25,14 +25,14 @@ Gem::Specification.new do |s|
25
25
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
26
 
27
27
  s.add_runtime_dependency "bundler"
28
- s.add_runtime_dependency "autobuild", ">= 1.19.0"
28
+ s.add_runtime_dependency "autobuild", ">= 1.21.0"
29
29
  s.add_runtime_dependency "backports", '~> 3.0'
30
30
  s.add_runtime_dependency "utilrb", '~> 3.0.0', ">= 3.0.0"
31
- s.add_runtime_dependency "thor", '~> 0.20.0'
32
- s.add_runtime_dependency 'concurrent-ruby', '~> 1.0.0', '>= 1.0.0'
33
- s.add_runtime_dependency 'tty-color', '~> 0.4.0', '>= 0.4.0'
34
- s.add_runtime_dependency 'tty-prompt', '~> 0.15.0'
35
- s.add_runtime_dependency 'tty-spinner', '~> 0.8.0'
31
+ s.add_runtime_dependency "thor", '~> 1.0'
32
+ s.add_runtime_dependency 'concurrent-ruby', '~> 1.1'
33
+ s.add_runtime_dependency 'tty-color', '~> 0.5.0'
34
+ s.add_runtime_dependency 'tty-prompt', '~> 0.21.0'
35
+ s.add_runtime_dependency 'tty-spinner', '~> 0.9.0'
36
36
  s.add_runtime_dependency 'rb-inotify' if RbConfig::CONFIG['target_os'] =~ /linux/
37
37
  s.add_runtime_dependency 'xdg', '= 2.2.5'
38
38
  s.add_development_dependency "flexmock", '~> 2.0', ">= 2.0.0"
data/bin/alog CHANGED
@@ -23,6 +23,7 @@ Autoproj.report(silent: true) do
23
23
 
24
24
  if log_files.size == 1
25
25
  logfile = log_files.first
26
+ puts File.read(logfile)
26
27
  elsif log_files.size > 1
27
28
  begin
28
29
  logfile = cli.select_log_file(log_files)
@@ -264,7 +264,7 @@ module Autoproj
264
264
  end
265
265
 
266
266
  def add_seed_config(path)
267
- @config.merge!(YAML.safe_load(File.read(path)))
267
+ @config.merge!(YAML.safe_load(File.read(path), [Symbol]))
268
268
  end
269
269
 
270
270
  # Parse the provided command line options and returns the non-options
@@ -264,7 +264,7 @@ module Autoproj
264
264
  end
265
265
 
266
266
  def add_seed_config(path)
267
- @config.merge!(YAML.safe_load(File.read(path)))
267
+ @config.merge!(YAML.safe_load(File.read(path), [Symbol]))
268
268
  end
269
269
 
270
270
  # Parse the provided command line options and returns the non-options
@@ -9,6 +9,8 @@
9
9
  require 'backports/2.4.0/nil_class/dup'
10
10
  require 'backports/2.4.0/false_class/dup'
11
11
  require 'backports/2.4.0/true_class/dup'
12
+ require 'backports/2.4.0/hash/transform_values'
13
+ require 'backports/2.5.0/hash/transform_keys'
12
14
 
13
15
  require 'autobuild'
14
16
  require 'autoproj/autobuild'
@@ -421,9 +421,9 @@ def source_package(options, workspace: Autoproj.workspace)
421
421
  end
422
422
 
423
423
  # @deprecated use Autoproj.config.declare instead
424
- def configuration_option(*opts, &block)
424
+ def configuration_option(*opts, **kw, &block)
425
425
  Autoproj.warn_deprecated __method__, "use Autoproj.config.declare instead"
426
- Autoproj.config.declare(*opts, &block)
426
+ Autoproj.config.declare(*opts, **kw, &block)
427
427
  end
428
428
 
429
429
  # @deprecated use Autoproj.config.get instead
@@ -134,8 +134,9 @@ def run_autoproj_cli(filename, classname, report_options, *args, tool_failure_mo
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
141
  cli.notify_env_sh_updated if cli.respond_to?(:notify_env_sh_updated)
141
142
  end
@@ -228,6 +229,8 @@ def status(*packages)
228
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"
229
230
  option :auto_exclude, type: :boolean,
230
231
  desc: 'if true, packages that fail to import will be excluded from the build'
232
+ option :ask, type: :boolean, default: false,
233
+ desc: 'ask whether each package should or should not be updated'
231
234
  def update(*packages)
232
235
  report_options = Hash[silent: false, on_package_failures: default_report_on_package_failures]
233
236
  if options[:auto_exclude]
@@ -73,7 +73,7 @@ def snapshot_overrides_vcs?(importer, vcs, snapshot)
73
73
  end
74
74
  end
75
75
 
76
- def report_exception(package_status, msg, e)
76
+ def self.report_exception(package_status, msg, e)
77
77
  package_status.msg << Autoproj.color(" #{msg} (#{e})", :red)
78
78
  if Autobuild.debug
79
79
  package_status.msg.concat(e.backtrace.map do |line|
@@ -82,8 +82,8 @@ def report_exception(package_status, msg, e)
82
82
  end
83
83
  end
84
84
 
85
- PackageStatus = Struct.new :msg, :sync, :uncommitted, :local, :remote
86
- def status_of_package(package_description, only_local: false, snapshot: false)
85
+ PackageStatus = Struct.new :msg, :sync, :unexpected, :uncommitted, :local, :remote
86
+ def self.status_of_package(package_description, only_local: false, snapshot: false)
87
87
  pkg = package_description.autobuild
88
88
  importer = pkg.importer
89
89
  package_status = PackageStatus.new(Array.new, false, false, false, false)
@@ -96,7 +96,7 @@ def status_of_package(package_description, only_local: false, snapshot: false)
96
96
  else
97
97
  begin status = importer.status(pkg, only_local: only_local)
98
98
  rescue StandardError => e
99
- report_exception(package_status, "failed to fetch status information", e)
99
+ self.report_exception(package_status, "failed to fetch status information", e)
100
100
  return package_status
101
101
  end
102
102
 
@@ -108,7 +108,7 @@ def status_of_package(package_description, only_local: false, snapshot: false)
108
108
  rescue Autobuild::PackageException
109
109
  Hash.new
110
110
  rescue StandardError => e
111
- report_exception(package_status, "failed to fetch snapshotting information", e)
111
+ self.report_exception(package_status, "failed to fetch snapshotting information", e)
112
112
  return package_status
113
113
  end
114
114
  if snapshot_overrides_vcs?(importer, package_description.vcs, snapshot_version)
@@ -122,6 +122,7 @@ def status_of_package(package_description, only_local: false, snapshot: false)
122
122
  end
123
123
 
124
124
  status.unexpected_working_copy_state.each do |msg|
125
+ package_status.unexpected = true
125
126
  package_status.msg << Autoproj.color(" #{msg}", :red, :bold)
126
127
  end
127
128
 
@@ -173,13 +174,15 @@ def each_package_status(packages, parallel: ws.config.parallel_import_level, sna
173
174
  end
174
175
  noninteractive = noninteractive.map do |pkg|
175
176
  future = Concurrent::Future.execute(executor: executor) do
176
- status_of_package(pkg, snapshot: snapshot, only_local: only_local)
177
+ Status.status_of_package(
178
+ pkg, snapshot: snapshot, only_local: only_local
179
+ )
177
180
  end
178
181
  [pkg, future]
179
182
  end
180
183
 
181
184
  (noninteractive + interactive).each do |pkg, future|
182
- if future
185
+ if future
183
186
  if progress
184
187
  wait_timeout = 1
185
188
  while true
@@ -196,7 +199,10 @@ def each_package_status(packages, parallel: ws.config.parallel_import_level, sna
196
199
  if !(status = future.value)
197
200
  raise future.reason
198
201
  end
199
- else status = status_of_package(pkg, snapshot: snapshot, only_local: only_local)
202
+ else
203
+ status = Status.status_of_package(
204
+ pkg, snapshot: snapshot, only_local: only_local
205
+ )
200
206
  end
201
207
 
202
208
  result.uncommitted ||= status.uncommitted
@@ -263,7 +269,7 @@ def display_status(packages, parallel: ws.config.parallel_import_level, snapshot
263
269
  sync_packages = ""
264
270
  end
265
271
 
266
- STDERR.print
272
+ STDERR.print
267
273
 
268
274
  if status.msg.size == 1
269
275
  Autoproj.message "#{pkg_name}: #{status.msg.first}"
@@ -1,5 +1,6 @@
1
1
  require 'autoproj/cli'
2
2
  require 'autoproj/cli/base'
3
+ require 'autoproj/cli/status'
3
4
  require 'autoproj/ops/import'
4
5
 
5
6
  module Autoproj
@@ -66,17 +67,20 @@ def validate_options(selection, options)
66
67
  return selection, options
67
68
  end
68
69
 
69
- def run(selected_packages, run_hook: false, report: true, **options)
70
+ def run(selected_packages, run_hook: false, report: true, ask: false, **options)
70
71
  ws.manifest.accept_unavailable_osdeps = !options[:osdeps]
71
72
  ws.setup
72
73
  ws.autodetect_operating_system(force: true)
73
- if options[:bundler]
74
- ws.update_bundler
75
- end
76
- if options[:autoproj]
77
- ws.update_autoproj
74
+
75
+ if ask
76
+ prompt = TTY::Prompt.new
77
+ options[:bundler] &&= prompt.yes?("Update bundler ?")
78
+ options[:autoproj] &&= prompt.yes?("Update autoproj ?")
78
79
  end
79
80
 
81
+ ws.update_bundler if options[:bundler]
82
+ ws.update_autoproj if options[:autoproj]
83
+
80
84
  begin
81
85
  ws.load_package_sets(
82
86
  mainline: options[:mainline],
@@ -84,7 +88,8 @@ def run(selected_packages, run_hook: false, report: true, **options)
84
88
  checkout_only: !options[:config] || options[:checkout_only],
85
89
  reset: options[:reset],
86
90
  keep_going: options[:keep_going],
87
- retry_count: options[:retry_count])
91
+ retry_count: options[:retry_count]
92
+ )
88
93
  rescue ImportFailed => configuration_import_failure
89
94
  if !options[:keep_going]
90
95
  raise
@@ -122,6 +127,7 @@ def run(selected_packages, run_hook: false, report: true, **options)
122
127
  parallel: options[:parallel] || ws.config.parallel_import_level,
123
128
  retry_count: options[:retry_count],
124
129
  auto_exclude: options[:auto_exclude],
130
+ ask: ask,
125
131
  report: report)
126
132
 
127
133
  ws.finalize_setup
@@ -193,14 +199,63 @@ def normalize_osdeps_options(
193
199
  osdeps_options
194
200
  end
195
201
 
202
+ class AskUpdateFilter
203
+ def initialize(prompt, parallel: 1, only_local: false)
204
+ @prompt = prompt
205
+ @only_local = only_local
206
+ @executor = Concurrent::FixedThreadPool.new(parallel, max_length: 0)
207
+
208
+ @parallel = parallel
209
+ @futures = {}
210
+ @lookahead_queue = []
211
+ end
212
+
213
+ def call(pkg)
214
+ unless (status = @futures.delete(pkg).value)
215
+ raise v.reason
216
+ end
217
+
218
+ clean = !status.unexpected &&
219
+ (status.sync || (status.local && !status.remote))
220
+ if clean
221
+ msg = Autobuild.color('already up-to-date', :green)
222
+ pkg.autobuild.message "#{msg} %s"
223
+ return false
224
+ end
225
+
226
+ Autobuild.progress_display_synchronize do
227
+ status.msg.each { |m| puts m }
228
+ @prompt.yes?("Update #{pkg.name} ?")
229
+ end
230
+ end
231
+
232
+ def lookahead(pkg)
233
+ @futures[pkg] = Concurrent::Future.execute(executor: @executor) do
234
+ Status.status_of_package(
235
+ pkg, snapshot: false, only_local: @only_local
236
+ )
237
+ end
238
+ end
239
+ end
240
+
196
241
  def update_packages(selected_packages,
197
242
  from: nil, checkout_only: false, only_local: false, reset: false,
198
243
  deps: true, keep_going: false, parallel: 1,
199
244
  retry_count: 0, osdeps: true, auto_exclude: false, osdeps_options: Hash.new,
200
- report: true)
245
+ report: true, ask: false)
201
246
 
202
247
  setup_update_from(from) if from
203
248
 
249
+ filter =
250
+ if ask
251
+ prompt = TTY::Prompt.new
252
+ filter = AskUpdateFilter.new(
253
+ prompt, parallel: parallel, only_local: only_local
254
+ )
255
+ else
256
+ ->(pkg) { true }
257
+ end
258
+
204
259
  ops = Autoproj::Ops::Import.new(
205
260
  ws, report_path: (ws.import_report_path if report))
206
261
  source_packages, osdep_packages =
@@ -213,7 +268,8 @@ def update_packages(selected_packages,
213
268
  parallel: parallel,
214
269
  retry_count: retry_count,
215
270
  install_vcs_packages: (osdeps_options if osdeps),
216
- auto_exclude: auto_exclude)
271
+ auto_exclude: auto_exclude,
272
+ filter: filter)
217
273
  [source_packages, osdep_packages, nil]
218
274
  rescue ExcludedSelection => e
219
275
  raise CLIInvalidSelection, e.message, e.backtrace
@@ -70,7 +70,7 @@ def list(user_selection, options = {})
70
70
  out_format = "%-#{w}s %-7s %-9s"
71
71
  puts format(out_format, 'Package Name', 'Enabled', 'Available')
72
72
  lines.each do |name, enabled, available|
73
- puts(format(out_format, name, (!!enabled).to_s, (!!available).to_s))
73
+ puts(format(out_format, name, (!!enabled).to_s, (!!available).to_s)) # rubocop:disable Style/DoubleNegation
74
74
  end
75
75
  end
76
76
 
@@ -113,12 +113,12 @@ def apply_to_packages(packages, parallel: ws.config.parallel_build_level)
113
113
  ) do |pkg, phase|
114
114
  reporting&.report_incremental(pkg) if phase == utility_name
115
115
  end
116
-
117
116
  ensure
118
117
  reporting&.create_report(packages.map(&:autobuild))
119
118
  end
120
119
 
121
120
  def package_metadata(autobuild_package)
121
+ # rubocop:disable Style/DoubleNegation
122
122
  u = autobuild_package.utility(@utility_name)
123
123
  {
124
124
  'source_dir' => u.source_dir,
@@ -127,8 +127,9 @@ def package_metadata(autobuild_package)
127
127
  'enabled' => !!u.enabled?,
128
128
  'invoked' => !!u.invoked?,
129
129
  'success' => !!u.success?,
130
- 'installed' => !!u.installed?,
130
+ 'installed' => !!u.installed?
131
131
  }
132
+ # rubocop:enable Style/DoubleNegation
132
133
  end
133
134
  end
134
135
  end
@@ -244,10 +244,10 @@ def save(path = self.path, force: false)
244
244
  @modified = false
245
245
  end
246
246
 
247
- def each_reused_autoproj_installation
247
+ def each_reused_autoproj_installation(&block)
248
248
  if has_value_for?('reused_autoproj_installations')
249
- get('reused_autoproj_installations').each(&proc)
250
- else [].each(&proc)
249
+ get('reused_autoproj_installations').each(&block)
250
+ else [].each(&block)
251
251
  end
252
252
  end
253
253
 
@@ -92,6 +92,12 @@ ruby24:
92
92
  ruby25:
93
93
  default: ignore # we assume that if the user has a ruby 2.5 runtime, it is usable
94
94
 
95
+ ruby26:
96
+ default: ignore # we assume that if the user has a ruby 2.5 runtime, it is usable
97
+
98
+ ruby27:
99
+ default: ignore # we assume that if the user has a ruby 2.5 runtime, it is usable
100
+
95
101
  build-essential:
96
102
  debian,ubuntu: build-essential
97
103
  gentoo: ignore
@@ -132,15 +138,19 @@ archive:
132
138
  debian,ubuntu:
133
139
  - tar
134
140
  - unzip
141
+ - ca-certificates
135
142
  gentoo:
136
143
  - app-arch/tar
137
144
  - app-arch/unzip
145
+ - app-misc/ca-certificates
138
146
  arch:
139
147
  - tar
140
148
  - unzip
149
+ - ca-certificates
141
150
  fedora:
142
151
  - tar
143
152
  - unzip
153
+ - ca-certificates
144
154
  macos-port:
145
155
  - gnutar
146
156
  - unzip
@@ -149,6 +159,7 @@ archive:
149
159
  opensuse:
150
160
  - tar
151
161
  - unzip
162
+ - ca-certificates
152
163
  default: ignore
153
164
 
154
165
  cvs:
@@ -1237,7 +1237,7 @@ def self.config
1237
1237
  workspace.config
1238
1238
  end
1239
1239
 
1240
- def self.add_osdeps_overrides(*args, &block)
1241
- manifest.add_osdeps_overrides(*args, &block)
1240
+ def self.add_osdeps_overrides(*args, **kw, &block)
1241
+ manifest.add_osdeps_overrides(*args, **kw, &block)
1242
1242
  end
1243
1243
  end
@@ -199,6 +199,7 @@ def import_selected_packages(selection,
199
199
  install_vcs_packages: Hash.new,
200
200
  non_imported_packages: :checkout,
201
201
  auto_exclude: auto_exclude?,
202
+ filter: ->(package) { true },
202
203
  **import_options)
203
204
 
204
205
  unless %i[checkout ignore return].include?(non_imported_packages)
@@ -235,6 +236,11 @@ def import_selected_packages(selection,
235
236
  missing_vcs = Array.new
236
237
  installed_vcs_packages = Set['none', 'local']
237
238
  while failures.empty? || keep_going
239
+ # Allow 'filter' to parallelize as well
240
+ if filter.respond_to?(:lookahead)
241
+ package_queue.each { |pkg| filter.lookahead(pkg) }
242
+ end
243
+
238
244
  # Queue work for all packages in the queue
239
245
  package_queue.each do |pkg|
240
246
  # Remove packages that have already been processed
@@ -255,6 +261,11 @@ def import_selected_packages(selection,
255
261
  end
256
262
  all_processed_packages << pkg
257
263
 
264
+ unless filter.call(pkg)
265
+ completion_queue << [pkg, Time.now]
266
+ next
267
+ end
268
+
258
269
  importer = pkg.autobuild.importer
259
270
  if !pre_package_import(selection, manifest, pkg.autobuild,
260
271
  reverse_dependencies)
@@ -272,8 +283,8 @@ def import_selected_packages(selection,
272
283
  next
273
284
  end
274
285
 
275
- pending_packages << pkg
276
286
  begin
287
+ pending_packages << pkg
277
288
  queue_import_work(
278
289
  executor, completion_queue, pkg,
279
290
  retry_count: retry_count,
@@ -432,6 +443,7 @@ def import_packages(selection,
432
443
  keep_going: false,
433
444
  install_vcs_packages: Hash.new,
434
445
  auto_exclude: auto_exclude?,
446
+ filter: ->(pkg) { true },
435
447
  **import_options)
436
448
 
437
449
  manifest = ws.manifest
@@ -443,6 +455,7 @@ def import_packages(selection,
443
455
  recursive: recursive,
444
456
  install_vcs_packages: install_vcs_packages,
445
457
  auto_exclude: auto_exclude,
458
+ filter: filter,
446
459
  **import_options)
447
460
 
448
461
  raise failures.first if !keep_going && !failures.empty?
@@ -254,7 +254,7 @@ def default_gemfile_contents(autoproj_version = ">= 2.0.0")
254
254
  end
255
255
 
256
256
  def add_seed_config(path)
257
- @config.merge!(YAML.safe_load(File.read(path)))
257
+ @config.merge!(YAML.safe_load(File.read(path), [Symbol]))
258
258
  end
259
259
 
260
260
  # Parse the provided command line options and returns the non-options
@@ -24,8 +24,8 @@ def initialize(text_name, srcdir, importer = nil)
24
24
  @@packages.delete(text_name)
25
25
  end
26
26
 
27
- def import(options = Hash.new)
28
- importer.import(self, options)
27
+ def import(**options)
28
+ importer.import(self, **options)
29
29
  end
30
30
 
31
31
  def add_stat(*args)
@@ -90,7 +90,7 @@ def apply_dependencies_from_manifest
90
90
  autobuild.depends_on name
91
91
  end
92
92
  rescue ConfigError => e
93
- raise ConfigError.new(manifest.path),
93
+ raise PackageNotFound.new(manifest.path),
94
94
  "manifest #{manifest.path} of #{self.name} from "\
95
95
  "#{package_set.name} lists '#{name}' as dependency, "\
96
96
  'but it is neither a normal package nor an osdeps '\
@@ -168,7 +168,7 @@ def initialize(
168
168
  @version_control = Array.new
169
169
  @overrides = Array.new
170
170
  @raw_local_dir = raw_local_dir
171
- @default_importer = VCSDefinition.from_raw(type: 'none')
171
+ @default_importer = VCSDefinition.from_raw({ type: 'none' })
172
172
 
173
173
  @imports = Set.new
174
174
  @imports_vcs = Array.new
@@ -239,7 +239,7 @@ def snapshot(target_dir, options = Hash.new)
239
239
  else
240
240
  package = create_autobuild_package
241
241
  if package.importer.respond_to?(:snapshot)
242
- package.importer.snapshot(package, target_dir, options)
242
+ package.importer.snapshot(package, target_dir, **options)
243
243
  end
244
244
  end
245
245
  end
@@ -333,8 +333,9 @@ def ws_clear_layout
333
333
  ws.manifest.clear_layout
334
334
  end
335
335
 
336
- def ws_define_package_set(name, vcs = VCSDefinition.from_raw(type: 'none'),
337
- **options)
336
+ def ws_define_package_set(
337
+ name, vcs = VCSDefinition.from_raw({ type: 'none' }), **options
338
+ )
338
339
  package_set = PackageSet.new(ws, vcs, name: name, **options)
339
340
  ws.manifest.register_package_set(package_set)
340
341
  package_set
@@ -351,8 +352,9 @@ def ws_create_local_package_set(name, path, source_data: Hash.new, **options)
351
352
  package_set
352
353
  end
353
354
 
354
- def ws_add_package_set_to_layout(name, vcs = VCSDefinition.from_raw(type: 'none'),
355
- **options)
355
+ def ws_add_package_set_to_layout(
356
+ name, vcs = VCSDefinition.from_raw({ type: 'none' }), **options
357
+ )
356
358
  package_set = ws_define_package_set(name, vcs, **options)
357
359
  ws.manifest.add_package_set_to_layout(package_set)
358
360
  package_set
@@ -80,7 +80,9 @@ def self.expand(value, definitions = Hash.new)
80
80
  end
81
81
 
82
82
  # True if the given string contains expansions
83
- def self.contains_expansion?(string); string =~ /\$/ end
83
+ def self.contains_expansion?(string)
84
+ string.respond_to?(:to_str) && string.to_str =~ /\$/
85
+ end
84
86
 
85
87
  def self.resolve_one_constant(name, value, result, definitions)
86
88
  result[name] ||= single_expansion(value, result) do |missing_name|
@@ -33,7 +33,7 @@ class VCSDefinition
33
33
  HistoryEntry = Struct.new :package_set, :vcs
34
34
  RawEntry = Struct.new :package_set, :file, :vcs
35
35
 
36
- def initialize(type, url, vcs_options, from: nil, raw: Array.new, history: Array.new)
36
+ def initialize(type, url, vcs_options, from: nil, raw: [], history: [])
37
37
  if !raw.respond_to?(:to_ary)
38
38
  raise ArgumentError, "wrong format for the raw field (#{raw.inspect})"
39
39
  end
@@ -49,7 +49,7 @@ def initialize(type, url, vcs_options, from: nil, raw: Array.new, history: Array
49
49
 
50
50
  # Create a null VCS object
51
51
  def self.none
52
- from_raw(type: 'none')
52
+ from_raw({ type: 'none' })
53
53
  end
54
54
 
55
55
  # Whether there is actually a version control definition
@@ -151,10 +151,14 @@ def self.normalize_vcs_hash(spec, base_dir: nil)
151
151
  elsif base_dir
152
152
  File.expand_path(short_url, base_dir)
153
153
  else
154
- raise ArgumentError, "VCS path '#{short_url}' is relative and no base_dir was given"
154
+ raise ArgumentError,
155
+ "VCS path '#{short_url}' is relative and no "\
156
+ "base_dir was given"
155
157
  end
156
158
  if !File.directory?(source_dir)
157
- raise ArgumentError, "'#{short_url}' is neither a remote source specification, nor an existing local directory"
159
+ raise ArgumentError,
160
+ "'#{short_url}' is neither a remote source "\
161
+ 'specification, nor an existing local directory'
158
162
  end
159
163
  spec.merge!(type: 'local', url: source_dir)
160
164
  end
@@ -195,17 +199,26 @@ def self.raw_spec_to_s(spec)
195
199
  # @return [VCSDefinition]
196
200
  # @raise ArgumentError if the raw specification does not match an
197
201
  # expected format
198
- def self.from_raw(spec, from: nil, raw: Array.new, history: Array.new)
202
+ def self.from_raw(spec, from: nil, raw: [], history: [])
199
203
  normalized_spec = normalize_vcs_hash(spec)
200
204
  if !(type = normalized_spec.delete(:type))
201
- raise ArgumentError, "the source specification #{raw_spec_to_s(spec)} normalizes into #{raw_spec_to_s(normalized_spec)}, which does not have a VCS type"
202
- elsif !(url = normalized_spec.delete(:url))
203
- if type != 'none'
204
- raise ArgumentError, "the source specification #{raw_spec_to_s(spec)} normalizes into #{raw_spec_to_s(normalized_spec)}, which does not have a URL. Only VCS of type 'none' do not require one"
205
- end
205
+ raise ArgumentError,
206
+ "the source specification #{raw_spec_to_s(spec)} normalizes "\
207
+ "into #{raw_spec_to_s(normalized_spec)}, "\
208
+ 'which does not have a VCS type'
209
+ end
210
+
211
+ if !(url = normalized_spec.delete(:url)) && type != 'none'
212
+ raise ArgumentError,
213
+ "the source specification #{raw_spec_to_s(spec)} normalizes "\
214
+ "into #{raw_spec_to_s(normalized_spec)}, "\
215
+ 'which does not have a URL. '\
216
+ 'Only VCS of type \'none\' do not require one'
206
217
  end
207
218
 
208
- VCSDefinition.new(type, url, normalized_spec, from: from, history: history, raw: raw)
219
+ VCSDefinition.new(
220
+ type, url, normalized_spec, from: from, history: history, raw: raw
221
+ )
209
222
  end
210
223
 
211
224
  def ==(other_vcs)
@@ -307,7 +320,7 @@ def self.call_source_handler(vcs, url, options)
307
320
  if !handler
308
321
  raise ArgumentError, "there is no source handler for #{vcs}"
309
322
  else
310
- return handler.call(url, options)
323
+ handler.call(url, **options)
311
324
  end
312
325
  end
313
326
 
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "2.12.1"
2
+ VERSION = "2.13.0"
3
3
  end
@@ -282,7 +282,8 @@ def load_config(reconfigure = false)
282
282
  if (raw_vcs = config.get('manifest_source', nil))
283
283
  VCSDefinition.from_raw(raw_vcs)
284
284
  else
285
- VCSDefinition.from_raw(type: 'local', url: config_dir)
285
+ local_vcs = { type: 'local', url: config_dir }
286
+ VCSDefinition.from_raw(local_vcs)
286
287
  end
287
288
 
288
289
  if config.source_dir && Pathname.new(config.source_dir).absolute?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.1
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-23 00:00:00.000000000 Z
11
+ date: 2020-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.19.0
33
+ version: 1.21.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.19.0
40
+ version: 1.21.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: backports
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -78,82 +78,70 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 0.20.0
81
+ version: '1.0'
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 0.20.0
88
+ version: '1.0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: concurrent-ruby
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 1.0.0
96
- - - ">="
97
- - !ruby/object:Gem::Version
98
- version: 1.0.0
95
+ version: '1.1'
99
96
  type: :runtime
100
97
  prerelease: false
101
98
  version_requirements: !ruby/object:Gem::Requirement
102
99
  requirements:
103
100
  - - "~>"
104
101
  - !ruby/object:Gem::Version
105
- version: 1.0.0
106
- - - ">="
107
- - !ruby/object:Gem::Version
108
- version: 1.0.0
102
+ version: '1.1'
109
103
  - !ruby/object:Gem::Dependency
110
104
  name: tty-color
111
105
  requirement: !ruby/object:Gem::Requirement
112
106
  requirements:
113
107
  - - "~>"
114
108
  - !ruby/object:Gem::Version
115
- version: 0.4.0
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- version: 0.4.0
109
+ version: 0.5.0
119
110
  type: :runtime
120
111
  prerelease: false
121
112
  version_requirements: !ruby/object:Gem::Requirement
122
113
  requirements:
123
114
  - - "~>"
124
115
  - !ruby/object:Gem::Version
125
- version: 0.4.0
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- version: 0.4.0
116
+ version: 0.5.0
129
117
  - !ruby/object:Gem::Dependency
130
118
  name: tty-prompt
131
119
  requirement: !ruby/object:Gem::Requirement
132
120
  requirements:
133
121
  - - "~>"
134
122
  - !ruby/object:Gem::Version
135
- version: 0.15.0
123
+ version: 0.21.0
136
124
  type: :runtime
137
125
  prerelease: false
138
126
  version_requirements: !ruby/object:Gem::Requirement
139
127
  requirements:
140
128
  - - "~>"
141
129
  - !ruby/object:Gem::Version
142
- version: 0.15.0
130
+ version: 0.21.0
143
131
  - !ruby/object:Gem::Dependency
144
132
  name: tty-spinner
145
133
  requirement: !ruby/object:Gem::Requirement
146
134
  requirements:
147
135
  - - "~>"
148
136
  - !ruby/object:Gem::Version
149
- version: 0.8.0
137
+ version: 0.9.0
150
138
  type: :runtime
151
139
  prerelease: false
152
140
  version_requirements: !ruby/object:Gem::Requirement
153
141
  requirements:
154
142
  - - "~>"
155
143
  - !ruby/object:Gem::Version
156
- version: 0.8.0
144
+ version: 0.9.0
157
145
  - !ruby/object:Gem::Dependency
158
146
  name: rb-inotify
159
147
  requirement: !ruby/object:Gem::Requirement
@@ -466,8 +454,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
466
454
  - !ruby/object:Gem::Version
467
455
  version: '0'
468
456
  requirements: []
469
- rubyforge_project:
470
- rubygems_version: 2.7.6.2
457
+ rubygems_version: 3.1.2
471
458
  signing_key:
472
459
  specification_version: 4
473
460
  summary: Easy installation and management of sets of software packages