autoproj 2.11.0 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -8
- data/.travis.yml +5 -3
- data/autoproj.gemspec +6 -6
- data/bin/alog +1 -0
- data/bin/autoproj +1 -1
- data/bin/autoproj_bootstrap +130 -67
- data/bin/autoproj_bootstrap.in +9 -7
- data/bin/autoproj_install +129 -63
- data/bin/autoproj_install.in +8 -3
- data/lib/autoproj/autobuild_extensions/dsl.rb +27 -12
- data/lib/autoproj/base.rb +18 -0
- data/lib/autoproj/cli/base.rb +1 -1
- data/lib/autoproj/cli/build.rb +8 -3
- data/lib/autoproj/cli/cache.rb +79 -7
- data/lib/autoproj/cli/inspection_tool.rb +5 -6
- data/lib/autoproj/cli/main.rb +33 -9
- data/lib/autoproj/cli/show.rb +12 -18
- data/lib/autoproj/cli/status.rb +15 -9
- data/lib/autoproj/cli/test.rb +1 -1
- data/lib/autoproj/cli/update.rb +72 -17
- data/lib/autoproj/cli/utility.rb +25 -28
- data/lib/autoproj/configuration.rb +15 -4
- data/lib/autoproj/default.osdeps +29 -3
- data/lib/autoproj/environment.rb +17 -13
- data/lib/autoproj/installation_manifest.rb +7 -5
- data/lib/autoproj/manifest.rb +14 -6
- data/lib/autoproj/ops/build.rb +23 -21
- data/lib/autoproj/ops/cache.rb +151 -33
- data/lib/autoproj/ops/cached_env.rb +2 -2
- data/lib/autoproj/ops/import.rb +23 -4
- data/lib/autoproj/ops/install.rb +121 -60
- data/lib/autoproj/ops/phase_reporting.rb +49 -0
- data/lib/autoproj/ops/snapshot.rb +2 -1
- data/lib/autoproj/ops/tools.rb +2 -2
- data/lib/autoproj/os_package_installer.rb +19 -11
- data/lib/autoproj/package_definition.rb +1 -1
- data/lib/autoproj/package_managers/apt_dpkg_manager.rb +49 -28
- data/lib/autoproj/package_managers/bundler_manager.rb +102 -19
- data/lib/autoproj/package_managers/homebrew_manager.rb +2 -2
- data/lib/autoproj/package_managers/pip_manager.rb +34 -22
- data/lib/autoproj/package_managers/shell_script_manager.rb +44 -24
- data/lib/autoproj/package_manifest.rb +43 -31
- data/lib/autoproj/package_set.rb +2 -2
- data/lib/autoproj/python.rb +285 -0
- data/lib/autoproj/test.rb +26 -10
- data/lib/autoproj/variable_expansion.rb +3 -1
- data/lib/autoproj/vcs_definition.rb +25 -12
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +60 -16
- data/lib/autoproj.rb +3 -0
- metadata +17 -28
data/lib/autoproj/cli/test.rb
CHANGED
data/lib/autoproj/cli/update.rb
CHANGED
@@ -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 @@ module Autoproj
|
|
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
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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 @@ module Autoproj
|
|
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 @@ module Autoproj
|
|
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,15 +199,62 @@ module Autoproj
|
|
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
|
-
if from
|
203
|
-
|
204
|
-
|
247
|
+
setup_update_from(from) if from
|
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
|
205
258
|
|
206
259
|
ops = Autoproj::Ops::Import.new(
|
207
260
|
ws, report_path: (ws.import_report_path if report))
|
@@ -215,15 +268,17 @@ module Autoproj
|
|
215
268
|
parallel: parallel,
|
216
269
|
retry_count: retry_count,
|
217
270
|
install_vcs_packages: (osdeps_options if osdeps),
|
218
|
-
auto_exclude: auto_exclude
|
219
|
-
|
271
|
+
auto_exclude: auto_exclude,
|
272
|
+
filter: filter)
|
273
|
+
[source_packages, osdep_packages, nil]
|
220
274
|
rescue ExcludedSelection => e
|
221
275
|
raise CLIInvalidSelection, e.message, e.backtrace
|
222
276
|
rescue PackageImportFailed => import_failure
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
277
|
+
raise unless keep_going
|
278
|
+
|
279
|
+
[import_failure.source_packages,
|
280
|
+
import_failure.osdep_packages,
|
281
|
+
import_failure]
|
227
282
|
end
|
228
283
|
|
229
284
|
def setup_update_from(other_root)
|
data/lib/autoproj/cli/utility.rb
CHANGED
@@ -70,7 +70,7 @@ module Autoproj
|
|
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
|
|
@@ -89,24 +89,37 @@ module Autoproj
|
|
89
89
|
raise CLIInvalidArguments, "autoproj: the provided package "\
|
90
90
|
"is not selected for build"
|
91
91
|
end
|
92
|
+
return if package_names.empty?
|
92
93
|
|
93
94
|
packages = package_names.map do |pkg_name|
|
94
95
|
ws.manifest.find_package_definition(pkg_name)
|
95
96
|
end
|
96
97
|
|
97
|
-
|
98
|
-
|
99
|
-
"autoproj-#{utility_name}",
|
100
|
-
[utility_name],
|
101
|
-
parallel: options[:parallel]
|
102
|
-
)
|
98
|
+
apply_to_packages(packages, parallel: options[:parallel])
|
99
|
+
end
|
103
100
|
|
101
|
+
def apply_to_packages(packages, parallel: ws.config.parallel_build_level)
|
102
|
+
if @report_path
|
103
|
+
reporting = Ops::PhaseReporting.new(
|
104
|
+
@utility_name, @report_path,
|
105
|
+
method(:package_metadata)
|
106
|
+
)
|
107
|
+
end
|
108
|
+
|
109
|
+
reporting&.initialize_incremental_report
|
110
|
+
Autobuild.apply(
|
111
|
+
packages.map(&:name), "autoproj-#{@utility_name}",
|
112
|
+
[@utility_name], parallel: parallel
|
113
|
+
) do |pkg, phase|
|
114
|
+
reporting&.report_incremental(pkg) if phase == utility_name
|
115
|
+
end
|
104
116
|
ensure
|
105
|
-
create_report(packages)
|
117
|
+
reporting&.create_report(packages.map(&:autobuild))
|
106
118
|
end
|
107
119
|
|
108
|
-
def package_metadata(
|
109
|
-
|
120
|
+
def package_metadata(autobuild_package)
|
121
|
+
# rubocop:disable Style/DoubleNegation
|
122
|
+
u = autobuild_package.utility(@utility_name)
|
110
123
|
{
|
111
124
|
'source_dir' => u.source_dir,
|
112
125
|
'target_dir' => u.target_dir,
|
@@ -114,25 +127,9 @@ module Autoproj
|
|
114
127
|
'enabled' => !!u.enabled?,
|
115
128
|
'invoked' => !!u.invoked?,
|
116
129
|
'success' => !!u.success?,
|
117
|
-
'installed' => !!u.installed
|
130
|
+
'installed' => !!u.installed?
|
118
131
|
}
|
119
|
-
|
120
|
-
|
121
|
-
def create_report(packages)
|
122
|
-
info = packages.each_with_object({}) do |p, map|
|
123
|
-
map[p.name] = package_metadata(p)
|
124
|
-
end
|
125
|
-
|
126
|
-
FileUtils.mkdir_p File.dirname(@report_path)
|
127
|
-
File.open(@report_path, 'w') do |io|
|
128
|
-
dump = JSON.dump(
|
129
|
-
"#{@utility_name}_report" => {
|
130
|
-
'timestamp' => Time.now,
|
131
|
-
'packages' => info
|
132
|
-
}
|
133
|
-
)
|
134
|
-
io.write dump
|
135
|
-
end
|
132
|
+
# rubocop:enable Style/DoubleNegation
|
136
133
|
end
|
137
134
|
end
|
138
135
|
end
|
@@ -196,7 +196,9 @@ module Autoproj
|
|
196
196
|
Autoproj.info " using: #{value} (noninteractive mode)"
|
197
197
|
end
|
198
198
|
@modified = true
|
199
|
-
if
|
199
|
+
if is_default
|
200
|
+
value = opt.validate(value)
|
201
|
+
else
|
200
202
|
config[option_name] = [value, true]
|
201
203
|
displayed_options[option_name] = value
|
202
204
|
end
|
@@ -242,10 +244,10 @@ module Autoproj
|
|
242
244
|
@modified = false
|
243
245
|
end
|
244
246
|
|
245
|
-
def each_reused_autoproj_installation
|
247
|
+
def each_reused_autoproj_installation(&block)
|
246
248
|
if has_value_for?('reused_autoproj_installations')
|
247
|
-
get('reused_autoproj_installations').each(&
|
248
|
-
else [].each(&
|
249
|
+
get('reused_autoproj_installations').each(&block)
|
250
|
+
else [].each(&block)
|
249
251
|
end
|
250
252
|
end
|
251
253
|
|
@@ -353,6 +355,10 @@ module Autoproj
|
|
353
355
|
set 'shell_helpers', flag, true
|
354
356
|
end
|
355
357
|
|
358
|
+
def bundler_version
|
359
|
+
get 'bundler_version', nil
|
360
|
+
end
|
361
|
+
|
356
362
|
def apply_autobuild_configuration
|
357
363
|
if has_value_for?('autobuild')
|
358
364
|
params = get('autobuild')
|
@@ -369,6 +375,11 @@ module Autoproj
|
|
369
375
|
get('importer_cache_dir', nil)
|
370
376
|
end
|
371
377
|
|
378
|
+
# Set import and gem cache directory
|
379
|
+
def importer_cache_dir=(path)
|
380
|
+
set('importer_cache_dir', path, true)
|
381
|
+
end
|
382
|
+
|
372
383
|
# Sets the directory in which packages will be installed
|
373
384
|
def prefix_dir=(path)
|
374
385
|
set('prefix', path, true)
|
data/lib/autoproj/default.osdeps
CHANGED
@@ -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,13 +159,19 @@ archive:
|
|
149
159
|
opensuse:
|
150
160
|
- tar
|
151
161
|
- unzip
|
162
|
+
- ca-certificates
|
152
163
|
default: ignore
|
153
164
|
|
154
165
|
cvs:
|
155
166
|
default: cvs
|
156
167
|
|
157
168
|
pip:
|
158
|
-
debian
|
169
|
+
debian:
|
170
|
+
'8,jessie,9,stretch': python-pip
|
171
|
+
default: python3-pip
|
172
|
+
ubuntu:
|
173
|
+
'16.04,18.04': python-pip
|
174
|
+
default: python3-pip
|
159
175
|
arch: python2-pip
|
160
176
|
opensuse: python-pip
|
161
177
|
fedora: python-pip
|
@@ -164,7 +180,12 @@ pip:
|
|
164
180
|
|
165
181
|
python:
|
166
182
|
arch: python2
|
167
|
-
debian
|
183
|
+
debian:
|
184
|
+
'8,jessie,9,stretch': python-dev
|
185
|
+
default: python3-dev
|
186
|
+
ubuntu:
|
187
|
+
'16.04,18.04': python-dev
|
188
|
+
default: python3-dev
|
168
189
|
fedora: python-devel
|
169
190
|
freebsd: python-devel
|
170
191
|
gentoo: dev-lang/python
|
@@ -173,7 +194,12 @@ python:
|
|
173
194
|
|
174
195
|
python-setuptools:
|
175
196
|
arch: python2-distribute
|
176
|
-
debian
|
197
|
+
debian:
|
198
|
+
'8,jessie,9,stretch': python-setuptools
|
199
|
+
default: python3-setuptools
|
200
|
+
ubuntu:
|
201
|
+
'16.04,18.04': python-setuptools
|
202
|
+
default: python3-setuptools
|
177
203
|
fedora: python-setuptools
|
178
204
|
gentoo: dev-python/setuptools
|
179
205
|
default: ignore # will be installed manually by the user
|
data/lib/autoproj/environment.rb
CHANGED
@@ -17,6 +17,22 @@ module Autoproj
|
|
17
17
|
Autoproj.filter_out_paths_in_workspace(env)
|
18
18
|
end
|
19
19
|
|
20
|
+
def env_filename(shell, *subdir)
|
21
|
+
env_filename = if shell == 'sh'
|
22
|
+
ENV_FILENAME
|
23
|
+
else
|
24
|
+
(Pathname(ENV_FILENAME).sub_ext '').to_s.concat(".#{shell}")
|
25
|
+
end
|
26
|
+
|
27
|
+
File.join(root_dir, *subdir, env_filename)
|
28
|
+
end
|
29
|
+
|
30
|
+
def each_env_filename(*subdir)
|
31
|
+
(['sh'] + Autoproj.workspace.config.user_shells).to_set.each do |shell|
|
32
|
+
yield shell, env_filename(shell, *subdir)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
20
36
|
def export_env_sh(subdir = nil, options = Hash.new)
|
21
37
|
if subdir.kind_of?(Hash)
|
22
38
|
subdir, options = nil, subdir
|
@@ -28,19 +44,7 @@ module Autoproj
|
|
28
44
|
completion_dir = File.join(shell_dir, 'completion')
|
29
45
|
env_updated = false
|
30
46
|
|
31
|
-
([
|
32
|
-
env_filename = if shell == 'sh'
|
33
|
-
ENV_FILENAME
|
34
|
-
else
|
35
|
-
(Pathname(ENV_FILENAME).sub_ext '').to_s.concat(".#{shell}")
|
36
|
-
end
|
37
|
-
|
38
|
-
filename = if subdir
|
39
|
-
File.join(root_dir, subdir, env_filename)
|
40
|
-
else
|
41
|
-
File.join(root_dir, env_filename)
|
42
|
-
end
|
43
|
-
|
47
|
+
each_env_filename(*[subdir].compact) do |shell, filename|
|
44
48
|
helper = File.join(shell_dir, "autoproj_#{shell}")
|
45
49
|
if options[:shell_helpers]
|
46
50
|
source_after(helper, shell: shell) if File.file?(helper)
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Autoproj
|
2
2
|
# Manifest of installed packages imported from another autoproj installation
|
3
3
|
class InstallationManifest
|
4
|
-
Package = Struct.new :name, :type, :vcs, :srcdir, :
|
4
|
+
Package = Struct.new :name, :type, :vcs, :srcdir, :importdir,
|
5
|
+
:prefix, :builddir, :logdir, :dependencies
|
5
6
|
PackageSet = Struct.new :name, :vcs, :raw_local_dir, :user_local_dir
|
6
7
|
|
7
8
|
attr_reader :path
|
@@ -28,11 +29,11 @@ module Autoproj
|
|
28
29
|
def each_package_set(&block)
|
29
30
|
package_sets.each_value(&block)
|
30
31
|
end
|
31
|
-
|
32
|
+
|
32
33
|
def each_package(&block)
|
33
34
|
packages.each_value(&block)
|
34
35
|
end
|
35
|
-
|
36
|
+
|
36
37
|
def load
|
37
38
|
@packages = Hash.new
|
38
39
|
raw = YAML.load(File.open(path))
|
@@ -51,8 +52,8 @@ module Autoproj
|
|
51
52
|
package_sets[pkg_set.name] = pkg_set
|
52
53
|
else
|
53
54
|
pkg = Package.new(
|
54
|
-
entry['name'], entry['type'], entry['vcs'], entry['srcdir'], entry['
|
55
|
-
entry['builddir'], entry['logdir'], entry['dependencies'])
|
55
|
+
entry['name'], entry['type'], entry['vcs'], entry['srcdir'], entry['importdir'],
|
56
|
+
entry['prefix'], entry['builddir'], entry['logdir'], entry['dependencies'])
|
56
57
|
packages[pkg.name] = pkg
|
57
58
|
end
|
58
59
|
end
|
@@ -74,6 +75,7 @@ module Autoproj
|
|
74
75
|
'type' => v.class.name,
|
75
76
|
'vcs' => package_def.vcs.to_hash,
|
76
77
|
'srcdir' => v.srcdir,
|
78
|
+
'importdir' => (v.importdir if v.respond_to?(:importdir)),
|
77
79
|
'builddir' => (v.builddir if v.respond_to?(:builddir)),
|
78
80
|
'logdir' => v.logdir,
|
79
81
|
'prefix' => v.prefix,
|