autoproj 2.12.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 +6 -7
- data/bin/amake +4 -4
- data/bin/aup +4 -4
- data/bin/autoproj +2 -2
- data/bin/autoproj_bootstrap +186 -183
- data/bin/autoproj_bootstrap.in +7 -8
- data/bin/autoproj_install +185 -182
- 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 +61 -44
- 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 +27 -27
- data/lib/autoproj/cli/bootstrap.rb +14 -16
- data/lib/autoproj/cli/build.rb +18 -10
- data/lib/autoproj/cli/cache.rb +51 -8
- 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 +18 -13
- 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 +48 -55
- 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 +104 -51
- 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 -85
- 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 +145 -135
- 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 +64 -53
- data/lib/autoproj/ops/cached_env.rb +7 -6
- data/lib/autoproj/ops/configuration.rb +511 -506
- data/lib/autoproj/ops/import.rb +90 -61
- data/lib/autoproj/ops/install.rb +179 -175
- 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 +46 -31
- data/lib/autoproj/package_managers/bundler_manager.rb +156 -118
- 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 +37 -27
- 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 +66 -36
- 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 +66 -53
- data/lib/autoproj/package_selection.rb +187 -187
- data/lib/autoproj/package_set.rb +128 -114
- data/lib/autoproj/python.rb +285 -0
- 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 +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 +162 -117
- data/lib/autoproj/zsh_completion.rb +8 -9
- data/lib/autoproj.rb +53 -53
- data/samples/autoproj/init.rb +1 -2
- metadata +62 -72
- data/.travis.yml +0 -22
data/lib/autoproj/cli/show.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "autoproj"
|
2
|
+
require "autoproj/cli/inspection_tool"
|
3
3
|
|
4
4
|
module Autoproj
|
5
5
|
module CLI
|
@@ -17,7 +17,8 @@ module Autoproj
|
|
17
17
|
source_packages, osdep_packages, * =
|
18
18
|
finalize_setup(user_selection, recursive: recursive, non_imported_packages: :return)
|
19
19
|
else
|
20
|
-
source_packages
|
20
|
+
source_packages = []
|
21
|
+
osdep_packages = []
|
21
22
|
end
|
22
23
|
|
23
24
|
all_matching_osdeps = osdep_packages.map { |pkg| [pkg, true] }
|
@@ -28,7 +29,7 @@ module Autoproj
|
|
28
29
|
end
|
29
30
|
|
30
31
|
if package_set_names.empty? && source_packages.empty? && all_matching_osdeps.empty?
|
31
|
-
Autoproj.error "no package set, packages or OS packages match #{user_selection.join(
|
32
|
+
Autoproj.error "no package set, packages or OS packages match #{user_selection.join(' ')}"
|
32
33
|
return
|
33
34
|
elsif !source_packages.empty? || !all_matching_osdeps.empty?
|
34
35
|
ws.load_all_available_package_manifests
|
@@ -47,7 +48,7 @@ module Autoproj
|
|
47
48
|
puts "pkg #{name}"
|
48
49
|
end
|
49
50
|
all_matching_osdeps.each do |name, sel|
|
50
|
-
puts "osdep #{name} (#{sel ?
|
51
|
+
puts "osdep #{name} (#{sel ? 'not selected' : 'selected'})"
|
51
52
|
end
|
52
53
|
else
|
53
54
|
package_set_names.each do |pkg_set_name|
|
@@ -65,17 +66,17 @@ module Autoproj
|
|
65
66
|
def display_package_set(name, package_per_line: 8)
|
66
67
|
puts Autoproj.color("package set #{name}", :bold)
|
67
68
|
pkg_set = ws.manifest.find_package_set(name)
|
68
|
-
|
69
|
+
unless File.directory?(pkg_set.raw_local_dir)
|
69
70
|
puts Autobuild.color(" this package set is not checked out", :magenta)
|
70
71
|
end
|
71
|
-
if overrides_key = pkg_set.vcs.overrides_key
|
72
|
+
if (overrides_key = pkg_set.vcs.overrides_key)
|
72
73
|
puts " overrides key: pkg_set:#{overrides_key}"
|
73
74
|
end
|
74
|
-
if pkg_set.raw_local_dir
|
75
|
+
if pkg_set.raw_local_dir == pkg_set.user_local_dir
|
76
|
+
puts " path: #{pkg_set.raw_local_dir}"
|
77
|
+
else
|
75
78
|
puts " checkout dir: #{pkg_set.raw_local_dir}"
|
76
79
|
puts " symlinked to: #{pkg_set.user_local_dir}"
|
77
|
-
else
|
78
|
-
puts " path: #{pkg_set.raw_local_dir}"
|
79
80
|
end
|
80
81
|
|
81
82
|
puts " version control information:"
|
@@ -86,20 +87,20 @@ module Autoproj
|
|
86
87
|
if size == 0
|
87
88
|
puts " does not have any packages"
|
88
89
|
else
|
89
|
-
|
90
|
+
plural = metapackage.size > 1 ? "s" : ""
|
91
|
+
puts " refers to #{metapackage.size} package#{plural}"
|
90
92
|
end
|
91
93
|
names = metapackage.each_package.map(&:name).sort
|
92
94
|
package_lines = names.each_slice(package_per_line).map do |*line_names|
|
93
95
|
line_names.join(", ")
|
94
96
|
end
|
95
|
-
puts "
|
96
|
-
|
97
|
+
puts " #{package_lines.join(",\n ")}"
|
97
98
|
end
|
98
99
|
|
99
100
|
def display_source_package(pkg_name, default_packages, revdeps, options = Hash.new)
|
100
101
|
puts Autoproj.color("source package #{pkg_name}", :bold)
|
101
102
|
pkg = ws.manifest.find_autobuild_package(pkg_name)
|
102
|
-
|
103
|
+
unless File.directory?(pkg.srcdir)
|
103
104
|
puts Autobuild.color(" this package is not checked out yet, the dependency information will probably be incomplete", :magenta)
|
104
105
|
end
|
105
106
|
puts " source definition"
|
@@ -109,9 +110,9 @@ module Autoproj
|
|
109
110
|
display_vcs(vcs)
|
110
111
|
display_common_information(pkg_name, default_packages, revdeps)
|
111
112
|
|
112
|
-
puts " directly depends on: #{pkg.dependencies.sort.join(
|
113
|
-
puts " optionally depends on: #{pkg.optional_dependencies.sort.join(
|
114
|
-
puts " dependencies on OS packages: #{pkg.os_packages.sort.join(
|
113
|
+
puts " directly depends on: #{pkg.dependencies.sort.join(', ')}"
|
114
|
+
puts " optionally depends on: #{pkg.optional_dependencies.sort.join(', ')}"
|
115
|
+
puts " dependencies on OS packages: #{pkg.os_packages.sort.join(', ')}"
|
115
116
|
if options[:env]
|
116
117
|
puts " environment"
|
117
118
|
pkg.resolved_env.sort_by(&:first).each do |name, v|
|
@@ -140,14 +141,15 @@ module Autoproj
|
|
140
141
|
if entry.package_set && entry.file
|
141
142
|
"#{entry.package_set.name} (#{entry.file})"
|
142
143
|
elsif entry.package_set
|
143
|
-
|
144
|
+
entry.package_set.name.to_s
|
144
145
|
elsif entry.file
|
145
|
-
|
146
|
+
entry.file.to_s
|
146
147
|
end
|
147
148
|
|
148
149
|
title = if first
|
149
150
|
"first match: in #{entry_name}"
|
150
|
-
else
|
151
|
+
else
|
152
|
+
"overriden in #{entry_name}"
|
151
153
|
end
|
152
154
|
first = false
|
153
155
|
fragments << [title, vcs_to_array(entry.vcs)]
|
@@ -171,26 +173,25 @@ module Autoproj
|
|
171
173
|
puts Autoproj.color("the osdep '#{pkg_name}'", :bold)
|
172
174
|
begin
|
173
175
|
ws.os_package_resolver.resolve_os_packages([pkg_name]).each do |manager_name, packages|
|
174
|
-
puts " #{manager_name}: #{packages.map { |*subnames| subnames.join(
|
176
|
+
puts " #{manager_name}: #{packages.map { |*subnames| subnames.join(' ') }.join(', ')}"
|
175
177
|
end
|
176
178
|
rescue MissingOSDep => e
|
177
179
|
puts " #{e.message}"
|
178
180
|
end
|
179
181
|
|
180
|
-
|
182
|
+
unless selected
|
181
183
|
puts " is present, but won't be used by autoproj for '#{pkg_name}'"
|
182
184
|
end
|
183
185
|
|
184
186
|
entries = ws.os_package_resolver.all_definitions[pkg_name]
|
185
187
|
puts " #{entries.inject(0) { |c, (files, _)| c + files.size }} matching entries:"
|
186
188
|
entries.each do |files, entry|
|
187
|
-
puts " in #{files.join(
|
189
|
+
puts " in #{files.join(', ')}:"
|
188
190
|
lines = YAML.dump(entry).split("\n")
|
189
|
-
lines[0] = lines[0].gsub(/---\s*/,
|
190
|
-
if lines[0].empty?
|
191
|
-
|
192
|
-
|
193
|
-
puts " " + lines.join("\n ")
|
191
|
+
lines[0] = lines[0].gsub(/---\s*/, "")
|
192
|
+
lines.shift if lines[0].empty?
|
193
|
+
|
194
|
+
puts " #{lines.join("\n ")}"
|
194
195
|
end
|
195
196
|
display_common_information(pkg_name, default_packages, revdeps)
|
196
197
|
end
|
@@ -203,14 +204,12 @@ module Autoproj
|
|
203
204
|
else
|
204
205
|
layout_selection = layout_selection.dup
|
205
206
|
layout_selection.delete(pkg_name)
|
206
|
-
puts " is directly selected by the manifest via #{layout_selection.to_a.join(
|
207
|
+
puts " is directly selected by the manifest via #{layout_selection.to_a.join(', ')}"
|
207
208
|
end
|
208
209
|
else
|
209
210
|
puts " is not directly selected by the manifest"
|
210
211
|
end
|
211
|
-
if ws.manifest.ignored?(pkg_name)
|
212
|
-
puts " is ignored"
|
213
|
-
end
|
212
|
+
puts " is ignored" if ws.manifest.ignored?(pkg_name)
|
214
213
|
if ws.manifest.excluded?(pkg_name)
|
215
214
|
puts " is excluded: #{Autoproj.manifest.exclusion_reason(pkg_name)}"
|
216
215
|
end
|
@@ -220,8 +219,8 @@ module Autoproj
|
|
220
219
|
if pkg_revdeps.empty?
|
221
220
|
puts " no reverse dependencies"
|
222
221
|
else
|
223
|
-
puts " direct reverse dependencies: #{pkg_revdeps.sort.join(
|
224
|
-
puts " recursive reverse dependencies: #{all_revdeps.sort.join(
|
222
|
+
puts " direct reverse dependencies: #{pkg_revdeps.sort.join(', ')}"
|
223
|
+
puts " recursive reverse dependencies: #{all_revdeps.sort.join(', ')}"
|
225
224
|
end
|
226
225
|
|
227
226
|
selections = Set.new
|
@@ -232,7 +231,7 @@ module Autoproj
|
|
232
231
|
end
|
233
232
|
end
|
234
233
|
|
235
|
-
|
234
|
+
unless selections.empty?
|
236
235
|
puts " selected by way of"
|
237
236
|
selections.each do |root_pkg|
|
238
237
|
paths = find_selection_path(root_pkg, pkg_name)
|
@@ -240,7 +239,7 @@ module Autoproj
|
|
240
239
|
puts " FAILED"
|
241
240
|
else
|
242
241
|
paths.sort.uniq.each do |p|
|
243
|
-
puts " #{p.join(
|
242
|
+
puts " #{p.join('>')}"
|
244
243
|
end
|
245
244
|
end
|
246
245
|
end
|
@@ -248,33 +247,30 @@ module Autoproj
|
|
248
247
|
end
|
249
248
|
|
250
249
|
def find_selection_path(from, to)
|
251
|
-
if from == to
|
252
|
-
return [[from]]
|
253
|
-
end
|
250
|
+
return [[from]] if from == to
|
254
251
|
|
255
252
|
all_paths = Array.new
|
256
253
|
ws.manifest.resolve_package_name(from).each do |pkg_type, pkg_name|
|
257
254
|
next if pkg_type != :package
|
258
255
|
|
259
256
|
path = if pkg_name == from then []
|
260
|
-
else
|
257
|
+
else
|
258
|
+
[pkg_name]
|
261
259
|
end
|
262
260
|
|
263
261
|
pkg = ws.manifest.find_autobuild_package(pkg_name)
|
264
262
|
pkg.dependencies.each do |dep_pkg_name|
|
265
|
-
if result = find_selection_path(dep_pkg_name, to)
|
263
|
+
if (result = find_selection_path(dep_pkg_name, to))
|
266
264
|
all_paths.concat(result.map { |p| path + p })
|
267
265
|
end
|
268
266
|
end
|
269
|
-
if pkg.os_packages.include?(to)
|
270
|
-
all_paths << (path + [to])
|
271
|
-
end
|
267
|
+
all_paths << (path + [to]) if pkg.os_packages.include?(to)
|
272
268
|
end
|
273
269
|
|
274
270
|
# Now filter common trailing subpaths
|
275
271
|
all_paths = all_paths.sort_by(&:size)
|
276
272
|
filtered_paths = Array.new
|
277
|
-
|
273
|
+
until all_paths.empty?
|
278
274
|
path = all_paths.shift
|
279
275
|
filtered_paths << path
|
280
276
|
size = path.size
|
@@ -288,21 +284,17 @@ module Autoproj
|
|
288
284
|
def vcs_to_array(vcs)
|
289
285
|
if vcs.kind_of?(Hash)
|
290
286
|
options = vcs.dup
|
291
|
-
type = options.delete(
|
292
|
-
url = options.delete(
|
293
|
-
else
|
287
|
+
type = options.delete("type")
|
288
|
+
url = options.delete("url")
|
289
|
+
else
|
294
290
|
options = vcs.options
|
295
291
|
type = vcs.type
|
296
292
|
url = vcs.url
|
297
293
|
end
|
298
294
|
|
299
295
|
fields = []
|
300
|
-
if type
|
301
|
-
|
302
|
-
end
|
303
|
-
if url
|
304
|
-
fields << ['url', url]
|
305
|
-
end
|
296
|
+
fields << ["type", type] if type
|
297
|
+
fields << ["url", url] if url
|
306
298
|
fields = fields.concat(options.to_a.sort_by { |k, _| k.to_s })
|
307
299
|
fields.map do |key, value|
|
308
300
|
if value.respond_to?(:to_str) && File.file?(value) && value =~ /^\//
|
@@ -315,9 +307,10 @@ module Autoproj
|
|
315
307
|
def compute_all_revdeps(pkg_revdeps, revdeps)
|
316
308
|
pkg_revdeps = pkg_revdeps.dup
|
317
309
|
all_revdeps = Array.new
|
318
|
-
|
310
|
+
until pkg_revdeps.empty?
|
319
311
|
parent_name = pkg_revdeps.shift
|
320
312
|
next if all_revdeps.include?(parent_name)
|
313
|
+
|
321
314
|
all_revdeps << parent_name
|
322
315
|
pkg_revdeps.concat(revdeps[parent_name].to_a)
|
323
316
|
end
|
data/lib/autoproj/cli/status.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "autoproj/cli/inspection_tool"
|
2
|
+
require "tty-spinner"
|
3
3
|
|
4
4
|
module Autoproj
|
5
5
|
module CLI
|
@@ -7,27 +7,24 @@ module Autoproj
|
|
7
7
|
def validate_options(packages, options)
|
8
8
|
packages, options = super
|
9
9
|
options[:progress] = Autobuild.progress_display_enabled?
|
10
|
-
if options[:no_deps_shortcut]
|
11
|
-
|
12
|
-
|
13
|
-
if options[:deps].nil? && packages.empty?
|
14
|
-
options[:deps] = true
|
15
|
-
end
|
16
|
-
return packages, options
|
10
|
+
options[:deps] = false if options[:no_deps_shortcut]
|
11
|
+
options[:deps] = true if options[:deps].nil? && packages.empty?
|
12
|
+
[packages, options]
|
17
13
|
end
|
18
14
|
|
19
15
|
def run(user_selection, options = Hash.new)
|
20
16
|
initialize_and_load(mainline: options[:mainline])
|
21
17
|
packages, *, config_selected = finalize_setup(
|
22
18
|
user_selection,
|
23
|
-
recursive: options[:deps]
|
19
|
+
recursive: options[:deps]
|
20
|
+
)
|
24
21
|
|
25
22
|
if options[:config].nil?
|
26
23
|
options[:config] = user_selection.empty? || config_selected
|
27
24
|
end
|
28
25
|
|
29
26
|
if packages.empty?
|
30
|
-
Autoproj.error "no packages or OS packages match #{user_selection.join(
|
27
|
+
Autoproj.error "no packages or OS packages match #{user_selection.join(' ')}"
|
31
28
|
return
|
32
29
|
end
|
33
30
|
|
@@ -39,14 +36,15 @@ module Autoproj
|
|
39
36
|
|
40
37
|
if options[:config]
|
41
38
|
pkg_sets = ws.manifest.each_package_set.to_a
|
42
|
-
|
39
|
+
unless pkg_sets.empty?
|
43
40
|
Autoproj.message("autoproj: displaying status of configuration", :bold)
|
44
41
|
display_status(
|
45
42
|
pkg_sets,
|
46
43
|
parallel: options[:parallel],
|
47
44
|
snapshot: options[:snapshot],
|
48
45
|
only_local: options[:only_local],
|
49
|
-
progress: options[:progress]
|
46
|
+
progress: options[:progress]
|
47
|
+
)
|
50
48
|
|
51
49
|
STDERR.puts
|
52
50
|
end
|
@@ -61,7 +59,8 @@ module Autoproj
|
|
61
59
|
parallel: options[:parallel],
|
62
60
|
snapshot: options[:snapshot],
|
63
61
|
only_local: options[:only_local],
|
64
|
-
progress: options[:progress]
|
62
|
+
progress: options[:progress]
|
63
|
+
)
|
65
64
|
end
|
66
65
|
|
67
66
|
def snapshot_overrides_vcs?(importer, vcs, snapshot)
|
@@ -73,7 +72,7 @@ module Autoproj
|
|
73
72
|
end
|
74
73
|
end
|
75
74
|
|
76
|
-
def report_exception(package_status, msg, e)
|
75
|
+
def self.report_exception(package_status, msg, e)
|
77
76
|
package_status.msg << Autoproj.color(" #{msg} (#{e})", :red)
|
78
77
|
if Autobuild.debug
|
79
78
|
package_status.msg.concat(e.backtrace.map do |line|
|
@@ -82,8 +81,8 @@ module Autoproj
|
|
82
81
|
end
|
83
82
|
end
|
84
83
|
|
85
|
-
PackageStatus = Struct.new :msg, :sync, :uncommitted, :local, :remote
|
86
|
-
def status_of_package(package_description, only_local: false, snapshot: false)
|
84
|
+
PackageStatus = Struct.new :msg, :sync, :unexpected, :uncommitted, :local, :remote
|
85
|
+
def self.status_of_package(package_description, only_local: false, snapshot: false)
|
87
86
|
pkg = package_description.autobuild
|
88
87
|
importer = pkg.importer
|
89
88
|
package_status = PackageStatus.new(Array.new, false, false, false, false)
|
@@ -100,8 +99,8 @@ module Autoproj
|
|
100
99
|
return package_status
|
101
100
|
end
|
102
101
|
|
103
|
-
snapshot_useful = [Autobuild::Importer::Status::ADVANCED, Autobuild::Importer::Status::NEEDS_MERGE]
|
104
|
-
|
102
|
+
snapshot_useful = [Autobuild::Importer::Status::ADVANCED, Autobuild::Importer::Status::NEEDS_MERGE]
|
103
|
+
.include?(status.status)
|
105
104
|
if snapshot && snapshot_useful && importer.respond_to?(:snapshot)
|
106
105
|
snapshot_version =
|
107
106
|
begin importer.snapshot(pkg, nil, exact_state: false, only_local: only_local)
|
@@ -113,7 +112,7 @@ module Autoproj
|
|
113
112
|
end
|
114
113
|
if snapshot_overrides_vcs?(importer, package_description.vcs, snapshot_version)
|
115
114
|
non_nil_values = snapshot_version.delete_if { |k, v| !v }
|
116
|
-
package_status.msg << Autoproj.color(" found configuration that contains all local changes: #{non_nil_values.sort_by(&:first).map { |k, v| "#{k}: #{v}" }.join(
|
115
|
+
package_status.msg << Autoproj.color(" found configuration that contains all local changes: #{non_nil_values.sort_by(&:first).map { |k, v| "#{k}: #{v}" }.join(', ')}", :bright_green)
|
117
116
|
package_status.msg << Autoproj.color(" consider adding this to your overrides, or use autoproj versions to do it for you", :bright_green)
|
118
117
|
if snapshot
|
119
118
|
importer.relocate(importer.repository, snapshot_version)
|
@@ -122,6 +121,7 @@ module Autoproj
|
|
122
121
|
end
|
123
122
|
|
124
123
|
status.unexpected_working_copy_state.each do |msg|
|
124
|
+
package_status.unexpected = true
|
125
125
|
package_status.msg << Autoproj.color(" #{msg}", :red, :bold)
|
126
126
|
end
|
127
127
|
|
@@ -162,29 +162,40 @@ module Autoproj
|
|
162
162
|
package_status
|
163
163
|
end
|
164
164
|
|
165
|
-
def each_package_status(
|
166
|
-
|
165
|
+
def each_package_status(
|
166
|
+
packages,
|
167
|
+
parallel: ws.config.parallel_import_level,
|
168
|
+
snapshot: false, only_local: false, progress: nil
|
169
|
+
)
|
170
|
+
unless block_given?
|
171
|
+
return enum_for(
|
172
|
+
__method__, packages,
|
173
|
+
parallel: parallel, snapshot: snapshot, only_local: only_local,
|
174
|
+
progress: progress
|
175
|
+
)
|
176
|
+
end
|
167
177
|
|
168
178
|
result = StatusResult.new
|
169
179
|
|
170
180
|
executor = Concurrent::FixedThreadPool.new(parallel, max_length: 0)
|
171
|
-
interactive, noninteractive =
|
172
|
-
|
173
|
-
end
|
181
|
+
interactive, noninteractive =
|
182
|
+
packages.partition { |pkg| pkg.autobuild.importer&.interactive? }
|
174
183
|
noninteractive = noninteractive.map do |pkg|
|
175
|
-
future = Concurrent::
|
176
|
-
status_of_package(
|
184
|
+
future = Concurrent::Promises.future_on(executor) do
|
185
|
+
Status.status_of_package(
|
186
|
+
pkg, snapshot: snapshot, only_local: only_local
|
187
|
+
)
|
177
188
|
end
|
178
189
|
[pkg, future]
|
179
190
|
end
|
180
191
|
|
181
192
|
(noninteractive + interactive).each do |pkg, future|
|
182
|
-
if future
|
193
|
+
if future
|
183
194
|
if progress
|
184
195
|
wait_timeout = 1
|
185
|
-
|
186
|
-
future.wait(wait_timeout)
|
187
|
-
if future.
|
196
|
+
loop do
|
197
|
+
future.wait!(wait_timeout)
|
198
|
+
if future.resolved?
|
188
199
|
break
|
189
200
|
else
|
190
201
|
wait_timeout = 0.2
|
@@ -193,10 +204,13 @@ module Autoproj
|
|
193
204
|
end
|
194
205
|
end
|
195
206
|
|
196
|
-
|
207
|
+
unless (status = future.value)
|
197
208
|
raise future.reason
|
198
209
|
end
|
199
|
-
else
|
210
|
+
else
|
211
|
+
status = Status.status_of_package(
|
212
|
+
pkg, snapshot: snapshot, only_local: only_local
|
213
|
+
)
|
200
214
|
end
|
201
215
|
|
202
216
|
result.uncommitted ||= status.uncommitted
|
@@ -205,7 +219,6 @@ module Autoproj
|
|
205
219
|
yield(pkg, status)
|
206
220
|
end
|
207
221
|
result
|
208
|
-
|
209
222
|
rescue Interrupt
|
210
223
|
Autoproj.warn "Interrupted, waiting for pending jobs to finish"
|
211
224
|
raise
|
@@ -224,9 +237,9 @@ module Autoproj
|
|
224
237
|
|
225
238
|
if progress
|
226
239
|
progress = lambda do |pkg|
|
227
|
-
|
228
|
-
|
229
|
-
Autoproj.message("#{sync_packages}: #{Autoproj.color(
|
240
|
+
unless spinner
|
241
|
+
unless sync_packages.empty?
|
242
|
+
Autoproj.message("#{sync_packages}: #{Autoproj.color('local and remote are in sync', :green)}")
|
230
243
|
sync_packages = ""
|
231
244
|
end
|
232
245
|
|
@@ -258,12 +271,12 @@ module Autoproj
|
|
258
271
|
next
|
259
272
|
end
|
260
273
|
|
261
|
-
|
262
|
-
Autoproj.message("#{sync_packages}: #{Autoproj.color(
|
274
|
+
unless sync_packages.empty?
|
275
|
+
Autoproj.message("#{sync_packages}: #{Autoproj.color('local and remote are in sync', :green)}")
|
263
276
|
sync_packages = ""
|
264
277
|
end
|
265
278
|
|
266
|
-
STDERR.print
|
279
|
+
STDERR.print
|
267
280
|
|
268
281
|
if status.msg.size == 1
|
269
282
|
Autoproj.message "#{pkg_name}: #{status.msg.first}"
|
@@ -274,12 +287,11 @@ module Autoproj
|
|
274
287
|
end
|
275
288
|
end
|
276
289
|
end
|
277
|
-
|
278
|
-
Autoproj.message("#{sync_packages}: #{Autoproj.color(
|
290
|
+
unless sync_packages.empty?
|
291
|
+
Autoproj.message("#{sync_packages}: #{Autoproj.color('local and remote are in sync', :green)}")
|
279
292
|
end
|
280
|
-
|
293
|
+
result
|
281
294
|
end
|
282
295
|
end
|
283
296
|
end
|
284
297
|
end
|
285
|
-
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require "autoproj"
|
2
|
+
require "autoproj/cli/base"
|
3
|
+
require "autoproj/cli/update"
|
4
|
+
require "autoproj/ops/main_config_switcher"
|
5
|
+
require "autoproj/ops/configuration"
|
6
6
|
|
7
7
|
module Autoproj
|
8
8
|
module CLI
|
@@ -29,4 +29,3 @@ module Autoproj
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
data/lib/autoproj/cli/tag.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "autoproj"
|
2
|
+
require "autoproj/cli/versions"
|
3
|
+
require "autoproj/ops/snapshot"
|
4
|
+
require "autoproj/cli/base"
|
5
5
|
|
6
6
|
module Autoproj
|
7
7
|
module CLI
|
@@ -19,21 +19,23 @@ module Autoproj
|
|
19
19
|
|
20
20
|
versions_file = File.join(
|
21
21
|
Workspace::OVERRIDES_DIR,
|
22
|
-
Versions::DEFAULT_VERSIONS_FILE_BASENAME
|
22
|
+
Versions::DEFAULT_VERSIONS_FILE_BASENAME
|
23
|
+
)
|
23
24
|
|
24
25
|
if tag_name.nil?
|
25
26
|
importer = pkg.importer
|
26
|
-
all_tags = importer.run_git_bare(pkg,
|
27
|
+
all_tags = importer.run_git_bare(pkg, "tag")
|
27
28
|
all_tags.sort.each do |tag|
|
28
29
|
next if tag =~ /\^/
|
30
|
+
|
29
31
|
begin importer.show(pkg, "refs/tags/#{tag}", versions_file)
|
30
|
-
|
32
|
+
puts tag
|
31
33
|
rescue Autobuild::PackageException
|
32
34
|
end
|
33
35
|
end
|
34
36
|
return
|
35
37
|
end
|
36
|
-
|
38
|
+
|
37
39
|
# Check if the tag already exists
|
38
40
|
begin
|
39
41
|
importer.rev_parse(pkg, "refs/tags/#{tag_name}")
|
@@ -42,7 +44,7 @@ module Autoproj
|
|
42
44
|
end
|
43
45
|
|
44
46
|
message = options[:message] ||
|
45
|
-
|
47
|
+
"autoproj created tag #{tag_name}"
|
46
48
|
commit_id = Ops::Snapshot.create_commit(pkg, versions_file, message) do |io|
|
47
49
|
versions = CLI::Versions.new(ws)
|
48
50
|
Autoproj.message "creating versions file, this may take a while"
|
@@ -53,9 +55,8 @@ module Autoproj
|
|
53
55
|
keep_going: options[:keep_going])
|
54
56
|
end
|
55
57
|
|
56
|
-
importer.run_git_bare(pkg,
|
58
|
+
importer.run_git_bare(pkg, "tag", tag_name, commit_id)
|
57
59
|
end
|
58
60
|
end
|
59
61
|
end
|
60
62
|
end
|
61
|
-
|
data/lib/autoproj/cli/test.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
require
|
1
|
+
require "autoproj/cli/utility"
|
2
2
|
|
3
3
|
module Autoproj
|
4
4
|
module CLI
|
5
5
|
class Test < Utility
|
6
6
|
def initialize(ws = Workspace.default,
|
7
|
-
|
8
|
-
|
7
|
+
name: "test",
|
8
|
+
report_path: ws.utility_report_path("test"))
|
9
9
|
super
|
10
10
|
end
|
11
11
|
|
12
12
|
def package_metadata(package)
|
13
13
|
u = package.test_utility
|
14
14
|
super.merge(
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
"coverage_available" => !!u.coverage_available?,
|
16
|
+
"coverage_enabled" => !!u.coverage_enabled?,
|
17
|
+
"coverage_source_dir" => u.coverage_source_dir,
|
18
|
+
"coverage_target_dir" => u.coverage_target_dir
|
19
19
|
)
|
20
20
|
end
|
21
21
|
end
|