autoproj 2.12.1 → 2.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +25 -0
- data/.github/workflows/test.yml +30 -0
- data/.rubocop.yml +79 -91
- data/.rubocop_todo.yml +1473 -0
- data/Gemfile +9 -9
- data/Rakefile +24 -24
- data/autoproj.gemspec +24 -22
- data/bin/alocate +4 -4
- data/bin/alog +6 -7
- data/bin/amake +4 -4
- data/bin/aup +4 -4
- data/bin/autoproj +3 -3
- data/bin/autoproj_bootstrap +225 -200
- data/bin/autoproj_bootstrap.in +7 -8
- data/bin/autoproj_install +224 -199
- data/bin/autoproj_install.in +6 -7
- data/lib/autoproj/aruba_minitest.rb +6 -11
- data/lib/autoproj/autobuild.rb +9 -6
- data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
- data/lib/autoproj/autobuild_extensions/dsl.rb +66 -36
- data/lib/autoproj/autobuild_extensions/git.rb +27 -26
- data/lib/autoproj/autobuild_extensions/package.rb +23 -22
- data/lib/autoproj/autobuild_extensions/python.rb +18 -0
- data/lib/autoproj/autobuild_extensions/svn.rb +1 -2
- data/lib/autoproj/base.rb +1 -1
- data/lib/autoproj/bash_completion.rb +5 -6
- data/lib/autoproj/build_option.rb +22 -24
- data/lib/autoproj/cli/base.rb +26 -26
- data/lib/autoproj/cli/bootstrap.rb +14 -16
- data/lib/autoproj/cli/build.rb +10 -7
- data/lib/autoproj/cli/cache.rb +11 -11
- data/lib/autoproj/cli/clean.rb +10 -10
- data/lib/autoproj/cli/commit.rb +7 -8
- data/lib/autoproj/cli/doc.rb +2 -2
- data/lib/autoproj/cli/envsh.rb +1 -2
- data/lib/autoproj/cli/exec.rb +60 -20
- data/lib/autoproj/cli/inspection_tool.rb +13 -7
- data/lib/autoproj/cli/locate.rb +30 -41
- data/lib/autoproj/cli/log.rb +7 -7
- data/lib/autoproj/cli/main.rb +217 -205
- data/lib/autoproj/cli/main_doc.rb +22 -21
- data/lib/autoproj/cli/main_global.rb +44 -19
- data/lib/autoproj/cli/main_plugin.rb +18 -18
- data/lib/autoproj/cli/main_test.rb +28 -27
- data/lib/autoproj/cli/manifest.rb +7 -7
- data/lib/autoproj/cli/osdeps.rb +12 -11
- data/lib/autoproj/cli/patcher.rb +2 -3
- data/lib/autoproj/cli/query.rb +17 -18
- data/lib/autoproj/cli/reconfigure.rb +1 -2
- data/lib/autoproj/cli/reset.rb +9 -12
- data/lib/autoproj/cli/show.rb +38 -39
- data/lib/autoproj/cli/status.rb +56 -44
- data/lib/autoproj/cli/switch_config.rb +5 -6
- data/lib/autoproj/cli/tag.rb +12 -11
- data/lib/autoproj/cli/test.rb +7 -7
- data/lib/autoproj/cli/update.rb +97 -43
- data/lib/autoproj/cli/utility.rb +14 -12
- data/lib/autoproj/cli/version.rb +42 -40
- data/lib/autoproj/cli/versions.rb +14 -15
- data/lib/autoproj/cli/watch.rb +33 -37
- data/lib/autoproj/cli/which.rb +16 -20
- data/lib/autoproj/cli.rb +4 -2
- data/lib/autoproj/configuration.rb +78 -86
- data/lib/autoproj/default.osdeps +29 -3
- data/lib/autoproj/environment.rb +42 -23
- data/lib/autoproj/exceptions.rb +9 -3
- data/lib/autoproj/find_workspace.rb +20 -25
- data/lib/autoproj/git_server_configuration.rb +40 -44
- data/lib/autoproj/gitorious.rb +1 -1
- data/lib/autoproj/installation_manifest.rb +64 -29
- data/lib/autoproj/local_package_set.rb +13 -11
- data/lib/autoproj/manifest.rb +139 -132
- data/lib/autoproj/metapackage.rb +2 -6
- data/lib/autoproj/ops/atomic_write.rb +7 -6
- data/lib/autoproj/ops/build.rb +4 -6
- data/lib/autoproj/ops/cache.rb +41 -43
- data/lib/autoproj/ops/cached_env.rb +5 -4
- data/lib/autoproj/ops/configuration.rb +519 -507
- data/lib/autoproj/ops/import.rb +88 -63
- data/lib/autoproj/ops/install.rb +218 -192
- data/lib/autoproj/ops/loader.rb +77 -76
- data/lib/autoproj/ops/main_config_switcher.rb +36 -45
- data/lib/autoproj/ops/phase_reporting.rb +4 -4
- data/lib/autoproj/ops/snapshot.rb +250 -247
- data/lib/autoproj/ops/tools.rb +76 -78
- data/lib/autoproj/ops/watch.rb +6 -6
- data/lib/autoproj/ops/which.rb +17 -14
- data/lib/autoproj/options.rb +13 -2
- data/lib/autoproj/os_package_installer.rb +102 -92
- data/lib/autoproj/os_package_query.rb +7 -13
- data/lib/autoproj/os_package_resolver.rb +189 -140
- data/lib/autoproj/os_repository_installer.rb +4 -4
- data/lib/autoproj/os_repository_resolver.rb +8 -6
- data/lib/autoproj/package_definition.rb +12 -13
- data/lib/autoproj/package_managers/apt_dpkg_manager.rb +19 -11
- data/lib/autoproj/package_managers/bundler_manager.rb +186 -129
- data/lib/autoproj/package_managers/debian_version.rb +25 -21
- data/lib/autoproj/package_managers/emerge_manager.rb +2 -3
- data/lib/autoproj/package_managers/gem_manager.rb +68 -77
- data/lib/autoproj/package_managers/homebrew_manager.rb +3 -4
- data/lib/autoproj/package_managers/manager.rb +8 -3
- data/lib/autoproj/package_managers/pacman_manager.rb +2 -3
- data/lib/autoproj/package_managers/pip_manager.rb +30 -28
- data/lib/autoproj/package_managers/pkg_manager.rb +3 -4
- data/lib/autoproj/package_managers/port_manager.rb +2 -3
- data/lib/autoproj/package_managers/shell_script_manager.rb +47 -25
- data/lib/autoproj/package_managers/unknown_os_manager.rb +5 -8
- data/lib/autoproj/package_managers/yum_manager.rb +12 -15
- data/lib/autoproj/package_managers/zypper_manager.rb +11 -14
- data/lib/autoproj/package_manifest.rb +28 -74
- data/lib/autoproj/package_selection.rb +187 -187
- data/lib/autoproj/package_set.rb +145 -114
- data/lib/autoproj/python.rb +297 -0
- data/lib/autoproj/query_base.rb +20 -14
- data/lib/autoproj/reporter.rb +19 -19
- data/lib/autoproj/repository_managers/apt.rb +102 -68
- data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
- data/lib/autoproj/ros_condition_parser.rb +84 -0
- data/lib/autoproj/ros_package_manifest.rb +125 -0
- data/lib/autoproj/shell_completion.rb +16 -13
- data/lib/autoproj/source_package_query.rb +29 -36
- data/lib/autoproj/system.rb +32 -21
- data/lib/autoproj/test.rb +131 -106
- data/lib/autoproj/variable_expansion.rb +10 -10
- data/lib/autoproj/vcs_definition.rb +53 -37
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +143 -108
- data/lib/autoproj/zsh_completion.rb +8 -9
- data/lib/autoproj.rb +55 -53
- data/samples/autoproj/init.rb +1 -2
- metadata +86 -65
- data/.travis.yml +0 -22
@@ -33,12 +33,14 @@ module Autoproj
|
|
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:
|
37
|
-
|
36
|
+
def initialize(type, url, vcs_options, from: nil, raw: [], history: [])
|
37
|
+
unless raw.respond_to?(:to_ary)
|
38
38
|
raise ArgumentError, "wrong format for the raw field (#{raw.inspect})"
|
39
39
|
end
|
40
40
|
|
41
|
-
@type
|
41
|
+
@type = type
|
42
|
+
@url = url
|
43
|
+
@options = vcs_options
|
42
44
|
if type != "none" && type != "local" && !Autobuild.respond_to?(type)
|
43
45
|
raise ConfigError.new, "version control #{type} is unknown to autoproj"
|
44
46
|
end
|
@@ -49,17 +51,17 @@ module Autoproj
|
|
49
51
|
|
50
52
|
# Create a null VCS object
|
51
53
|
def self.none
|
52
|
-
from_raw(type:
|
54
|
+
from_raw({ type: "none" })
|
53
55
|
end
|
54
56
|
|
55
57
|
# Whether there is actually a version control definition
|
56
58
|
def none?
|
57
|
-
@type ==
|
59
|
+
@type == "none"
|
58
60
|
end
|
59
61
|
|
60
62
|
# Whether this points to a local directory
|
61
63
|
def local?
|
62
|
-
@type ==
|
64
|
+
@type == "local"
|
63
65
|
end
|
64
66
|
|
65
67
|
# Converts self to a Hash description that could be passed to {.from_raw}
|
@@ -83,7 +85,7 @@ module Autoproj
|
|
83
85
|
if !new.has_key?(:type) || (type == new[:type])
|
84
86
|
new = to_hash.merge(new)
|
85
87
|
new_raw = self.raw + raw
|
86
|
-
new_history =
|
88
|
+
new_history = history
|
87
89
|
end
|
88
90
|
self.class.from_raw(new, from: from, history: new_history, raw: new_raw)
|
89
91
|
end
|
@@ -135,15 +137,15 @@ module Autoproj
|
|
135
137
|
raise ArgumentError, "invalid syntax"
|
136
138
|
elsif plain.size == 1
|
137
139
|
short_url = plain.first
|
138
|
-
vcs, *url = short_url.split(
|
140
|
+
vcs, *url = short_url.split(":")
|
139
141
|
|
140
142
|
# Check if VCS is a known version control system or source handler
|
141
143
|
# shortcut. If it is not, look for a local directory called
|
142
144
|
# short_url
|
143
145
|
if Autobuild.respond_to?(vcs)
|
144
|
-
spec.merge!(type: vcs, url: url.join(
|
146
|
+
spec.merge!(type: vcs, url: url.join(":"))
|
145
147
|
elsif Autoproj.has_source_handler?(vcs)
|
146
|
-
spec = Autoproj.call_source_handler(vcs, url.join(
|
148
|
+
spec = Autoproj.call_source_handler(vcs, url.join(":"), spec)
|
147
149
|
else
|
148
150
|
source_dir =
|
149
151
|
if Pathname.new(short_url).absolute?
|
@@ -151,18 +153,22 @@ module Autoproj
|
|
151
153
|
elsif base_dir
|
152
154
|
File.expand_path(short_url, base_dir)
|
153
155
|
else
|
154
|
-
raise ArgumentError,
|
156
|
+
raise ArgumentError,
|
157
|
+
"VCS path '#{short_url}' is relative and no "\
|
158
|
+
"base_dir was given"
|
155
159
|
end
|
156
|
-
|
157
|
-
raise ArgumentError,
|
160
|
+
unless File.directory?(source_dir)
|
161
|
+
raise ArgumentError,
|
162
|
+
"'#{short_url}' is neither a remote source "\
|
163
|
+
"specification, nor an existing local directory"
|
158
164
|
end
|
159
|
-
spec.merge!(type:
|
165
|
+
spec.merge!(type: "local", url: source_dir)
|
160
166
|
end
|
161
167
|
end
|
162
168
|
|
163
169
|
spec, vcs_options = Kernel.filter_options spec, type: nil, url: nil
|
164
170
|
spec.merge!(vcs_options)
|
165
|
-
|
171
|
+
unless spec[:url]
|
166
172
|
# Verify that none of the keys are source handlers. If it is the
|
167
173
|
# case, convert
|
168
174
|
filtered_spec = Hash.new
|
@@ -182,7 +188,7 @@ module Autoproj
|
|
182
188
|
#
|
183
189
|
# Converts a raw spec (a hash, really) into a nicely formatted string
|
184
190
|
def self.raw_spec_to_s(spec)
|
185
|
-
"{ #{spec.sort_by(&:first).map { |k, v| "#{k}: #{v}" }.join(
|
191
|
+
"{ #{spec.sort_by(&:first).map { |k, v| "#{k}: #{v}" }.join(', ')} }"
|
186
192
|
end
|
187
193
|
|
188
194
|
# Converts a 'raw' VCS representation to a normalized hash.
|
@@ -195,21 +201,31 @@ module Autoproj
|
|
195
201
|
# @return [VCSDefinition]
|
196
202
|
# @raise ArgumentError if the raw specification does not match an
|
197
203
|
# expected format
|
198
|
-
def self.from_raw(spec, from: nil, raw:
|
204
|
+
def self.from_raw(spec, from: nil, raw: [], history: [])
|
199
205
|
normalized_spec = normalize_vcs_hash(spec)
|
200
|
-
|
201
|
-
raise ArgumentError,
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
+
unless (type = normalized_spec.delete(:type))
|
207
|
+
raise ArgumentError,
|
208
|
+
"the source specification #{raw_spec_to_s(spec)} normalizes "\
|
209
|
+
"into #{raw_spec_to_s(normalized_spec)}, "\
|
210
|
+
"which does not have a VCS type"
|
211
|
+
end
|
212
|
+
|
213
|
+
if !(url = normalized_spec.delete(:url)) && type != "none"
|
214
|
+
raise ArgumentError,
|
215
|
+
"the source specification #{raw_spec_to_s(spec)} normalizes "\
|
216
|
+
"into #{raw_spec_to_s(normalized_spec)}, "\
|
217
|
+
"which does not have a URL. "\
|
218
|
+
"Only VCS of type 'none' do not require one"
|
206
219
|
end
|
207
220
|
|
208
|
-
VCSDefinition.new(
|
221
|
+
VCSDefinition.new(
|
222
|
+
type, url, normalized_spec, from: from, history: history, raw: raw
|
223
|
+
)
|
209
224
|
end
|
210
225
|
|
211
226
|
def ==(other_vcs)
|
212
|
-
return false
|
227
|
+
return false unless other_vcs.kind_of?(VCSDefinition)
|
228
|
+
|
213
229
|
if local?
|
214
230
|
other_vcs.local? && url == other_vcs.url
|
215
231
|
elsif other_vcs.local?
|
@@ -233,22 +249,21 @@ module Autoproj
|
|
233
249
|
to_hash == other_vcs.to_hash
|
234
250
|
end
|
235
251
|
|
236
|
-
ABSOLUTE_PATH_OR_URI = /^([\w+]+:\/)?\/|^[:\w]
|
252
|
+
ABSOLUTE_PATH_OR_URI = /^([\w+]+:\/)?\/|^[:\w]+@|^(\w+@)?[\w.-]+:/
|
237
253
|
|
238
254
|
def self.to_absolute_url(url, root_dir)
|
239
|
-
if url && url !~ ABSOLUTE_PATH_OR_URI
|
240
|
-
url = File.expand_path(url, root_dir)
|
241
|
-
end
|
255
|
+
url = File.expand_path(url, root_dir) if url && url !~ ABSOLUTE_PATH_OR_URI
|
242
256
|
url
|
243
257
|
end
|
244
258
|
|
245
259
|
# Whether the underlying package needs to be imported
|
246
260
|
def needs_import?
|
247
|
-
type !=
|
261
|
+
type != "none" && type != "local"
|
248
262
|
end
|
249
263
|
|
250
264
|
def overrides_key
|
251
265
|
return if none?
|
266
|
+
|
252
267
|
if local?
|
253
268
|
"local:#{url}"
|
254
269
|
else
|
@@ -261,7 +276,7 @@ module Autoproj
|
|
261
276
|
#
|
262
277
|
# @return [Autobuild::Importer,nil] the autobuild importer
|
263
278
|
def create_autobuild_importer
|
264
|
-
return
|
279
|
+
return unless needs_import?
|
265
280
|
|
266
281
|
importer = Autobuild.send(type, url, options)
|
267
282
|
if importer.respond_to?(:declare_alternate_repository)
|
@@ -269,6 +284,7 @@ module Autoproj
|
|
269
284
|
package_set = entry.package_set
|
270
285
|
vcs = entry.vcs
|
271
286
|
next if !package_set || package_set.main?
|
287
|
+
|
272
288
|
importer.declare_alternate_repository(package_set.name, vcs.url, vcs.options)
|
273
289
|
end
|
274
290
|
end
|
@@ -281,8 +297,8 @@ module Autoproj
|
|
281
297
|
"none"
|
282
298
|
else
|
283
299
|
desc = "#{type}:#{url}"
|
284
|
-
|
285
|
-
desc = "#{desc} #{options.to_a.sort_by { |key, _| key.to_s }.map { |key, value| "#{key}=#{value}" }.join(
|
300
|
+
unless options.empty?
|
301
|
+
desc = "#{desc} #{options.to_a.sort_by { |key, _| key.to_s }.map { |key, value| "#{key}=#{value}" }.join(' ')}"
|
286
302
|
end
|
287
303
|
desc
|
288
304
|
end
|
@@ -304,10 +320,10 @@ module Autoproj
|
|
304
320
|
# definition as a hash
|
305
321
|
def self.call_source_handler(vcs, url, options)
|
306
322
|
handler = @custom_source_handlers[vcs.to_s]
|
307
|
-
if
|
308
|
-
|
323
|
+
if handler
|
324
|
+
handler.call(url, **options)
|
309
325
|
else
|
310
|
-
|
326
|
+
raise ArgumentError, "there is no source handler for #{vcs}"
|
311
327
|
end
|
312
328
|
end
|
313
329
|
|
@@ -333,7 +349,7 @@ module Autoproj
|
|
333
349
|
# @yieldparam [Hash] the rest of the VCS hash
|
334
350
|
# @return [Hash] a VCS hash with the information expanded
|
335
351
|
def self.add_source_handler(name, &handler)
|
336
|
-
@custom_source_handlers[name.to_s] =
|
352
|
+
@custom_source_handlers[name.to_s] = handler
|
337
353
|
end
|
338
354
|
|
339
355
|
# Deregister a source handler defined with {.add_source_handler}
|
data/lib/autoproj/version.rb
CHANGED