autoproj 2.14.0 → 2.15.0
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 +22 -22
- data/bin/alocate +4 -4
- data/bin/alog +5 -7
- data/bin/amake +4 -4
- data/bin/aup +4 -4
- data/bin/autoproj +3 -3
- data/bin/autoproj_bootstrap +185 -182
- data/bin/autoproj_bootstrap.in +7 -8
- data/bin/autoproj_install +184 -181
- data/bin/autoproj_install.in +6 -7
- data/lib/autoproj/aruba_minitest.rb +6 -11
- data/lib/autoproj/autobuild.rb +5 -6
- data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
- data/lib/autoproj/autobuild_extensions/dsl.rb +38 -34
- data/lib/autoproj/autobuild_extensions/git.rb +27 -26
- data/lib/autoproj/autobuild_extensions/package.rb +23 -22
- 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 +213 -204
- 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 +45 -39
- 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 +35 -37
- data/lib/autoproj/cli/utility.rb +11 -10
- 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 +77 -84
- data/lib/autoproj/environment.rb +28 -13
- 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 +132 -130
- 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 +511 -506
- data/lib/autoproj/ops/import.rb +73 -63
- data/lib/autoproj/ops/install.rb +178 -174
- 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 +10 -10
- data/lib/autoproj/package_managers/bundler_manager.rb +147 -111
- 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 +20 -22
- 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 +32 -22
- 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 +27 -26
- data/lib/autoproj/package_selection.rb +187 -187
- data/lib/autoproj/package_set.rb +127 -113
- data/lib/autoproj/python.rb +55 -55
- data/lib/autoproj/query_base.rb +20 -14
- data/lib/autoproj/reporter.rb +19 -19
- data/lib/autoproj/repository_managers/apt.rb +101 -67
- data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
- 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 +127 -104
- data/lib/autoproj/variable_expansion.rb +7 -9
- data/lib/autoproj/vcs_definition.rb +35 -32
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +123 -107
- data/lib/autoproj/zsh_completion.rb +8 -9
- data/lib/autoproj.rb +53 -55
- data/samples/autoproj/init.rb +1 -2
- metadata +53 -51
- data/.travis.yml +0 -24
@@ -32,17 +32,15 @@ module Autoproj
|
|
32
32
|
# If the values listed in +definitions+ also contain configuration
|
33
33
|
# variables, they do not get expanded
|
34
34
|
def self.single_expansion(data, definitions)
|
35
|
-
|
36
|
-
return data
|
37
|
-
end
|
35
|
+
return data unless data.respond_to?(:to_str)
|
38
36
|
|
39
37
|
data = data.gsub(/(.|^)\$(\w+)/) do |constant_name|
|
40
38
|
prefix = constant_name[0, 1]
|
41
|
-
if prefix == "\\"
|
42
|
-
|
43
|
-
end
|
39
|
+
next(constant_name[1..-1]) if prefix == "\\"
|
40
|
+
|
44
41
|
if prefix == "$"
|
45
|
-
prefix
|
42
|
+
prefix = ""
|
43
|
+
constant_name = constant_name[1..-1]
|
46
44
|
else
|
47
45
|
constant_name = constant_name[2..-1]
|
48
46
|
end
|
@@ -75,6 +73,7 @@ module Autoproj
|
|
75
73
|
if contains_expansion?(value)
|
76
74
|
raise ConfigError.new, "some expansions are not defined in #{value.inspect}"
|
77
75
|
end
|
76
|
+
|
78
77
|
value
|
79
78
|
end
|
80
79
|
end
|
@@ -97,7 +96,7 @@ module Autoproj
|
|
97
96
|
# refers to variables defined in +constants+
|
98
97
|
def self.resolve_constant_definitions(constants, definitions = Hash.new)
|
99
98
|
definitions = definitions.merge(constants)
|
100
|
-
|
99
|
+
|
101
100
|
all_resolutions = Hash.new
|
102
101
|
resolution_cache = Hash.new
|
103
102
|
constants.each do |key, value|
|
@@ -106,4 +105,3 @@ module Autoproj
|
|
106
105
|
all_resolutions
|
107
106
|
end
|
108
107
|
end
|
109
|
-
|
@@ -34,11 +34,13 @@ module Autoproj
|
|
34
34
|
RawEntry = Struct.new :package_set, :file, :vcs
|
35
35
|
|
36
36
|
def initialize(type, url, vcs_options, from: nil, raw: [], history: [])
|
37
|
-
|
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?
|
@@ -155,18 +157,18 @@ module Autoproj
|
|
155
157
|
"VCS path '#{short_url}' is relative and no "\
|
156
158
|
"base_dir was given"
|
157
159
|
end
|
158
|
-
|
160
|
+
unless File.directory?(source_dir)
|
159
161
|
raise ArgumentError,
|
160
162
|
"'#{short_url}' is neither a remote source "\
|
161
|
-
|
163
|
+
"specification, nor an existing local directory"
|
162
164
|
end
|
163
|
-
spec.merge!(type:
|
165
|
+
spec.merge!(type: "local", url: source_dir)
|
164
166
|
end
|
165
167
|
end
|
166
168
|
|
167
169
|
spec, vcs_options = Kernel.filter_options spec, type: nil, url: nil
|
168
170
|
spec.merge!(vcs_options)
|
169
|
-
|
171
|
+
unless spec[:url]
|
170
172
|
# Verify that none of the keys are source handlers. If it is the
|
171
173
|
# case, convert
|
172
174
|
filtered_spec = Hash.new
|
@@ -186,7 +188,7 @@ module Autoproj
|
|
186
188
|
#
|
187
189
|
# Converts a raw spec (a hash, really) into a nicely formatted string
|
188
190
|
def self.raw_spec_to_s(spec)
|
189
|
-
"{ #{spec.sort_by(&:first).map { |k, v| "#{k}: #{v}" }.join(
|
191
|
+
"{ #{spec.sort_by(&:first).map { |k, v| "#{k}: #{v}" }.join(', ')} }"
|
190
192
|
end
|
191
193
|
|
192
194
|
# Converts a 'raw' VCS representation to a normalized hash.
|
@@ -201,19 +203,19 @@ module Autoproj
|
|
201
203
|
# expected format
|
202
204
|
def self.from_raw(spec, from: nil, raw: [], history: [])
|
203
205
|
normalized_spec = normalize_vcs_hash(spec)
|
204
|
-
|
206
|
+
unless (type = normalized_spec.delete(:type))
|
205
207
|
raise ArgumentError,
|
206
208
|
"the source specification #{raw_spec_to_s(spec)} normalizes "\
|
207
209
|
"into #{raw_spec_to_s(normalized_spec)}, "\
|
208
|
-
|
210
|
+
"which does not have a VCS type"
|
209
211
|
end
|
210
212
|
|
211
|
-
if !(url = normalized_spec.delete(:url)) && type !=
|
213
|
+
if !(url = normalized_spec.delete(:url)) && type != "none"
|
212
214
|
raise ArgumentError,
|
213
215
|
"the source specification #{raw_spec_to_s(spec)} normalizes "\
|
214
216
|
"into #{raw_spec_to_s(normalized_spec)}, "\
|
215
|
-
|
216
|
-
|
217
|
+
"which does not have a URL. "\
|
218
|
+
"Only VCS of type 'none' do not require one"
|
217
219
|
end
|
218
220
|
|
219
221
|
VCSDefinition.new(
|
@@ -222,7 +224,8 @@ module Autoproj
|
|
222
224
|
end
|
223
225
|
|
224
226
|
def ==(other_vcs)
|
225
|
-
return false
|
227
|
+
return false unless other_vcs.kind_of?(VCSDefinition)
|
228
|
+
|
226
229
|
if local?
|
227
230
|
other_vcs.local? && url == other_vcs.url
|
228
231
|
elsif other_vcs.local?
|
@@ -246,22 +249,21 @@ module Autoproj
|
|
246
249
|
to_hash == other_vcs.to_hash
|
247
250
|
end
|
248
251
|
|
249
|
-
ABSOLUTE_PATH_OR_URI = /^([\w+]+:\/)?\/|^[:\w]
|
252
|
+
ABSOLUTE_PATH_OR_URI = /^([\w+]+:\/)?\/|^[:\w]+@|^(\w+@)?[\w.-]+:/
|
250
253
|
|
251
254
|
def self.to_absolute_url(url, root_dir)
|
252
|
-
if url && url !~ ABSOLUTE_PATH_OR_URI
|
253
|
-
url = File.expand_path(url, root_dir)
|
254
|
-
end
|
255
|
+
url = File.expand_path(url, root_dir) if url && url !~ ABSOLUTE_PATH_OR_URI
|
255
256
|
url
|
256
257
|
end
|
257
258
|
|
258
259
|
# Whether the underlying package needs to be imported
|
259
260
|
def needs_import?
|
260
|
-
type !=
|
261
|
+
type != "none" && type != "local"
|
261
262
|
end
|
262
263
|
|
263
264
|
def overrides_key
|
264
265
|
return if none?
|
266
|
+
|
265
267
|
if local?
|
266
268
|
"local:#{url}"
|
267
269
|
else
|
@@ -274,7 +276,7 @@ module Autoproj
|
|
274
276
|
#
|
275
277
|
# @return [Autobuild::Importer,nil] the autobuild importer
|
276
278
|
def create_autobuild_importer
|
277
|
-
return
|
279
|
+
return unless needs_import?
|
278
280
|
|
279
281
|
importer = Autobuild.send(type, url, options)
|
280
282
|
if importer.respond_to?(:declare_alternate_repository)
|
@@ -282,6 +284,7 @@ module Autoproj
|
|
282
284
|
package_set = entry.package_set
|
283
285
|
vcs = entry.vcs
|
284
286
|
next if !package_set || package_set.main?
|
287
|
+
|
285
288
|
importer.declare_alternate_repository(package_set.name, vcs.url, vcs.options)
|
286
289
|
end
|
287
290
|
end
|
@@ -294,8 +297,8 @@ module Autoproj
|
|
294
297
|
"none"
|
295
298
|
else
|
296
299
|
desc = "#{type}:#{url}"
|
297
|
-
|
298
|
-
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(' ')}"
|
299
302
|
end
|
300
303
|
desc
|
301
304
|
end
|
@@ -317,10 +320,10 @@ module Autoproj
|
|
317
320
|
# definition as a hash
|
318
321
|
def self.call_source_handler(vcs, url, options)
|
319
322
|
handler = @custom_source_handlers[vcs.to_s]
|
320
|
-
if
|
321
|
-
raise ArgumentError, "there is no source handler for #{vcs}"
|
322
|
-
else
|
323
|
+
if handler
|
323
324
|
handler.call(url, **options)
|
325
|
+
else
|
326
|
+
raise ArgumentError, "there is no source handler for #{vcs}"
|
324
327
|
end
|
325
328
|
end
|
326
329
|
|
@@ -346,7 +349,7 @@ module Autoproj
|
|
346
349
|
# @yieldparam [Hash] the rest of the VCS hash
|
347
350
|
# @return [Hash] a VCS hash with the information expanded
|
348
351
|
def self.add_source_handler(name, &handler)
|
349
|
-
@custom_source_handlers[name.to_s] =
|
352
|
+
@custom_source_handlers[name.to_s] = handler
|
350
353
|
end
|
351
354
|
|
352
355
|
# Deregister a source handler defined with {.add_source_handler}
|
data/lib/autoproj/version.rb
CHANGED