autoproj 2.14.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 +5 -7
- data/bin/amake +4 -4
- data/bin/aup +4 -4
- data/bin/autoproj +3 -3
- data/bin/autoproj_bootstrap +185 -182
- data/bin/autoproj_bootstrap.in +7 -8
- data/bin/autoproj_install +184 -181
- 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 +38 -34
- 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 +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 -84
- data/lib/autoproj/environment.rb +28 -13
- 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 +132 -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 +511 -506
- data/lib/autoproj/ops/import.rb +73 -63
- data/lib/autoproj/ops/install.rb +178 -174
- 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 +10 -10
- data/lib/autoproj/package_managers/bundler_manager.rb +147 -111
- 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 +20 -22
- 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 +32 -22
- 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 +27 -26
- data/lib/autoproj/package_selection.rb +187 -187
- data/lib/autoproj/package_set.rb +127 -113
- data/lib/autoproj/python.rb +55 -55
- 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 +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 +123 -107
- data/lib/autoproj/zsh_completion.rb +8 -9
- data/lib/autoproj.rb +53 -55
- data/samples/autoproj/init.rb +1 -2
- metadata +53 -51
- 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,7 +347,7 @@ 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
|
|
@@ -352,15 +355,17 @@ module Autoproj
|
|
352
355
|
#
|
353
356
|
# @param [Boolean] load_global_configuration if true, load the global
|
354
357
|
# autoprojrc file if it exists. Otherwise, ignore it.
|
355
|
-
def setup(load_global_configuration: true)
|
358
|
+
def setup(load_global_configuration: true, read_only: false)
|
356
359
|
setup_ruby_version_handling
|
357
360
|
migrate_bundler_and_autoproj_gem_layout
|
358
361
|
load_config
|
359
|
-
|
360
|
-
|
362
|
+
unless read_only
|
363
|
+
register_workspace
|
364
|
+
rewrite_shims
|
365
|
+
end
|
361
366
|
autodetect_operating_system
|
362
367
|
config.validate_ruby_executable
|
363
|
-
Autobuild.programs[
|
368
|
+
Autobuild.programs["ruby"] = config.ruby_executable
|
364
369
|
config.apply_autobuild_configuration
|
365
370
|
load_autoprojrc if load_global_configuration
|
366
371
|
load_main_initrb
|
@@ -370,9 +375,11 @@ module Autoproj
|
|
370
375
|
manifest.load(manifest_file_path) if File.exist?(manifest_file_path)
|
371
376
|
|
372
377
|
Autobuild.prefix = prefix_dir
|
373
|
-
|
374
|
-
|
375
|
-
|
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
|
376
383
|
end
|
377
384
|
|
378
385
|
Autobuild.srcdir = source_dir
|
@@ -382,36 +389,36 @@ module Autoproj
|
|
382
389
|
os_package_installer.each_manager_with_name do |name, manager|
|
383
390
|
next unless manager.respond_to?(:cache_dir=)
|
384
391
|
|
385
|
-
manager_cache_path = File.join(cache_dir,
|
392
|
+
manager_cache_path = File.join(cache_dir, "package_managers", name)
|
386
393
|
if File.directory?(manager_cache_path)
|
387
394
|
manager.cache_dir = manager_cache_path
|
388
395
|
end
|
389
396
|
end
|
390
397
|
end
|
391
398
|
setup_os_package_installer
|
392
|
-
install_ruby_shims
|
399
|
+
install_ruby_shims unless read_only
|
393
400
|
end
|
394
401
|
|
395
402
|
def install_ruby_shims
|
396
403
|
install_suffix = ""
|
397
|
-
if (match = /ruby(.*)$/.match(RbConfig::CONFIG[
|
404
|
+
if (match = /ruby(.*)$/.match(RbConfig::CONFIG["RUBY_INSTALL_NAME"]))
|
398
405
|
install_suffix = match[1]
|
399
406
|
end
|
400
407
|
|
401
|
-
bindir = File.join(prefix_dir,
|
408
|
+
bindir = File.join(prefix_dir, "bin")
|
402
409
|
FileUtils.mkdir_p bindir
|
403
|
-
env.add
|
410
|
+
env.add "PATH", bindir
|
404
411
|
|
405
|
-
Ops.atomic_write(File.join(bindir,
|
412
|
+
Ops.atomic_write(File.join(bindir, "ruby")) do |io|
|
406
413
|
io.puts "#! /bin/sh"
|
407
414
|
io.puts "exec #{config.ruby_executable} \"$@\""
|
408
415
|
end
|
409
|
-
FileUtils.chmod 0o755, File.join(bindir,
|
416
|
+
FileUtils.chmod 0o755, File.join(bindir, "ruby")
|
410
417
|
|
411
418
|
%w[gem irb testrb].each do |name|
|
412
419
|
# Look for the corresponding gem program
|
413
420
|
prg_name = "#{name}#{install_suffix}"
|
414
|
-
if File.file?(prg_path = File.join(RbConfig::CONFIG[
|
421
|
+
if File.file?(prg_path = File.join(RbConfig::CONFIG["bindir"], prg_name))
|
415
422
|
Ops.atomic_write(File.join(bindir, name)) do |io|
|
416
423
|
io.puts "#! #{config.ruby_executable}"
|
417
424
|
io.puts "exec \"#{prg_path}\", *ARGV"
|
@@ -422,14 +429,14 @@ module Autoproj
|
|
422
429
|
end
|
423
430
|
|
424
431
|
def rewrite_shims
|
425
|
-
gemfile = File.join(dot_autoproj_dir,
|
426
|
-
binstubs = File.join(dot_autoproj_dir,
|
432
|
+
gemfile = File.join(dot_autoproj_dir, "Gemfile")
|
433
|
+
binstubs = File.join(dot_autoproj_dir, "bin")
|
427
434
|
Ops::Install.rewrite_shims(binstubs, config.ruby_executable,
|
428
435
|
root_dir, gemfile, config.gems_gem_home)
|
429
436
|
end
|
430
437
|
|
431
438
|
def update_bundler
|
432
|
-
require
|
439
|
+
require "autoproj/ops/install"
|
433
440
|
gem_program = Ops::Install.guess_gem_program
|
434
441
|
install = Ops::Install.new(root_dir)
|
435
442
|
Autoproj.message " updating bundler"
|
@@ -445,13 +452,13 @@ module Autoproj
|
|
445
452
|
|
446
453
|
# This is a guard to avoid infinite recursion in case the user is
|
447
454
|
# running autoproj osdeps --force
|
448
|
-
return if ENV[
|
455
|
+
return if ENV["AUTOPROJ_RESTARTING"] == "1"
|
449
456
|
|
450
|
-
gemfile = File.join(dot_autoproj_dir,
|
451
|
-
binstubs = File.join(dot_autoproj_dir,
|
457
|
+
gemfile = File.join(dot_autoproj_dir, "Gemfile")
|
458
|
+
binstubs = File.join(dot_autoproj_dir, "bin")
|
452
459
|
if restart_on_update
|
453
460
|
old_autoproj_path = PackageManagers::BundlerManager.bundle_gem_path(
|
454
|
-
self,
|
461
|
+
self, "autoproj", gemfile: gemfile
|
455
462
|
)
|
456
463
|
end
|
457
464
|
begin
|
@@ -464,7 +471,7 @@ module Autoproj
|
|
464
471
|
end
|
465
472
|
if restart_on_update
|
466
473
|
new_autoproj_path = PackageManagers::BundlerManager.bundle_gem_path(
|
467
|
-
self,
|
474
|
+
self, "autoproj", gemfile: gemfile
|
468
475
|
)
|
469
476
|
end
|
470
477
|
|
@@ -478,8 +485,8 @@ module Autoproj
|
|
478
485
|
#
|
479
486
|
# ...But first save the configuration (!)
|
480
487
|
config.save
|
481
|
-
ENV[
|
482
|
-
require
|
488
|
+
ENV["AUTOPROJ_RESTARTING"] = "1"
|
489
|
+
require "rbconfig"
|
483
490
|
exec(config.ruby_executable, $PROGRAM_NAME, *ARGV)
|
484
491
|
end
|
485
492
|
end
|
@@ -488,7 +495,8 @@ module Autoproj
|
|
488
495
|
options =
|
489
496
|
if args.last.kind_of?(Hash)
|
490
497
|
args.pop
|
491
|
-
else
|
498
|
+
else
|
499
|
+
Hash.new
|
492
500
|
end
|
493
501
|
options_env = options.fetch(:env, Hash.new)
|
494
502
|
options[:env] = env.resolved_env.merge(options_env)
|
@@ -496,12 +504,12 @@ module Autoproj
|
|
496
504
|
end
|
497
505
|
|
498
506
|
def migrate_bundler_and_autoproj_gem_layout
|
499
|
-
if
|
500
|
-
|
501
|
-
else
|
502
|
-
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")
|
503
509
|
config = YAML.safe_load(File.read(config_path))
|
504
|
-
return if config[
|
510
|
+
return if config["gems_install_path"]
|
511
|
+
else
|
512
|
+
return
|
505
513
|
end
|
506
514
|
|
507
515
|
Autoproj.silent = false
|
@@ -544,11 +552,11 @@ module Autoproj
|
|
544
552
|
|
545
553
|
def self.find_path(xdg_var, xdg_path, home_path)
|
546
554
|
home_dir = begin Dir.home
|
547
|
-
|
548
|
-
|
549
|
-
|
555
|
+
rescue ArgumentError
|
556
|
+
return
|
557
|
+
end
|
550
558
|
|
551
|
-
xdg_path = File.join(XDG[xdg_var].to_path,
|
559
|
+
xdg_path = File.join(XDG[xdg_var].to_path, "autoproj", xdg_path)
|
552
560
|
home_path = File.join(home_dir, home_path)
|
553
561
|
|
554
562
|
if File.exist?(xdg_path)
|
@@ -561,25 +569,25 @@ module Autoproj
|
|
561
569
|
end
|
562
570
|
|
563
571
|
def self.find_user_config_path(xdg_path, home_path = xdg_path)
|
564
|
-
find_path(
|
572
|
+
find_path("CONFIG_HOME", xdg_path, home_path)
|
565
573
|
end
|
566
574
|
|
567
575
|
def self.rcfile_path
|
568
|
-
find_user_config_path(
|
576
|
+
find_user_config_path("rc", ".autoprojrc")
|
569
577
|
end
|
570
578
|
|
571
579
|
def self.find_user_data_path(xdg_path, home_path = xdg_path)
|
572
|
-
find_path(
|
580
|
+
find_path("DATA_HOME", xdg_path, File.join(".autoproj", home_path))
|
573
581
|
end
|
574
582
|
|
575
583
|
def self.find_user_cache_path(xdg_path, home_path = xdg_path)
|
576
|
-
find_path(
|
584
|
+
find_path("CACHE_HOME", xdg_path, File.join(".autoproj", home_path))
|
577
585
|
end
|
578
586
|
|
579
587
|
RegisteredWorkspace = Struct.new :root_dir, :prefix_dir, :build_dir
|
580
588
|
|
581
589
|
def self.registered_workspaces
|
582
|
-
path = find_user_data_path(
|
590
|
+
path = find_user_data_path("workspaces.yml")
|
583
591
|
if File.file?(path)
|
584
592
|
yaml = (YAML.safe_load(File.read(path)) || [])
|
585
593
|
fields = RegisteredWorkspace.members.map(&:to_s)
|
@@ -594,12 +602,12 @@ module Autoproj
|
|
594
602
|
|
595
603
|
def self.save_registered_workspaces(workspaces)
|
596
604
|
workspaces = workspaces.map do |w|
|
597
|
-
Hash[
|
598
|
-
|
599
|
-
|
605
|
+
Hash["root_dir" => w.root_dir,
|
606
|
+
"prefix_dir" => w.prefix_dir,
|
607
|
+
"build_dir" => w.build_dir]
|
600
608
|
end
|
601
609
|
|
602
|
-
path = find_user_data_path(
|
610
|
+
path = find_user_data_path("workspaces.yml")
|
603
611
|
FileUtils.mkdir_p(File.dirname(path))
|
604
612
|
Ops.atomic_write(path) do |io|
|
605
613
|
io.write YAML.dump(workspaces)
|
@@ -632,26 +640,26 @@ module Autoproj
|
|
632
640
|
end
|
633
641
|
|
634
642
|
def load_package_sets(only_local: false,
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
643
|
+
checkout_only: true,
|
644
|
+
reconfigure: false,
|
645
|
+
keep_going: false,
|
646
|
+
mainline: nil,
|
647
|
+
reset: false,
|
648
|
+
retry_count: nil)
|
641
649
|
return unless File.file?(manifest_file_path) # empty install, just return
|
642
650
|
|
643
|
-
Ops::Configuration.new(self)
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
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)
|
650
658
|
end
|
651
659
|
|
652
660
|
def load_packages(selection = manifest.default_packages(false), options = {})
|
653
|
-
options = Hash[warn_about_ignored_packages: true, checkout_only: true]
|
654
|
-
|
661
|
+
options = Hash[warn_about_ignored_packages: true, checkout_only: true]
|
662
|
+
.merge(options)
|
655
663
|
ops = Ops::Import.new(self)
|
656
664
|
ops.import_packages(selection, options)
|
657
665
|
end
|
@@ -687,7 +695,8 @@ module Autoproj
|
|
687
695
|
layout =
|
688
696
|
if config.randomize_layout?
|
689
697
|
Digest::SHA256.hexdigest(pkg_name)[0, 12]
|
690
|
-
else
|
698
|
+
else
|
699
|
+
manifest.whereis(pkg_name)
|
691
700
|
end
|
692
701
|
|
693
702
|
srcdir =
|
@@ -709,7 +718,7 @@ module Autoproj
|
|
709
718
|
pkg.builddir = compute_builddir(pkg) if pkg.respond_to?(:builddir)
|
710
719
|
|
711
720
|
pkg.prefix = File.join(prefix_dir, prefixdir)
|
712
|
-
pkg.doc_target_dir = File.join(prefix_dir,
|
721
|
+
pkg.doc_target_dir = File.join(prefix_dir, "doc", pkg_name)
|
713
722
|
pkg.logdir = File.join(pkg.prefix, "log")
|
714
723
|
end
|
715
724
|
|
@@ -754,26 +763,25 @@ module Autoproj
|
|
754
763
|
#
|
755
764
|
# This must be done after all ignores/excludes and package selection
|
756
765
|
# have been properly set up (a.k.a. after package import)
|
757
|
-
def finalize_setup
|
766
|
+
def finalize_setup(read_only: false)
|
758
767
|
# Finally, disable all ignored packages on the autobuild side
|
759
768
|
manifest.each_ignored_package(&:disable)
|
760
769
|
|
761
770
|
# We now have processed the process setup blocks. All configuration
|
762
771
|
# should be done and we can save the configuration data.
|
763
|
-
config.save
|
772
|
+
config.save unless read_only
|
764
773
|
end
|
765
774
|
|
766
775
|
def all_present_packages
|
767
|
-
manifest.each_autobuild_package
|
768
|
-
|
769
|
-
|
776
|
+
manifest.each_autobuild_package
|
777
|
+
.find_all { |pkg| File.directory?(pkg.srcdir) }
|
778
|
+
.map(&:name)
|
770
779
|
end
|
771
780
|
|
772
|
-
#
|
781
|
+
# Generate a {InstallationManifest} with the currently known information
|
773
782
|
#
|
774
|
-
# @
|
775
|
-
|
776
|
-
def export_installation_manifest
|
783
|
+
# @return [InstallationManifest]
|
784
|
+
def installation_manifest
|
777
785
|
selected_packages = manifest.all_selected_source_packages
|
778
786
|
install_manifest = InstallationManifest.new(installation_manifest_path)
|
779
787
|
|
@@ -788,7 +796,15 @@ module Autoproj
|
|
788
796
|
install_manifest.add_package(pkg)
|
789
797
|
end
|
790
798
|
# And save
|
791
|
-
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
|
792
808
|
end
|
793
809
|
|
794
810
|
# The environment as initialized by all selected packages
|
@@ -862,7 +878,7 @@ module Autoproj
|
|
862
878
|
end
|
863
879
|
|
864
880
|
def install_os_repositories
|
865
|
-
return unless os_package_installer.osdeps_mode.include?(
|
881
|
+
return unless os_package_installer.osdeps_mode.include?("os")
|
866
882
|
|
867
883
|
os_repository_installer.install_os_repositories
|
868
884
|
end
|
@@ -880,7 +896,7 @@ module Autoproj
|
|
880
896
|
# configure the package
|
881
897
|
# @return [PackageDefinition]
|
882
898
|
def define_package(package_type, package_name, block = nil,
|
883
|
-
|
899
|
+
package_set = manifest.main_package_set, file = nil)
|
884
900
|
autobuild_package = Autobuild.send(package_type, package_name)
|
885
901
|
register_package(autobuild_package, block, package_set, file)
|
886
902
|
end
|
@@ -896,7 +912,7 @@ module Autoproj
|
|
896
912
|
# configure the package
|
897
913
|
# @return [PackageDefinition]
|
898
914
|
def register_package(package, block = nil,
|
899
|
-
|
915
|
+
package_set = manifest.main_package_set, file = nil)
|
900
916
|
pkg = manifest.register_package(package, block, package_set, file)
|
901
917
|
pkg.autobuild.ws = self
|
902
918
|
pkg
|
@@ -915,7 +931,7 @@ module Autoproj
|
|
915
931
|
# @raise [ExecutableNotFound] if an executable file named `cmd` cannot
|
916
932
|
# be found
|
917
933
|
def which(cmd, _path_entries: nil)
|
918
|
-
Ops.which(cmd, path_entries: -> { full_env.value(
|
934
|
+
Ops.which(cmd, path_entries: -> { full_env.value("PATH") || Array.new })
|
919
935
|
end
|
920
936
|
end
|
921
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
|
-
|