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
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
|
@@ -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
|
@@ -321,7 +325,7 @@ module Autoproj
|
|
321
325
|
ensure
|
322
326
|
Autobuild.progress_done :operating_system_autodetection
|
323
327
|
end
|
324
|
-
config.set(
|
328
|
+
config.set("operating_system", os_package_resolver.operating_system, true)
|
325
329
|
end
|
326
330
|
end
|
327
331
|
|
@@ -343,21 +347,27 @@ module Autoproj
|
|
343
347
|
end
|
344
348
|
|
345
349
|
def setup_ruby_version_handling
|
346
|
-
os_package_resolver.add_aliases(
|
350
|
+
os_package_resolver.add_aliases("ruby" => ruby_version_keyword)
|
347
351
|
osdep_suffixes << ruby_version_keyword
|
348
352
|
end
|
349
353
|
|
350
|
-
|
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)
|
351
359
|
setup_ruby_version_handling
|
352
360
|
migrate_bundler_and_autoproj_gem_layout
|
353
361
|
load_config
|
354
|
-
|
355
|
-
|
362
|
+
unless read_only
|
363
|
+
register_workspace
|
364
|
+
rewrite_shims
|
365
|
+
end
|
356
366
|
autodetect_operating_system
|
357
367
|
config.validate_ruby_executable
|
358
|
-
Autobuild.programs[
|
368
|
+
Autobuild.programs["ruby"] = config.ruby_executable
|
359
369
|
config.apply_autobuild_configuration
|
360
|
-
load_autoprojrc
|
370
|
+
load_autoprojrc if load_global_configuration
|
361
371
|
load_main_initrb
|
362
372
|
config.each_reused_autoproj_installation do |p|
|
363
373
|
manifest.reuse(p)
|
@@ -365,9 +375,11 @@ module Autoproj
|
|
365
375
|
manifest.load(manifest_file_path) if File.exist?(manifest_file_path)
|
366
376
|
|
367
377
|
Autobuild.prefix = prefix_dir
|
368
|
-
|
369
|
-
|
370
|
-
|
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
|
371
383
|
end
|
372
384
|
|
373
385
|
Autobuild.srcdir = source_dir
|
@@ -377,36 +389,36 @@ module Autoproj
|
|
377
389
|
os_package_installer.each_manager_with_name do |name, manager|
|
378
390
|
next unless manager.respond_to?(:cache_dir=)
|
379
391
|
|
380
|
-
manager_cache_path = File.join(cache_dir,
|
392
|
+
manager_cache_path = File.join(cache_dir, "package_managers", name)
|
381
393
|
if File.directory?(manager_cache_path)
|
382
394
|
manager.cache_dir = manager_cache_path
|
383
395
|
end
|
384
396
|
end
|
385
397
|
end
|
386
398
|
setup_os_package_installer
|
387
|
-
install_ruby_shims
|
399
|
+
install_ruby_shims unless read_only
|
388
400
|
end
|
389
401
|
|
390
402
|
def install_ruby_shims
|
391
403
|
install_suffix = ""
|
392
|
-
if (match = /ruby(.*)$/.match(RbConfig::CONFIG[
|
404
|
+
if (match = /ruby(.*)$/.match(RbConfig::CONFIG["RUBY_INSTALL_NAME"]))
|
393
405
|
install_suffix = match[1]
|
394
406
|
end
|
395
407
|
|
396
|
-
bindir = File.join(prefix_dir,
|
408
|
+
bindir = File.join(prefix_dir, "bin")
|
397
409
|
FileUtils.mkdir_p bindir
|
398
|
-
env.add
|
410
|
+
env.add "PATH", bindir
|
399
411
|
|
400
|
-
Ops.atomic_write(File.join(bindir,
|
412
|
+
Ops.atomic_write(File.join(bindir, "ruby")) do |io|
|
401
413
|
io.puts "#! /bin/sh"
|
402
414
|
io.puts "exec #{config.ruby_executable} \"$@\""
|
403
415
|
end
|
404
|
-
FileUtils.chmod 0o755, File.join(bindir,
|
416
|
+
FileUtils.chmod 0o755, File.join(bindir, "ruby")
|
405
417
|
|
406
418
|
%w[gem irb testrb].each do |name|
|
407
419
|
# Look for the corresponding gem program
|
408
420
|
prg_name = "#{name}#{install_suffix}"
|
409
|
-
if File.file?(prg_path = File.join(RbConfig::CONFIG[
|
421
|
+
if File.file?(prg_path = File.join(RbConfig::CONFIG["bindir"], prg_name))
|
410
422
|
Ops.atomic_write(File.join(bindir, name)) do |io|
|
411
423
|
io.puts "#! #{config.ruby_executable}"
|
412
424
|
io.puts "exec \"#{prg_path}\", *ARGV"
|
@@ -417,14 +429,14 @@ module Autoproj
|
|
417
429
|
end
|
418
430
|
|
419
431
|
def rewrite_shims
|
420
|
-
gemfile = File.join(dot_autoproj_dir,
|
421
|
-
binstubs = File.join(dot_autoproj_dir,
|
432
|
+
gemfile = File.join(dot_autoproj_dir, "Gemfile")
|
433
|
+
binstubs = File.join(dot_autoproj_dir, "bin")
|
422
434
|
Ops::Install.rewrite_shims(binstubs, config.ruby_executable,
|
423
435
|
root_dir, gemfile, config.gems_gem_home)
|
424
436
|
end
|
425
437
|
|
426
438
|
def update_bundler
|
427
|
-
require
|
439
|
+
require "autoproj/ops/install"
|
428
440
|
gem_program = Ops::Install.guess_gem_program
|
429
441
|
install = Ops::Install.new(root_dir)
|
430
442
|
Autoproj.message " updating bundler"
|
@@ -440,13 +452,13 @@ module Autoproj
|
|
440
452
|
|
441
453
|
# This is a guard to avoid infinite recursion in case the user is
|
442
454
|
# running autoproj osdeps --force
|
443
|
-
return if ENV[
|
455
|
+
return if ENV["AUTOPROJ_RESTARTING"] == "1"
|
444
456
|
|
445
|
-
gemfile = File.join(dot_autoproj_dir,
|
446
|
-
binstubs = File.join(dot_autoproj_dir,
|
457
|
+
gemfile = File.join(dot_autoproj_dir, "Gemfile")
|
458
|
+
binstubs = File.join(dot_autoproj_dir, "bin")
|
447
459
|
if restart_on_update
|
448
460
|
old_autoproj_path = PackageManagers::BundlerManager.bundle_gem_path(
|
449
|
-
self,
|
461
|
+
self, "autoproj", gemfile: gemfile
|
450
462
|
)
|
451
463
|
end
|
452
464
|
begin
|
@@ -459,7 +471,7 @@ module Autoproj
|
|
459
471
|
end
|
460
472
|
if restart_on_update
|
461
473
|
new_autoproj_path = PackageManagers::BundlerManager.bundle_gem_path(
|
462
|
-
self,
|
474
|
+
self, "autoproj", gemfile: gemfile
|
463
475
|
)
|
464
476
|
end
|
465
477
|
|
@@ -473,8 +485,8 @@ module Autoproj
|
|
473
485
|
#
|
474
486
|
# ...But first save the configuration (!)
|
475
487
|
config.save
|
476
|
-
ENV[
|
477
|
-
require
|
488
|
+
ENV["AUTOPROJ_RESTARTING"] = "1"
|
489
|
+
require "rbconfig"
|
478
490
|
exec(config.ruby_executable, $PROGRAM_NAME, *ARGV)
|
479
491
|
end
|
480
492
|
end
|
@@ -483,7 +495,8 @@ module Autoproj
|
|
483
495
|
options =
|
484
496
|
if args.last.kind_of?(Hash)
|
485
497
|
args.pop
|
486
|
-
else
|
498
|
+
else
|
499
|
+
Hash.new
|
487
500
|
end
|
488
501
|
options_env = options.fetch(:env, Hash.new)
|
489
502
|
options[:env] = env.resolved_env.merge(options_env)
|
@@ -491,12 +504,12 @@ module Autoproj
|
|
491
504
|
end
|
492
505
|
|
493
506
|
def migrate_bundler_and_autoproj_gem_layout
|
494
|
-
if
|
495
|
-
|
496
|
-
else
|
497
|
-
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")
|
498
509
|
config = YAML.safe_load(File.read(config_path))
|
499
|
-
return if config[
|
510
|
+
return if config["gems_install_path"]
|
511
|
+
else
|
512
|
+
return
|
500
513
|
end
|
501
514
|
|
502
515
|
Autoproj.silent = false
|
@@ -539,11 +552,11 @@ module Autoproj
|
|
539
552
|
|
540
553
|
def self.find_path(xdg_var, xdg_path, home_path)
|
541
554
|
home_dir = begin Dir.home
|
542
|
-
|
543
|
-
|
544
|
-
|
555
|
+
rescue ArgumentError
|
556
|
+
return
|
557
|
+
end
|
545
558
|
|
546
|
-
xdg_path = File.join(XDG[xdg_var].to_path,
|
559
|
+
xdg_path = File.join(XDG[xdg_var].to_path, "autoproj", xdg_path)
|
547
560
|
home_path = File.join(home_dir, home_path)
|
548
561
|
|
549
562
|
if File.exist?(xdg_path)
|
@@ -556,25 +569,25 @@ module Autoproj
|
|
556
569
|
end
|
557
570
|
|
558
571
|
def self.find_user_config_path(xdg_path, home_path = xdg_path)
|
559
|
-
find_path(
|
572
|
+
find_path("CONFIG_HOME", xdg_path, home_path)
|
560
573
|
end
|
561
574
|
|
562
575
|
def self.rcfile_path
|
563
|
-
find_user_config_path(
|
576
|
+
find_user_config_path("rc", ".autoprojrc")
|
564
577
|
end
|
565
578
|
|
566
579
|
def self.find_user_data_path(xdg_path, home_path = xdg_path)
|
567
|
-
find_path(
|
580
|
+
find_path("DATA_HOME", xdg_path, File.join(".autoproj", home_path))
|
568
581
|
end
|
569
582
|
|
570
583
|
def self.find_user_cache_path(xdg_path, home_path = xdg_path)
|
571
|
-
find_path(
|
584
|
+
find_path("CACHE_HOME", xdg_path, File.join(".autoproj", home_path))
|
572
585
|
end
|
573
586
|
|
574
587
|
RegisteredWorkspace = Struct.new :root_dir, :prefix_dir, :build_dir
|
575
588
|
|
576
589
|
def self.registered_workspaces
|
577
|
-
path = find_user_data_path(
|
590
|
+
path = find_user_data_path("workspaces.yml")
|
578
591
|
if File.file?(path)
|
579
592
|
yaml = (YAML.safe_load(File.read(path)) || [])
|
580
593
|
fields = RegisteredWorkspace.members.map(&:to_s)
|
@@ -589,12 +602,12 @@ module Autoproj
|
|
589
602
|
|
590
603
|
def self.save_registered_workspaces(workspaces)
|
591
604
|
workspaces = workspaces.map do |w|
|
592
|
-
Hash[
|
593
|
-
|
594
|
-
|
605
|
+
Hash["root_dir" => w.root_dir,
|
606
|
+
"prefix_dir" => w.prefix_dir,
|
607
|
+
"build_dir" => w.build_dir]
|
595
608
|
end
|
596
609
|
|
597
|
-
path = find_user_data_path(
|
610
|
+
path = find_user_data_path("workspaces.yml")
|
598
611
|
FileUtils.mkdir_p(File.dirname(path))
|
599
612
|
Ops.atomic_write(path) do |io|
|
600
613
|
io.write YAML.dump(workspaces)
|
@@ -627,26 +640,26 @@ module Autoproj
|
|
627
640
|
end
|
628
641
|
|
629
642
|
def load_package_sets(only_local: false,
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
643
|
+
checkout_only: true,
|
644
|
+
reconfigure: false,
|
645
|
+
keep_going: false,
|
646
|
+
mainline: nil,
|
647
|
+
reset: false,
|
648
|
+
retry_count: nil)
|
636
649
|
return unless File.file?(manifest_file_path) # empty install, just return
|
637
650
|
|
638
|
-
Ops::Configuration.new(self)
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
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)
|
645
658
|
end
|
646
659
|
|
647
660
|
def load_packages(selection = manifest.default_packages(false), options = {})
|
648
|
-
options = Hash[warn_about_ignored_packages: true, checkout_only: true]
|
649
|
-
|
661
|
+
options = Hash[warn_about_ignored_packages: true, checkout_only: true]
|
662
|
+
.merge(options)
|
650
663
|
ops = Ops::Import.new(self)
|
651
664
|
ops.import_packages(selection, options)
|
652
665
|
end
|
@@ -682,7 +695,8 @@ module Autoproj
|
|
682
695
|
layout =
|
683
696
|
if config.randomize_layout?
|
684
697
|
Digest::SHA256.hexdigest(pkg_name)[0, 12]
|
685
|
-
else
|
698
|
+
else
|
699
|
+
manifest.whereis(pkg_name)
|
686
700
|
end
|
687
701
|
|
688
702
|
srcdir =
|
@@ -704,7 +718,7 @@ module Autoproj
|
|
704
718
|
pkg.builddir = compute_builddir(pkg) if pkg.respond_to?(:builddir)
|
705
719
|
|
706
720
|
pkg.prefix = File.join(prefix_dir, prefixdir)
|
707
|
-
pkg.doc_target_dir = File.join(prefix_dir,
|
721
|
+
pkg.doc_target_dir = File.join(prefix_dir, "doc", pkg_name)
|
708
722
|
pkg.logdir = File.join(pkg.prefix, "log")
|
709
723
|
end
|
710
724
|
|
@@ -749,26 +763,25 @@ module Autoproj
|
|
749
763
|
#
|
750
764
|
# This must be done after all ignores/excludes and package selection
|
751
765
|
# have been properly set up (a.k.a. after package import)
|
752
|
-
def finalize_setup
|
766
|
+
def finalize_setup(read_only: false)
|
753
767
|
# Finally, disable all ignored packages on the autobuild side
|
754
768
|
manifest.each_ignored_package(&:disable)
|
755
769
|
|
756
770
|
# We now have processed the process setup blocks. All configuration
|
757
771
|
# should be done and we can save the configuration data.
|
758
|
-
config.save
|
772
|
+
config.save unless read_only
|
759
773
|
end
|
760
774
|
|
761
775
|
def all_present_packages
|
762
|
-
manifest.each_autobuild_package
|
763
|
-
|
764
|
-
|
776
|
+
manifest.each_autobuild_package
|
777
|
+
.find_all { |pkg| File.directory?(pkg.srcdir) }
|
778
|
+
.map(&:name)
|
765
779
|
end
|
766
780
|
|
767
|
-
#
|
781
|
+
# Generate a {InstallationManifest} with the currently known information
|
768
782
|
#
|
769
|
-
# @
|
770
|
-
|
771
|
-
def export_installation_manifest
|
783
|
+
# @return [InstallationManifest]
|
784
|
+
def installation_manifest
|
772
785
|
selected_packages = manifest.all_selected_source_packages
|
773
786
|
install_manifest = InstallationManifest.new(installation_manifest_path)
|
774
787
|
|
@@ -783,7 +796,15 @@ module Autoproj
|
|
783
796
|
install_manifest.add_package(pkg)
|
784
797
|
end
|
785
798
|
# And save
|
786
|
-
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
|
787
808
|
end
|
788
809
|
|
789
810
|
# The environment as initialized by all selected packages
|
@@ -802,6 +823,20 @@ module Autoproj
|
|
802
823
|
full_env = self.full_env
|
803
824
|
changed = save_cached_env(full_env)
|
804
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
|
805
840
|
changed
|
806
841
|
end
|
807
842
|
|
@@ -843,7 +878,7 @@ module Autoproj
|
|
843
878
|
end
|
844
879
|
|
845
880
|
def install_os_repositories
|
846
|
-
return unless os_package_installer.osdeps_mode.include?(
|
881
|
+
return unless os_package_installer.osdeps_mode.include?("os")
|
847
882
|
|
848
883
|
os_repository_installer.install_os_repositories
|
849
884
|
end
|
@@ -861,7 +896,7 @@ module Autoproj
|
|
861
896
|
# configure the package
|
862
897
|
# @return [PackageDefinition]
|
863
898
|
def define_package(package_type, package_name, block = nil,
|
864
|
-
|
899
|
+
package_set = manifest.main_package_set, file = nil)
|
865
900
|
autobuild_package = Autobuild.send(package_type, package_name)
|
866
901
|
register_package(autobuild_package, block, package_set, file)
|
867
902
|
end
|
@@ -877,7 +912,7 @@ module Autoproj
|
|
877
912
|
# configure the package
|
878
913
|
# @return [PackageDefinition]
|
879
914
|
def register_package(package, block = nil,
|
880
|
-
|
915
|
+
package_set = manifest.main_package_set, file = nil)
|
881
916
|
pkg = manifest.register_package(package, block, package_set, file)
|
882
917
|
pkg.autobuild.ws = self
|
883
918
|
pkg
|
@@ -896,7 +931,7 @@ module Autoproj
|
|
896
931
|
# @raise [ExecutableNotFound] if an executable file named `cmd` cannot
|
897
932
|
# be found
|
898
933
|
def which(cmd, _path_entries: nil)
|
899
|
-
Ops.which(cmd, path_entries: -> { full_env.value(
|
934
|
+
Ops.which(cmd, path_entries: -> { full_env.value("PATH") || Array.new })
|
900
935
|
end
|
901
936
|
end
|
902
937
|
|
@@ -1,25 +1,25 @@
|
|
1
|
-
require
|
1
|
+
require "autoproj/shell_completion"
|
2
2
|
|
3
3
|
module Autoproj
|
4
4
|
# This class generates shell completion for code for a given Thor subclasss
|
5
5
|
class ZshCompletion < ShellCompletion
|
6
|
-
MAIN_FUNCTION_TEMPLATE =
|
7
|
-
SUBCOMMAND_FUNCTION_TEMPLATE =
|
6
|
+
MAIN_FUNCTION_TEMPLATE = "main.zsh.erb"
|
7
|
+
SUBCOMMAND_FUNCTION_TEMPLATE = "subcommand.zsh.erb"
|
8
8
|
|
9
9
|
def setup_file_completion(metadata)
|
10
|
-
metadata[:completer] =
|
10
|
+
metadata[:completer] = "_files"
|
11
11
|
end
|
12
12
|
|
13
13
|
def setup_executable_completion(metadata)
|
14
|
-
metadata[:completer] =
|
14
|
+
metadata[:completer] = "_path_commands"
|
15
15
|
end
|
16
16
|
|
17
17
|
def setup_package_completion(metadata)
|
18
|
-
metadata[:completer] =
|
18
|
+
metadata[:completer] = "_autoproj_installed_packages"
|
19
19
|
end
|
20
20
|
|
21
21
|
def disable_completion(metadata)
|
22
|
-
metadata[:completer] =
|
22
|
+
metadata[:completer] = ":"
|
23
23
|
end
|
24
24
|
|
25
25
|
def quote(s)
|
@@ -35,9 +35,8 @@ module Autoproj
|
|
35
35
|
if names.size == 1
|
36
36
|
names.first
|
37
37
|
else
|
38
|
-
|
38
|
+
"{#{names.join(',')}}"
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|