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/workspace.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "autoproj/ops/loader"
|
2
|
+
require "xdg"
|
3
3
|
|
4
4
|
module Autoproj
|
5
5
|
class Workspace < Ops::Loader
|
@@ -52,11 +52,12 @@ module Autoproj
|
|
52
52
|
attr_reader :osdep_suffixes
|
53
53
|
|
54
54
|
def initialize(root_dir,
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
os_package_resolver: OSPackageResolver.new,
|
56
|
+
package_managers: OSPackageInstaller::PACKAGE_MANAGERS,
|
57
|
+
os_repository_resolver: OSRepositoryResolver.new(
|
58
|
+
operating_system: os_package_resolver.operating_system
|
59
|
+
),
|
60
|
+
os_repository_installer: OSRepositoryInstaller.new(self))
|
60
61
|
@root_dir = root_dir
|
61
62
|
@root_path = Pathname.new(root_dir)
|
62
63
|
@ruby_version_keyword = "ruby#{RUBY_VERSION.split('.')[0, 2].join('')}"
|
@@ -65,7 +66,7 @@ module Autoproj
|
|
65
66
|
@loader = loader
|
66
67
|
@env = Environment.new
|
67
68
|
env.prepare(root_dir)
|
68
|
-
env.source_before(File.join(dot_autoproj_dir,
|
69
|
+
env.source_before(File.join(dot_autoproj_dir, "env.sh"))
|
69
70
|
|
70
71
|
@os_repository_resolver = os_repository_resolver
|
71
72
|
@os_repository_installer = os_repository_installer
|
@@ -74,7 +75,8 @@ module Autoproj
|
|
74
75
|
@config = Configuration.new(config_file_path)
|
75
76
|
|
76
77
|
@os_package_installer = OSPackageInstaller.new(
|
77
|
-
self, os_package_resolver, package_managers: package_managers
|
78
|
+
self, os_package_resolver, package_managers: package_managers
|
79
|
+
)
|
78
80
|
super(root_dir)
|
79
81
|
end
|
80
82
|
|
@@ -83,7 +85,7 @@ module Autoproj
|
|
83
85
|
# @return [String,nil] the root path, or nil if one did not yet source
|
84
86
|
# the workspace's env.sh
|
85
87
|
def self.autoproj_current_root
|
86
|
-
if (env = ENV[
|
88
|
+
if (env = ENV["AUTOPROJ_CURRENT_ROOT"])
|
87
89
|
env unless env.empty?
|
88
90
|
end
|
89
91
|
end
|
@@ -107,7 +109,7 @@ module Autoproj
|
|
107
109
|
Workspace.new(path, **workspace_options)
|
108
110
|
elsif Autoproj.find_v1_workspace_dir(dir)
|
109
111
|
raise OutdatedWorkspace, "#{dir} looks like a v1 workspace, "\
|
110
|
-
|
112
|
+
"run autoproj upgrade before continuing"
|
111
113
|
else
|
112
114
|
raise NotWorkspace, "not in a Autoproj installation"
|
113
115
|
end
|
@@ -118,13 +120,13 @@ module Autoproj
|
|
118
120
|
from_dir(path, **workspace_options)
|
119
121
|
elsif Autoproj.find_v1_workspace_dir(dir = Autoproj.default_find_base_dir)
|
120
122
|
raise OutdatedWorkspace, "#{dir} looks like a v1 workspace, "\
|
121
|
-
|
122
|
-
elsif (envvar = ENV[
|
123
|
+
"run autoproj upgrade before continuing"
|
124
|
+
elsif (envvar = ENV["AUTOPROJ_CURRENT_ROOT"])
|
123
125
|
raise NotWorkspace, "AUTOPROJ_CURRENT_ROOT is currently set "\
|
124
|
-
|
126
|
+
"to #{envvar}, but that is not an Autoproj workspace"
|
125
127
|
else
|
126
128
|
raise NotWorkspace, "not in an Autoproj installation, "\
|
127
|
-
|
129
|
+
"and no env.sh has been loaded so far"
|
128
130
|
end
|
129
131
|
end
|
130
132
|
|
@@ -146,9 +148,10 @@ module Autoproj
|
|
146
148
|
ws = from_environment(**workspace_options)
|
147
149
|
from_pwd = Autoproj.find_workspace_dir(Dir.pwd)
|
148
150
|
if from_pwd && (from_pwd != ws.root_dir)
|
149
|
-
raise MismatchingWorkspace,
|
150
|
-
|
151
|
-
|
151
|
+
raise MismatchingWorkspace,
|
152
|
+
"the current environment points to "\
|
153
|
+
"#{ws.root_dir}, but you are in #{from_pwd}, make sure you "\
|
154
|
+
"are loading the right #{ENV_FILENAME} script !"
|
152
155
|
end
|
153
156
|
ws
|
154
157
|
end
|
@@ -166,13 +169,13 @@ module Autoproj
|
|
166
169
|
#
|
167
170
|
# @return [String]
|
168
171
|
def config_dir
|
169
|
-
File.join(root_dir,
|
172
|
+
File.join(root_dir, "autoproj")
|
170
173
|
end
|
171
174
|
|
172
175
|
# The directory under which autoproj saves all its internal
|
173
176
|
# configuration and files
|
174
177
|
def dot_autoproj_dir
|
175
|
-
File.join(root_dir,
|
178
|
+
File.join(root_dir, ".autoproj")
|
176
179
|
end
|
177
180
|
|
178
181
|
# The installation manifest
|
@@ -182,12 +185,12 @@ module Autoproj
|
|
182
185
|
|
183
186
|
# The path to the workspace configuration file
|
184
187
|
def config_file_path
|
185
|
-
File.join(dot_autoproj_dir,
|
188
|
+
File.join(dot_autoproj_dir, "config.yml")
|
186
189
|
end
|
187
190
|
|
188
191
|
# The path to the workspace's manifest file
|
189
192
|
def manifest_file_path
|
190
|
-
File.join(root_dir,
|
193
|
+
File.join(root_dir, "autoproj", config.get("manifest_name", "manifest"))
|
191
194
|
end
|
192
195
|
|
193
196
|
# Return the directory in which remote package set definition should be
|
@@ -213,7 +216,7 @@ module Autoproj
|
|
213
216
|
|
214
217
|
# Change {#build_dir}
|
215
218
|
def build_dir=(path)
|
216
|
-
config.set
|
219
|
+
config.set "build", path, true
|
217
220
|
end
|
218
221
|
|
219
222
|
# (see Configuration#source_dir)
|
@@ -227,11 +230,11 @@ module Autoproj
|
|
227
230
|
|
228
231
|
# Change {#source_dir}
|
229
232
|
def source_dir=(path)
|
230
|
-
config.set
|
233
|
+
config.set "source", path, true
|
231
234
|
end
|
232
235
|
|
233
236
|
def log_dir
|
234
|
-
File.join(prefix_dir,
|
237
|
+
File.join(prefix_dir, "log")
|
235
238
|
end
|
236
239
|
|
237
240
|
OVERRIDES_DIR = "overrides.d".freeze
|
@@ -243,7 +246,7 @@ module Autoproj
|
|
243
246
|
File.join(config_dir, OVERRIDES_DIR)
|
244
247
|
end
|
245
248
|
|
246
|
-
IMPORT_REPORT_BASENAME = "import_report.json"
|
249
|
+
IMPORT_REPORT_BASENAME = "import_report.json".freeze
|
247
250
|
|
248
251
|
# The full path to the update report
|
249
252
|
#
|
@@ -252,7 +255,7 @@ module Autoproj
|
|
252
255
|
File.join(log_dir, IMPORT_REPORT_BASENAME)
|
253
256
|
end
|
254
257
|
|
255
|
-
BUILD_REPORT_BASENAME = "build_report.json"
|
258
|
+
BUILD_REPORT_BASENAME = "build_report.json".freeze
|
256
259
|
|
257
260
|
# The full path to the build report
|
258
261
|
#
|
@@ -279,22 +282,23 @@ module Autoproj
|
|
279
282
|
config.reset
|
280
283
|
config.load(path: config_file_path, reconfigure: reconfigure)
|
281
284
|
manifest.vcs =
|
282
|
-
if (raw_vcs = config.get(
|
285
|
+
if (raw_vcs = config.get("manifest_source", nil))
|
283
286
|
VCSDefinition.from_raw(raw_vcs)
|
284
287
|
else
|
285
|
-
|
288
|
+
local_vcs = { type: "local", url: config_dir }
|
289
|
+
VCSDefinition.from_raw(local_vcs)
|
286
290
|
end
|
287
291
|
|
288
292
|
if config.source_dir && Pathname.new(config.source_dir).absolute?
|
289
|
-
raise ConfigError,
|
293
|
+
raise ConfigError, "source dir path configuration must be relative"
|
290
294
|
end
|
291
295
|
|
292
296
|
os_package_resolver.prefer_indep_over_os_packages =
|
293
297
|
config.prefer_indep_over_os_packages?
|
294
298
|
os_package_resolver.operating_system ||=
|
295
|
-
config.get(
|
299
|
+
config.get("operating_system", nil)
|
296
300
|
os_repository_resolver.operating_system ||=
|
297
|
-
config.get(
|
301
|
+
config.get("operating_system", nil)
|
298
302
|
end
|
299
303
|
@config
|
300
304
|
end
|
@@ -306,18 +310,22 @@ module Autoproj
|
|
306
310
|
def autodetect_operating_system(force: false)
|
307
311
|
if force || !os_package_resolver.operating_system
|
308
312
|
begin
|
309
|
-
Autobuild.progress_start
|
313
|
+
Autobuild.progress_start(
|
314
|
+
:operating_system_autodetection,
|
310
315
|
"autodetecting the operating system"
|
316
|
+
)
|
311
317
|
names, versions = OSPackageResolver.autodetect_operating_system
|
312
318
|
os_package_resolver.operating_system = [names, versions]
|
313
319
|
os_repository_resolver.operating_system = [names, versions]
|
314
|
-
Autobuild.progress
|
320
|
+
Autobuild.progress(
|
321
|
+
:operating_system_autodetection,
|
315
322
|
"operating system: #{(names - ['default']).join(',')} -"\
|
316
323
|
" #{(versions - ['default']).join(',')}"
|
324
|
+
)
|
317
325
|
ensure
|
318
326
|
Autobuild.progress_done :operating_system_autodetection
|
319
327
|
end
|
320
|
-
config.set(
|
328
|
+
config.set("operating_system", os_package_resolver.operating_system, true)
|
321
329
|
end
|
322
330
|
end
|
323
331
|
|
@@ -339,21 +347,27 @@ module Autoproj
|
|
339
347
|
end
|
340
348
|
|
341
349
|
def setup_ruby_version_handling
|
342
|
-
os_package_resolver.add_aliases(
|
350
|
+
os_package_resolver.add_aliases("ruby" => ruby_version_keyword)
|
343
351
|
osdep_suffixes << ruby_version_keyword
|
344
352
|
end
|
345
353
|
|
346
|
-
|
354
|
+
# Perform initial configuration load and workspace setup
|
355
|
+
#
|
356
|
+
# @param [Boolean] load_global_configuration if true, load the global
|
357
|
+
# autoprojrc file if it exists. Otherwise, ignore it.
|
358
|
+
def setup(load_global_configuration: true, read_only: false)
|
347
359
|
setup_ruby_version_handling
|
348
360
|
migrate_bundler_and_autoproj_gem_layout
|
349
361
|
load_config
|
350
|
-
|
351
|
-
|
362
|
+
unless read_only
|
363
|
+
register_workspace
|
364
|
+
rewrite_shims
|
365
|
+
end
|
352
366
|
autodetect_operating_system
|
353
367
|
config.validate_ruby_executable
|
354
|
-
Autobuild.programs[
|
368
|
+
Autobuild.programs["ruby"] = config.ruby_executable
|
355
369
|
config.apply_autobuild_configuration
|
356
|
-
load_autoprojrc
|
370
|
+
load_autoprojrc if load_global_configuration
|
357
371
|
load_main_initrb
|
358
372
|
config.each_reused_autoproj_installation do |p|
|
359
373
|
manifest.reuse(p)
|
@@ -361,9 +375,11 @@ module Autoproj
|
|
361
375
|
manifest.load(manifest_file_path) if File.exist?(manifest_file_path)
|
362
376
|
|
363
377
|
Autobuild.prefix = prefix_dir
|
364
|
-
|
365
|
-
|
366
|
-
|
378
|
+
unless read_only
|
379
|
+
FileUtils.mkdir_p File.join(prefix_dir, ".autoproj")
|
380
|
+
Ops.atomic_write(File.join(prefix_dir, ".autoproj", "config.yml")) do |io|
|
381
|
+
io.puts "workspace: \"#{root_dir}\""
|
382
|
+
end
|
367
383
|
end
|
368
384
|
|
369
385
|
Autobuild.srcdir = source_dir
|
@@ -373,36 +389,36 @@ module Autoproj
|
|
373
389
|
os_package_installer.each_manager_with_name do |name, manager|
|
374
390
|
next unless manager.respond_to?(:cache_dir=)
|
375
391
|
|
376
|
-
manager_cache_path = File.join(cache_dir,
|
392
|
+
manager_cache_path = File.join(cache_dir, "package_managers", name)
|
377
393
|
if File.directory?(manager_cache_path)
|
378
394
|
manager.cache_dir = manager_cache_path
|
379
395
|
end
|
380
396
|
end
|
381
397
|
end
|
382
398
|
setup_os_package_installer
|
383
|
-
install_ruby_shims
|
399
|
+
install_ruby_shims unless read_only
|
384
400
|
end
|
385
401
|
|
386
402
|
def install_ruby_shims
|
387
403
|
install_suffix = ""
|
388
|
-
if (match = /ruby(.*)$/.match(RbConfig::CONFIG[
|
404
|
+
if (match = /ruby(.*)$/.match(RbConfig::CONFIG["RUBY_INSTALL_NAME"]))
|
389
405
|
install_suffix = match[1]
|
390
406
|
end
|
391
407
|
|
392
|
-
bindir = File.join(prefix_dir,
|
408
|
+
bindir = File.join(prefix_dir, "bin")
|
393
409
|
FileUtils.mkdir_p bindir
|
394
|
-
env.add
|
410
|
+
env.add "PATH", bindir
|
395
411
|
|
396
|
-
Ops.atomic_write(File.join(bindir,
|
412
|
+
Ops.atomic_write(File.join(bindir, "ruby")) do |io|
|
397
413
|
io.puts "#! /bin/sh"
|
398
414
|
io.puts "exec #{config.ruby_executable} \"$@\""
|
399
415
|
end
|
400
|
-
FileUtils.chmod 0o755, File.join(bindir,
|
416
|
+
FileUtils.chmod 0o755, File.join(bindir, "ruby")
|
401
417
|
|
402
418
|
%w[gem irb testrb].each do |name|
|
403
419
|
# Look for the corresponding gem program
|
404
420
|
prg_name = "#{name}#{install_suffix}"
|
405
|
-
if File.file?(prg_path = File.join(RbConfig::CONFIG[
|
421
|
+
if File.file?(prg_path = File.join(RbConfig::CONFIG["bindir"], prg_name))
|
406
422
|
Ops.atomic_write(File.join(bindir, name)) do |io|
|
407
423
|
io.puts "#! #{config.ruby_executable}"
|
408
424
|
io.puts "exec \"#{prg_path}\", *ARGV"
|
@@ -413,14 +429,14 @@ module Autoproj
|
|
413
429
|
end
|
414
430
|
|
415
431
|
def rewrite_shims
|
416
|
-
gemfile = File.join(dot_autoproj_dir,
|
417
|
-
binstubs = File.join(dot_autoproj_dir,
|
432
|
+
gemfile = File.join(dot_autoproj_dir, "Gemfile")
|
433
|
+
binstubs = File.join(dot_autoproj_dir, "bin")
|
418
434
|
Ops::Install.rewrite_shims(binstubs, config.ruby_executable,
|
419
|
-
|
435
|
+
root_dir, gemfile, config.gems_gem_home)
|
420
436
|
end
|
421
437
|
|
422
438
|
def update_bundler
|
423
|
-
require
|
439
|
+
require "autoproj/ops/install"
|
424
440
|
gem_program = Ops::Install.guess_gem_program
|
425
441
|
install = Ops::Install.new(root_dir)
|
426
442
|
Autoproj.message " updating bundler"
|
@@ -436,13 +452,13 @@ module Autoproj
|
|
436
452
|
|
437
453
|
# This is a guard to avoid infinite recursion in case the user is
|
438
454
|
# running autoproj osdeps --force
|
439
|
-
return if ENV[
|
455
|
+
return if ENV["AUTOPROJ_RESTARTING"] == "1"
|
440
456
|
|
441
|
-
gemfile = File.join(dot_autoproj_dir,
|
442
|
-
binstubs = File.join(dot_autoproj_dir,
|
457
|
+
gemfile = File.join(dot_autoproj_dir, "Gemfile")
|
458
|
+
binstubs = File.join(dot_autoproj_dir, "bin")
|
443
459
|
if restart_on_update
|
444
460
|
old_autoproj_path = PackageManagers::BundlerManager.bundle_gem_path(
|
445
|
-
self,
|
461
|
+
self, "autoproj", gemfile: gemfile
|
446
462
|
)
|
447
463
|
end
|
448
464
|
begin
|
@@ -455,7 +471,7 @@ module Autoproj
|
|
455
471
|
end
|
456
472
|
if restart_on_update
|
457
473
|
new_autoproj_path = PackageManagers::BundlerManager.bundle_gem_path(
|
458
|
-
self,
|
474
|
+
self, "autoproj", gemfile: gemfile
|
459
475
|
)
|
460
476
|
end
|
461
477
|
|
@@ -469,8 +485,8 @@ module Autoproj
|
|
469
485
|
#
|
470
486
|
# ...But first save the configuration (!)
|
471
487
|
config.save
|
472
|
-
ENV[
|
473
|
-
require
|
488
|
+
ENV["AUTOPROJ_RESTARTING"] = "1"
|
489
|
+
require "rbconfig"
|
474
490
|
exec(config.ruby_executable, $PROGRAM_NAME, *ARGV)
|
475
491
|
end
|
476
492
|
end
|
@@ -479,7 +495,8 @@ module Autoproj
|
|
479
495
|
options =
|
480
496
|
if args.last.kind_of?(Hash)
|
481
497
|
args.pop
|
482
|
-
else
|
498
|
+
else
|
499
|
+
Hash.new
|
483
500
|
end
|
484
501
|
options_env = options.fetch(:env, Hash.new)
|
485
502
|
options[:env] = env.resolved_env.merge(options_env)
|
@@ -487,12 +504,12 @@ module Autoproj
|
|
487
504
|
end
|
488
505
|
|
489
506
|
def migrate_bundler_and_autoproj_gem_layout
|
490
|
-
if
|
491
|
-
|
492
|
-
else
|
493
|
-
config_path = File.join(dot_autoproj_dir, 'config.yml')
|
507
|
+
if File.directory?(File.join(dot_autoproj_dir, "autoproj"))
|
508
|
+
config_path = File.join(dot_autoproj_dir, "config.yml")
|
494
509
|
config = YAML.safe_load(File.read(config_path))
|
495
|
-
return if config[
|
510
|
+
return if config["gems_install_path"]
|
511
|
+
else
|
512
|
+
return
|
496
513
|
end
|
497
514
|
|
498
515
|
Autoproj.silent = false
|
@@ -535,11 +552,11 @@ module Autoproj
|
|
535
552
|
|
536
553
|
def self.find_path(xdg_var, xdg_path, home_path)
|
537
554
|
home_dir = begin Dir.home
|
538
|
-
|
539
|
-
|
540
|
-
|
555
|
+
rescue ArgumentError
|
556
|
+
return
|
557
|
+
end
|
541
558
|
|
542
|
-
xdg_path = File.join(XDG[xdg_var].to_path,
|
559
|
+
xdg_path = File.join(XDG[xdg_var].to_path, "autoproj", xdg_path)
|
543
560
|
home_path = File.join(home_dir, home_path)
|
544
561
|
|
545
562
|
if File.exist?(xdg_path)
|
@@ -552,25 +569,25 @@ module Autoproj
|
|
552
569
|
end
|
553
570
|
|
554
571
|
def self.find_user_config_path(xdg_path, home_path = xdg_path)
|
555
|
-
find_path(
|
572
|
+
find_path("CONFIG_HOME", xdg_path, home_path)
|
556
573
|
end
|
557
574
|
|
558
575
|
def self.rcfile_path
|
559
|
-
find_user_config_path(
|
576
|
+
find_user_config_path("rc", ".autoprojrc")
|
560
577
|
end
|
561
578
|
|
562
579
|
def self.find_user_data_path(xdg_path, home_path = xdg_path)
|
563
|
-
find_path(
|
580
|
+
find_path("DATA_HOME", xdg_path, File.join(".autoproj", home_path))
|
564
581
|
end
|
565
582
|
|
566
583
|
def self.find_user_cache_path(xdg_path, home_path = xdg_path)
|
567
|
-
find_path(
|
584
|
+
find_path("CACHE_HOME", xdg_path, File.join(".autoproj", home_path))
|
568
585
|
end
|
569
586
|
|
570
587
|
RegisteredWorkspace = Struct.new :root_dir, :prefix_dir, :build_dir
|
571
588
|
|
572
589
|
def self.registered_workspaces
|
573
|
-
path = find_user_data_path(
|
590
|
+
path = find_user_data_path("workspaces.yml")
|
574
591
|
if File.file?(path)
|
575
592
|
yaml = (YAML.safe_load(File.read(path)) || [])
|
576
593
|
fields = RegisteredWorkspace.members.map(&:to_s)
|
@@ -585,12 +602,12 @@ module Autoproj
|
|
585
602
|
|
586
603
|
def self.save_registered_workspaces(workspaces)
|
587
604
|
workspaces = workspaces.map do |w|
|
588
|
-
Hash[
|
589
|
-
|
590
|
-
|
605
|
+
Hash["root_dir" => w.root_dir,
|
606
|
+
"prefix_dir" => w.prefix_dir,
|
607
|
+
"build_dir" => w.build_dir]
|
591
608
|
end
|
592
609
|
|
593
|
-
path = find_user_data_path(
|
610
|
+
path = find_user_data_path("workspaces.yml")
|
594
611
|
FileUtils.mkdir_p(File.dirname(path))
|
595
612
|
Ops.atomic_write(path) do |io|
|
596
613
|
io.write YAML.dump(workspaces)
|
@@ -601,6 +618,10 @@ module Autoproj
|
|
601
618
|
current_workspaces = Workspace.registered_workspaces
|
602
619
|
existing = current_workspaces.find { |w| w.root_dir == root_dir }
|
603
620
|
if existing
|
621
|
+
if existing.prefix_dir == prefix_dir && existing.build_dir == build_dir
|
622
|
+
return
|
623
|
+
end
|
624
|
+
|
604
625
|
existing.prefix_dir = prefix_dir
|
605
626
|
existing.build_dir = build_dir
|
606
627
|
else
|
@@ -619,26 +640,26 @@ module Autoproj
|
|
619
640
|
end
|
620
641
|
|
621
642
|
def load_package_sets(only_local: false,
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
643
|
+
checkout_only: true,
|
644
|
+
reconfigure: false,
|
645
|
+
keep_going: false,
|
646
|
+
mainline: nil,
|
647
|
+
reset: false,
|
648
|
+
retry_count: nil)
|
628
649
|
return unless File.file?(manifest_file_path) # empty install, just return
|
629
650
|
|
630
|
-
Ops::Configuration.new(self)
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
651
|
+
Ops::Configuration.new(self)
|
652
|
+
.load_package_sets(only_local: only_local,
|
653
|
+
checkout_only: checkout_only,
|
654
|
+
keep_going: keep_going,
|
655
|
+
reset: reset,
|
656
|
+
retry_count: retry_count,
|
657
|
+
mainline: mainline)
|
637
658
|
end
|
638
659
|
|
639
660
|
def load_packages(selection = manifest.default_packages(false), options = {})
|
640
|
-
options = Hash[warn_about_ignored_packages: true, checkout_only: true]
|
641
|
-
|
661
|
+
options = Hash[warn_about_ignored_packages: true, checkout_only: true]
|
662
|
+
.merge(options)
|
642
663
|
ops = Ops::Import.new(self)
|
643
664
|
ops.import_packages(selection, options)
|
644
665
|
end
|
@@ -674,7 +695,8 @@ module Autoproj
|
|
674
695
|
layout =
|
675
696
|
if config.randomize_layout?
|
676
697
|
Digest::SHA256.hexdigest(pkg_name)[0, 12]
|
677
|
-
else
|
698
|
+
else
|
699
|
+
manifest.whereis(pkg_name)
|
678
700
|
end
|
679
701
|
|
680
702
|
srcdir =
|
@@ -696,7 +718,7 @@ module Autoproj
|
|
696
718
|
pkg.builddir = compute_builddir(pkg) if pkg.respond_to?(:builddir)
|
697
719
|
|
698
720
|
pkg.prefix = File.join(prefix_dir, prefixdir)
|
699
|
-
pkg.doc_target_dir = File.join(prefix_dir,
|
721
|
+
pkg.doc_target_dir = File.join(prefix_dir, "doc", pkg_name)
|
700
722
|
pkg.logdir = File.join(pkg.prefix, "log")
|
701
723
|
end
|
702
724
|
|
@@ -741,26 +763,25 @@ module Autoproj
|
|
741
763
|
#
|
742
764
|
# This must be done after all ignores/excludes and package selection
|
743
765
|
# have been properly set up (a.k.a. after package import)
|
744
|
-
def finalize_setup
|
766
|
+
def finalize_setup(read_only: false)
|
745
767
|
# Finally, disable all ignored packages on the autobuild side
|
746
768
|
manifest.each_ignored_package(&:disable)
|
747
769
|
|
748
770
|
# We now have processed the process setup blocks. All configuration
|
749
771
|
# should be done and we can save the configuration data.
|
750
|
-
config.save
|
772
|
+
config.save unless read_only
|
751
773
|
end
|
752
774
|
|
753
775
|
def all_present_packages
|
754
|
-
manifest.each_autobuild_package
|
755
|
-
|
756
|
-
|
776
|
+
manifest.each_autobuild_package
|
777
|
+
.find_all { |pkg| File.directory?(pkg.srcdir) }
|
778
|
+
.map(&:name)
|
757
779
|
end
|
758
780
|
|
759
|
-
#
|
781
|
+
# Generate a {InstallationManifest} with the currently known information
|
760
782
|
#
|
761
|
-
# @
|
762
|
-
|
763
|
-
def export_installation_manifest
|
783
|
+
# @return [InstallationManifest]
|
784
|
+
def installation_manifest
|
764
785
|
selected_packages = manifest.all_selected_source_packages
|
765
786
|
install_manifest = InstallationManifest.new(installation_manifest_path)
|
766
787
|
|
@@ -775,7 +796,15 @@ module Autoproj
|
|
775
796
|
install_manifest.add_package(pkg)
|
776
797
|
end
|
777
798
|
# And save
|
778
|
-
install_manifest
|
799
|
+
install_manifest
|
800
|
+
end
|
801
|
+
|
802
|
+
# Update this workspace's installation manifest
|
803
|
+
#
|
804
|
+
# @param [Array<String>] package_names the name of the packages that
|
805
|
+
# should be updated
|
806
|
+
def export_installation_manifest
|
807
|
+
installation_manifest.save
|
779
808
|
end
|
780
809
|
|
781
810
|
# The environment as initialized by all selected packages
|
@@ -794,6 +823,20 @@ module Autoproj
|
|
794
823
|
full_env = self.full_env
|
795
824
|
changed = save_cached_env(full_env)
|
796
825
|
full_env.export_env_sh(shell_helpers: shell_helpers)
|
826
|
+
|
827
|
+
build_dir = Pathname(self.build_dir)
|
828
|
+
full_env.each_env_filename do |_, filename|
|
829
|
+
basename = File.basename(filename)
|
830
|
+
File.open(File.join(prefix_dir, basename), "w") do |io|
|
831
|
+
io.puts "source \"#{filename}\""
|
832
|
+
end
|
833
|
+
if build_dir.absolute?
|
834
|
+
build_dir.mkpath
|
835
|
+
(build_dir + basename).open("w") do |io|
|
836
|
+
io.puts "source \"#{filename}\""
|
837
|
+
end
|
838
|
+
end
|
839
|
+
end
|
797
840
|
changed
|
798
841
|
end
|
799
842
|
|
@@ -818,10 +861,12 @@ module Autoproj
|
|
818
861
|
if import_missing
|
819
862
|
ops = Autoproj::Ops::Import.new(self)
|
820
863
|
_, all_os_packages =
|
821
|
-
ops.import_packages(
|
822
|
-
|
823
|
-
|
824
|
-
|
864
|
+
ops.import_packages(
|
865
|
+
manifest.default_packages,
|
866
|
+
checkout_only: true, only_local: true, reset: false,
|
867
|
+
recursive: true, keep_going: true, parallel: parallel,
|
868
|
+
retry_count: 0
|
869
|
+
)
|
825
870
|
all_os_packages
|
826
871
|
else
|
827
872
|
manifest.all_selected_osdep_packages
|
@@ -833,7 +878,7 @@ module Autoproj
|
|
833
878
|
end
|
834
879
|
|
835
880
|
def install_os_repositories
|
836
|
-
return unless os_package_installer.osdeps_mode.include?(
|
881
|
+
return unless os_package_installer.osdeps_mode.include?("os")
|
837
882
|
|
838
883
|
os_repository_installer.install_os_repositories
|
839
884
|
end
|
@@ -851,7 +896,7 @@ module Autoproj
|
|
851
896
|
# configure the package
|
852
897
|
# @return [PackageDefinition]
|
853
898
|
def define_package(package_type, package_name, block = nil,
|
854
|
-
|
899
|
+
package_set = manifest.main_package_set, file = nil)
|
855
900
|
autobuild_package = Autobuild.send(package_type, package_name)
|
856
901
|
register_package(autobuild_package, block, package_set, file)
|
857
902
|
end
|
@@ -867,7 +912,7 @@ module Autoproj
|
|
867
912
|
# configure the package
|
868
913
|
# @return [PackageDefinition]
|
869
914
|
def register_package(package, block = nil,
|
870
|
-
|
915
|
+
package_set = manifest.main_package_set, file = nil)
|
871
916
|
pkg = manifest.register_package(package, block, package_set, file)
|
872
917
|
pkg.autobuild.ws = self
|
873
918
|
pkg
|
@@ -886,7 +931,7 @@ module Autoproj
|
|
886
931
|
# @raise [ExecutableNotFound] if an executable file named `cmd` cannot
|
887
932
|
# be found
|
888
933
|
def which(cmd, _path_entries: nil)
|
889
|
-
Ops.which(cmd, path_entries: -> { full_env.value(
|
934
|
+
Ops.which(cmd, path_entries: -> { full_env.value("PATH") || Array.new })
|
890
935
|
end
|
891
936
|
end
|
892
937
|
|