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