autoproj 2.0.0.rc5 → 2.0.0.rc6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/autoproj_bootstrap +158 -115
- data/bin/autoproj_install +159 -116
- data/bin/autoproj_install.in +1 -1
- data/lib/autoproj/autobuild.rb +2 -2
- data/lib/autoproj/cli/main.rb +13 -13
- data/lib/autoproj/cli/switch_config.rb +7 -2
- data/lib/autoproj/cli/update.rb +1 -8
- data/lib/autoproj/configuration.rb +10 -0
- data/lib/autoproj/environment.rb +3 -5
- data/lib/autoproj/ops/import.rb +5 -1
- data/lib/autoproj/ops/install.rb +158 -115
- data/lib/autoproj/ops/snapshot.rb +11 -3
- data/lib/autoproj/os_package_installer.rb +1 -1
- data/lib/autoproj/os_package_resolver.rb +31 -51
- data/lib/autoproj/package_managers/bundler_manager.rb +29 -29
- data/lib/autoproj/package_managers/gem_manager.rb +1 -1
- data/lib/autoproj/package_managers/shell_script_manager.rb +1 -1
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +46 -9
- metadata +2 -3
- data/lib/autoproj/cli/upgrade.rb +0 -75
data/bin/autoproj_install.in
CHANGED
data/lib/autoproj/autobuild.rb
CHANGED
@@ -469,7 +469,7 @@ def only_on(*architectures)
|
|
469
469
|
end
|
470
470
|
end
|
471
471
|
|
472
|
-
os_names, os_versions = Autoproj
|
472
|
+
os_names, os_versions = Autoproj.workspace.operating_system
|
473
473
|
matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }
|
474
474
|
if matching_archs.empty?
|
475
475
|
return
|
@@ -494,7 +494,7 @@ def not_on(*architectures)
|
|
494
494
|
end
|
495
495
|
end
|
496
496
|
|
497
|
-
os_names, os_versions = Autoproj
|
497
|
+
os_names, os_versions = Autoproj.workspace.operating_system
|
498
498
|
matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }
|
499
499
|
if matching_archs.empty?
|
500
500
|
return yield
|
data/lib/autoproj/cli/main.rb
CHANGED
@@ -315,24 +315,24 @@ def query(query_string = nil)
|
|
315
315
|
desc: 'do not access the network (will fail if some gems are missing)'
|
316
316
|
option :gemfile, type: :string,
|
317
317
|
desc: 'path to a gemfile that should be used to install autoproj'
|
318
|
-
option :private_bundler, type: :boolean,
|
319
|
-
desc: 'install bundler inside the workspace instead of using the default Gem location'
|
320
|
-
option :private_gems, type: :boolean,
|
321
|
-
desc: 'install gems inside the workspace instead of using the default Gem location'
|
322
|
-
option :private_autoproj, type: :boolean,
|
323
|
-
desc: 'install bundler inside the workspace instead of using the default Gem location'
|
324
|
-
option :private, type: :boolean,
|
325
|
-
desc: 'equivalent to --private-bundler --private-autoproj --private-gems'
|
326
318
|
def upgrade
|
327
|
-
require 'autoproj/
|
328
|
-
Autoproj::
|
319
|
+
require 'autoproj/ops/install'
|
320
|
+
installer = Autoproj::Ops::Install.new(Dir.pwd)
|
321
|
+
|
322
|
+
if options.has_key?('local')
|
323
|
+
installer.local = options['local']
|
324
|
+
end
|
325
|
+
if options[:gemfile]
|
326
|
+
installer.gemfile = File.read(options[:gemfile])
|
327
|
+
end
|
328
|
+
installer.stage1
|
329
329
|
end
|
330
330
|
|
331
|
-
desc 'install_stage2 ROOT_DIR', 'used by autoproj_install to finalize the installation',
|
331
|
+
desc 'install_stage2 ROOT_DIR [ENVVAR=VALUE ...]', 'used by autoproj_install to finalize the installation',
|
332
332
|
hide: true
|
333
|
-
def install_stage2(root_dir)
|
333
|
+
def install_stage2(root_dir, *vars)
|
334
334
|
require 'autoproj/ops/install'
|
335
|
-
Autoproj::Ops::Install.new(root_dir).
|
335
|
+
Autoproj::Ops::Install.new(root_dir).stage2(*vars)
|
336
336
|
end
|
337
337
|
end
|
338
338
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'autoproj'
|
2
2
|
require 'autoproj/cli/base'
|
3
|
+
require 'autoproj/cli/update'
|
3
4
|
require 'autoproj/ops/main_config_switcher'
|
4
5
|
require 'autoproj/ops/configuration'
|
5
6
|
|
@@ -7,18 +8,22 @@ module Autoproj
|
|
7
8
|
module CLI
|
8
9
|
class SwitchConfig < Base
|
9
10
|
def run(args, options = Hash.new)
|
10
|
-
if
|
11
|
+
if !File.directory?(ws.config_dir)
|
12
|
+
raise ConfigError, "there's no autoproj/ directory in this workspace, use autoproj bootstrap to check out one"
|
13
|
+
elsif Dir.pwd.start_with?(ws.remotes_dir) || Dir.pwd.start_with?(ws.config_dir)
|
11
14
|
raise ConfigError, "you cannot run autoproj switch-config from autoproj's configuration directory or one of its subdirectories"
|
12
15
|
end
|
13
16
|
|
14
17
|
ws.load_config
|
18
|
+
ws.setup_os_package_installer
|
15
19
|
|
16
20
|
# We must switch to the root dir first, as it is required by the
|
17
21
|
# configuration switch code. This is acceptable as long as we
|
18
22
|
# quit just after the switch
|
19
23
|
switcher = Ops::MainConfigSwitcher.new(ws)
|
20
24
|
if switcher.switch_config(*args)
|
21
|
-
|
25
|
+
updater = Update.new(ws)
|
26
|
+
updater.run([], config: true)
|
22
27
|
end
|
23
28
|
end
|
24
29
|
end
|
data/lib/autoproj/cli/update.rb
CHANGED
@@ -49,14 +49,7 @@ def run(selected_packages, options)
|
|
49
49
|
ws.setup
|
50
50
|
parallel = options[:parallel] || ws.config.parallel_import_level
|
51
51
|
|
52
|
-
|
53
|
-
# unnecessarily redetecting the operating system
|
54
|
-
if options[:osdeps]
|
55
|
-
ws.config.set(
|
56
|
-
'operating_system',
|
57
|
-
Autoproj::OSPackageResolver.operating_system(:force => true),
|
58
|
-
true)
|
59
|
-
end
|
52
|
+
ws.autodetect_operating_system(force: true)
|
60
53
|
|
61
54
|
if options[:autoproj]
|
62
55
|
ws.update_autoproj
|
@@ -429,6 +429,16 @@ def utility_disable(utility, *packages)
|
|
429
429
|
def merge(conf)
|
430
430
|
config.merge!(conf.config)
|
431
431
|
end
|
432
|
+
|
433
|
+
# Whether the OS package handler should prefer installing OS-independent
|
434
|
+
# packages (as e.g. RubyGems) as opposed to the binary packages
|
435
|
+
# equivalent (e.g. thor as a gem vs. thor as the ruby-thor Ubuntu
|
436
|
+
# package)
|
437
|
+
#
|
438
|
+
# This is false by default
|
439
|
+
def prefer_indep_over_os_packages?
|
440
|
+
get('prefer_indep_over_os_packages', false)
|
441
|
+
end
|
432
442
|
end
|
433
443
|
end
|
434
444
|
|
data/lib/autoproj/environment.rb
CHANGED
@@ -12,12 +12,10 @@ def prepare(root_dir)
|
|
12
12
|
|
13
13
|
@root_dir = root_dir
|
14
14
|
set 'AUTOPROJ_CURRENT_ROOT', root_dir
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
find_all { |p| !Workspace.in_autoproj_project?(p) }
|
19
|
-
filtered.join(File::PATH_SEPARATOR)
|
20
|
-
end
|
17
|
+
def filter_original_env(name, env)
|
18
|
+
env.find_all { |p| !Workspace.in_autoproj_project?(p) }
|
21
19
|
end
|
22
20
|
|
23
21
|
def expand(value)
|
data/lib/autoproj/ops/import.rb
CHANGED
@@ -266,7 +266,11 @@ def finalize_package_load(processed_packages)
|
|
266
266
|
pkg.depends_on pkg_name
|
267
267
|
end
|
268
268
|
end
|
269
|
-
|
269
|
+
osdeps.each do |pkg_name|
|
270
|
+
if !manifest.ignored?(pkg_name) && !manifest.excluded?(pkg_name)
|
271
|
+
pkg.os_packages << pkg_name
|
272
|
+
end
|
273
|
+
end
|
270
274
|
pkg.prepare
|
271
275
|
Rake::Task["#{pkg.name}-prepare"].instance_variable_set(:@already_invoked, true)
|
272
276
|
pkg.update_environment
|
data/lib/autoproj/ops/install.rb
CHANGED
@@ -19,6 +19,8 @@ class UnexpectedBinstub < RuntimeError; end
|
|
19
19
|
attr_accessor :gemfile
|
20
20
|
# The environment that is passed to the bundler installs
|
21
21
|
attr_reader :env
|
22
|
+
# The configuration hash
|
23
|
+
attr_reader :config
|
22
24
|
|
23
25
|
def initialize(root_dir)
|
24
26
|
@root_dir = root_dir
|
@@ -28,9 +30,7 @@ def initialize(root_dir)
|
|
28
30
|
@gemfile = default_gemfile_contents
|
29
31
|
end
|
30
32
|
|
31
|
-
|
32
|
-
@private_autoproj = false
|
33
|
-
@private_gems = false
|
33
|
+
load_config
|
34
34
|
@local = false
|
35
35
|
@env = self.class.clean_env
|
36
36
|
end
|
@@ -42,7 +42,7 @@ def self.clean_env
|
|
42
42
|
%w{PATH GEM_HOME}.each do |name|
|
43
43
|
env[name] = sanitize_env(ENV[name] || "")
|
44
44
|
end
|
45
|
-
env['BUNDLE_GEMFILE'] =
|
45
|
+
env['BUNDLE_GEMFILE'] = []
|
46
46
|
env
|
47
47
|
end
|
48
48
|
|
@@ -53,6 +53,16 @@ def env_for_child
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
def apply_env(env)
|
57
|
+
env.each do |k, v|
|
58
|
+
if v
|
59
|
+
ENV[k] = v
|
60
|
+
else
|
61
|
+
ENV.delete(k)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
56
66
|
def self.sanitize_env(value)
|
57
67
|
value.split(File::PATH_SEPARATOR).
|
58
68
|
find_all { |p| !in_workspace?(p) }
|
@@ -71,7 +81,6 @@ def self.in_workspace?(base_dir)
|
|
71
81
|
|
72
82
|
|
73
83
|
def dot_autoproj; File.join(root_dir, '.autoproj') end
|
74
|
-
def bin_dir; File.join(dot_autoproj, 'bin') end
|
75
84
|
def bundler_install_dir; File.join(dot_autoproj, 'bundler') end
|
76
85
|
def autoproj_install_dir; File.join(dot_autoproj, 'autoproj') end
|
77
86
|
# The path to the gemfile used to install autoproj
|
@@ -86,16 +95,22 @@ def local=(flag); @local = flag end
|
|
86
95
|
# Whether bundler should be installed locally in {#dot_autoproj}
|
87
96
|
def private_bundler?; @private_bundler end
|
88
97
|
# (see #private_bundler?)
|
89
|
-
def private_bundler=(flag); @private_bundler = flag end
|
98
|
+
def private_bundler=(flag); @private_bundler = !!flag end
|
90
99
|
# Whether autoproj should be installed locally in {#dot_autoproj}
|
91
100
|
def private_autoproj?; @private_autoproj end
|
92
101
|
# (see #private_autoproj?)
|
93
|
-
def private_autoproj=(flag); @private_autoproj = flag end
|
102
|
+
def private_autoproj=(flag); @private_autoproj = !!flag end
|
94
103
|
# Whether bundler should be installed locally in the workspace
|
95
104
|
# prefix directory
|
96
105
|
def private_gems?; @private_gems end
|
97
106
|
# (see #private_gems?)
|
98
|
-
def private_gems=(flag); @private_gems = flag end
|
107
|
+
def private_gems=(flag); @private_gems = !!flag end
|
108
|
+
# Whether autoproj should prefer OS-independent packages over their
|
109
|
+
# OS-packaged equivalents (e.g. the thor gem vs. the ruby-thor
|
110
|
+
# Debian package)
|
111
|
+
def prefer_indep_over_os_packages?; @prefer_indep_over_os_packages end
|
112
|
+
# (see #private_gems?)
|
113
|
+
def prefer_indep_over_os_packages=(flag); @prefer_indep_over_os_packages = !!flag end
|
99
114
|
|
100
115
|
def guess_gem_program
|
101
116
|
ruby_bin = RbConfig::CONFIG['RUBY_INSTALL_NAME']
|
@@ -151,6 +166,9 @@ def parse_options(args = ARGV)
|
|
151
166
|
opt.on '--gemfile=PATH', String, 'use the given Gemfile to install autoproj instead of the default' do |path|
|
152
167
|
@gemfile = File.read(path)
|
153
168
|
end
|
169
|
+
opt.on '--prefer-os-independent-packages', 'prefer OS-independent packages (such as a RubyGem) over their OS-packaged equivalent (e.g. the thor gem vs. the ruby-thor debian package)' do
|
170
|
+
@prefer_indep_over_os_packages = true
|
171
|
+
end
|
154
172
|
end
|
155
173
|
options.parse(ARGV)
|
156
174
|
end
|
@@ -171,77 +189,72 @@ def install_bundler
|
|
171
189
|
STDERR.puts "FATAL: failed to install bundler in #{dot_autoproj}"
|
172
190
|
exit 1
|
173
191
|
end
|
174
|
-
env['
|
175
|
-
|
176
|
-
File.join(bin_dir, 'bundler')
|
192
|
+
env['PATH'].unshift File.join(bundler_install_dir, 'bin')
|
193
|
+
File.join(bundler_install_dir, 'bin', 'bundler')
|
177
194
|
end
|
178
195
|
|
179
|
-
def
|
180
|
-
env
|
181
|
-
|
196
|
+
def find_bundler
|
197
|
+
self.env['PATH'].unshift gem_bindir
|
198
|
+
clean_env = env_for_child
|
199
|
+
Gem.paths = Hash[
|
200
|
+
'GEM_HOME' => clean_env['GEM_HOME'] || Gem.default_dir,
|
201
|
+
'GEM_PATH' => clean_env['GEM_PATH'] || nil
|
202
|
+
]
|
182
203
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
204
|
+
bundler = find_in_clean_path('bundler')
|
205
|
+
if !bundler
|
206
|
+
clean_path = env_for_child['PATH']
|
207
|
+
STDERR.puts "cannot find 'bundler' in PATH=#{clean_path}"
|
208
|
+
STDERR.puts "installing it now ..."
|
209
|
+
result = system(clean_env, Gem.ruby, '-S', 'gem', 'install', 'bundler')
|
210
|
+
if !result
|
211
|
+
if ENV['PATH'] != clean_path
|
212
|
+
STDERR.puts " it appears that you already have some autoproj-generated env.sh loaded"
|
213
|
+
STDERR.puts " - if you are running 'autoproj upgrade', please contact the autoproj author at https://github.com/rock-core/autoproj/issues/new"
|
214
|
+
STDERR.puts " - if you are running an install, try again in a console where the env.sh is not loaded"
|
215
|
+
exit 1
|
216
|
+
else
|
217
|
+
STDERR.puts " the recommended action is to install it manually first by running 'gem install bundler'"
|
218
|
+
STDERR.puts " or call this command again with --private-bundler to have it installed in the workspace"
|
219
|
+
exit 1
|
220
|
+
end
|
189
221
|
end
|
190
|
-
end
|
191
|
-
env.push_path 'PATH', File.join(autoproj_install_dir, 'bin')
|
192
|
-
|
193
|
-
if private_autoproj?
|
194
|
-
env.push_path 'GEM_PATH', autoproj_install_dir
|
195
|
-
end
|
196
|
-
|
197
|
-
# Generate environment files right now, we can at least use bundler
|
198
|
-
File.open(File.join(dot_autoproj, 'env.sh'), 'w') do |io|
|
199
|
-
env.export_env_sh(io)
|
200
|
-
end
|
201
222
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
223
|
+
bundler = find_in_clean_path('bundler')
|
224
|
+
if !bundler
|
225
|
+
STDERR.puts "FATAL: gem install bundler returned successfully, but still cannot find bundler"
|
226
|
+
STDERR.puts "FATAL: in #{clean_path}"
|
227
|
+
end
|
207
228
|
end
|
208
|
-
end
|
209
229
|
|
210
|
-
|
211
|
-
FileUtils.mkdir_p File.dirname(autoproj_gemfile_path)
|
212
|
-
File.open(autoproj_gemfile_path, 'w') do |io|
|
213
|
-
io.write gemfile
|
214
|
-
end
|
230
|
+
bundler
|
215
231
|
end
|
216
232
|
|
217
|
-
ENV_BUNDLE_GEMFILE_RX = /^(\s*ENV\[['"]BUNDLE_GEMFILE['"]\]\s*)(?:\|\|)?=/
|
218
|
-
|
219
233
|
def install_autoproj(bundler)
|
220
234
|
# Force bundler to update. If the user does not want this, let him specify a
|
221
235
|
# Gemfile with tighter version constraints
|
222
|
-
lockfile = File.join(File.dirname(
|
236
|
+
lockfile = File.join(File.dirname(autoproj_install_dir), 'Gemfile.lock')
|
223
237
|
if File.exist?(lockfile)
|
224
238
|
FileUtils.rm lockfile
|
225
239
|
end
|
226
240
|
|
227
241
|
opts = Array.new
|
228
|
-
|
242
|
+
clean_env = env_for_child.merge('BUNDLE_GEMFILE' => nil)
|
229
243
|
|
230
|
-
|
244
|
+
opts << '--local' if local?
|
231
245
|
if private_autoproj?
|
232
|
-
|
233
|
-
|
234
|
-
'GEM_HOME' => nil)
|
246
|
+
clean_env['GEM_PATH'] = (bundler_install_dir if private_bundler?)
|
247
|
+
clean_env['GEM_HOME'] = nil
|
235
248
|
opts << "--clean" << "--path=#{autoproj_install_dir}"
|
236
249
|
end
|
237
|
-
|
238
250
|
binstubs_path = File.join(autoproj_install_dir, 'bin')
|
239
|
-
|
240
|
-
result = system(env,
|
251
|
+
result = system(clean_env,
|
241
252
|
Gem.ruby, bundler, 'install',
|
242
253
|
"--gemfile=#{autoproj_gemfile_path}",
|
254
|
+
"--shebang=#{Gem.ruby}",
|
243
255
|
"--binstubs=#{binstubs_path}",
|
244
|
-
*opts)
|
256
|
+
*opts, chdir: autoproj_install_dir)
|
257
|
+
|
245
258
|
if !result
|
246
259
|
STDERR.puts "FATAL: failed to install autoproj in #{dot_autoproj}"
|
247
260
|
exit 1
|
@@ -252,10 +265,6 @@ def install_autoproj(bundler)
|
|
252
265
|
# environment by default
|
253
266
|
Dir.glob(File.join(binstubs_path, '*')) do |path|
|
254
267
|
next if !File.file?(path)
|
255
|
-
# Do NOT do that for bundler, otherwise it will fail with an
|
256
|
-
# "already loaded gemfile" message once we e.g. try to do
|
257
|
-
# 'bundler install --gemfile=NEW_GEMFILE'
|
258
|
-
next if File.basename(path) == 'bundler'
|
259
268
|
|
260
269
|
lines = File.readlines(path)
|
261
270
|
matched = false
|
@@ -271,26 +280,53 @@ def install_autoproj(bundler)
|
|
271
280
|
end
|
272
281
|
end
|
273
282
|
|
274
|
-
env['PATH']
|
283
|
+
env['PATH'].unshift File.join(autoproj_install_dir, 'bin')
|
275
284
|
if private_autoproj?
|
276
|
-
env['GEM_PATH']
|
285
|
+
env['GEM_PATH'].unshift autoproj_install_dir
|
286
|
+
end
|
287
|
+
ensure
|
288
|
+
if binstubs_path
|
289
|
+
FileUtils.rm_f File.join(binstubs_path, 'bundler')
|
277
290
|
end
|
278
291
|
end
|
279
292
|
|
280
|
-
def
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
293
|
+
def save_env_sh(*vars)
|
294
|
+
env = Autobuild::Environment.new
|
295
|
+
env.prepare
|
296
|
+
vars.each do |kv|
|
297
|
+
k, *v = kv.split("=")
|
298
|
+
v = v.join("=")
|
299
|
+
|
300
|
+
if v.empty?
|
301
|
+
env.unset k
|
302
|
+
else
|
303
|
+
env.set k, *v.split(File::PATH_SEPARATOR)
|
304
|
+
end
|
285
305
|
end
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
306
|
+
# Generate environment files right now, we can at least use bundler
|
307
|
+
File.open(File.join(dot_autoproj, 'env.sh'), 'w') do |io|
|
308
|
+
env.export_env_sh(io)
|
309
|
+
end
|
310
|
+
|
311
|
+
# And now the root envsh
|
312
|
+
env = Autobuild::Environment.new
|
313
|
+
env.source_before File.join(dot_autoproj, 'env.sh')
|
314
|
+
env.set('AUTOPROJ_CURRENT_ROOT', root_dir)
|
315
|
+
File.open(File.join(root_dir, 'env.sh'), 'w') do |io|
|
316
|
+
env.export_env_sh(io)
|
291
317
|
end
|
292
318
|
end
|
293
319
|
|
320
|
+
def save_gemfile
|
321
|
+
FileUtils.mkdir_p File.dirname(autoproj_gemfile_path)
|
322
|
+
File.open(autoproj_gemfile_path, 'w') do |io|
|
323
|
+
io.write gemfile
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
ENV_BUNDLE_GEMFILE_RX = /^(\s*ENV\[['"]BUNDLE_GEMFILE['"]\]\s*)(?:\|\|)?=/
|
328
|
+
|
329
|
+
|
294
330
|
def find_in_clean_path(command)
|
295
331
|
clean_path = env_for_child['PATH'].split(File::PATH_SEPARATOR)
|
296
332
|
clean_path.each do |p|
|
@@ -302,12 +338,10 @@ def find_in_clean_path(command)
|
|
302
338
|
nil
|
303
339
|
end
|
304
340
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
'GEM_PATH' => clean_env['GEM_PATH'] || nil
|
310
|
-
]
|
341
|
+
# The path of the bin/ folder for installed gems
|
342
|
+
def gem_bindir
|
343
|
+
return @gem_bindir if @gem_bindir
|
344
|
+
|
311
345
|
# Here, we're getting into the esotheric
|
312
346
|
#
|
313
347
|
# The problem is that e.g. Ubuntu and Debian install an
|
@@ -318,30 +352,12 @@ def find_bundler
|
|
318
352
|
#
|
319
353
|
# So, we're calling 'gem' as a subcommand to discovery the
|
320
354
|
# actual bindir
|
321
|
-
bindir = IO.popen(
|
355
|
+
bindir = IO.popen(env_for_child, [Gem.ruby, '-e', 'puts Gem.bindir']).read
|
322
356
|
if bindir
|
323
|
-
|
357
|
+
@gem_bindir = bindir.chomp
|
324
358
|
else
|
325
|
-
|
326
|
-
exit 1
|
359
|
+
raise "FATAL: cannot run #{Gem.ruby} -e 'puts Gem.bindir'"
|
327
360
|
end
|
328
|
-
|
329
|
-
bundler = find_in_clean_path('bundler')
|
330
|
-
if !bundler
|
331
|
-
clean_path = env_for_child['PATH']
|
332
|
-
STDERR.puts "FATAL: cannot find 'bundler' in PATH=#{clean_path}"
|
333
|
-
if ENV['PATH'] != clean_path
|
334
|
-
STDERR.puts " it appears that you already have some autoproj-generated env.sh loaded"
|
335
|
-
STDERR.puts " - if you are running 'autoproj upgrade', please contact the autoproj author at https://github.com/rock-core/autoproj/issues/new"
|
336
|
-
STDERR.puts " - if you are running an install, try again in a console where the env.sh is not loaded"
|
337
|
-
exit 1
|
338
|
-
else
|
339
|
-
STDERR.puts " the recommended action is to install it manually first by running 'gem install bundler'"
|
340
|
-
STDERR.puts " or call this command again with --private-bundler to have it installed in the workspace"
|
341
|
-
exit 1
|
342
|
-
end
|
343
|
-
end
|
344
|
-
bundler
|
345
361
|
end
|
346
362
|
|
347
363
|
def install
|
@@ -357,27 +373,54 @@ def install
|
|
357
373
|
install_autoproj(bundler)
|
358
374
|
end
|
359
375
|
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
376
|
+
def load_config
|
377
|
+
v1_config_path = File.join(root_dir, 'autoproj', 'config.yml')
|
378
|
+
|
379
|
+
config = Hash.new
|
380
|
+
if File.file?(v1_config_path)
|
381
|
+
config.merge!(YAML.load(File.read(v1_config_path)))
|
382
|
+
end
|
383
|
+
if File.file?(autoproj_config_path)
|
384
|
+
config.merge!(YAML.load(File.read(autoproj_config_path)))
|
385
|
+
end
|
367
386
|
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
else
|
372
|
-
ENV.delete(k)
|
373
|
-
end
|
374
|
-
end
|
375
|
-
ENV['BUNDLE_GEMFILE'] = autoproj_gemfile_path
|
376
|
-
update_configuration
|
377
|
-
exec Gem.ruby, File.join(autoproj_install_dir, 'bin', 'autoproj'),
|
378
|
-
'install-stage2', root_dir
|
387
|
+
@config = config
|
388
|
+
%w{private_bundler private_gems private_autoproj prefer_indep_over_os_packages}.each do |flag|
|
389
|
+
instance_variable_set "@#{flag}", config.fetch(flag, false)
|
379
390
|
end
|
380
391
|
end
|
392
|
+
|
393
|
+
def save_config
|
394
|
+
config['private_bundler'] = private_bundler?
|
395
|
+
config['private_autoproj'] = private_autoproj?
|
396
|
+
config['private_gems'] = private_gems?
|
397
|
+
config['prefer_indep_over_os_packages'] = prefer_indep_over_os_packages?
|
398
|
+
File.open(autoproj_config_path, 'w') { |io| YAML.dump(config, io) }
|
399
|
+
end
|
400
|
+
|
401
|
+
def stage1
|
402
|
+
FileUtils.mkdir_p dot_autoproj
|
403
|
+
save_config
|
404
|
+
install
|
405
|
+
|
406
|
+
clean_env = env_for_child
|
407
|
+
stage2_vars = clean_env.map { |k, v| "#{k}=#{v}" }
|
408
|
+
puts "starting the newly installed autoproj for stage2 install"
|
409
|
+
puts [clean_env.merge('BUNDLE_GEMFILE' => autoproj_gemfile_path),
|
410
|
+
Gem.ruby, File.join(autoproj_install_dir, 'bin', 'autoproj'),
|
411
|
+
'install-stage2', root_dir, *stage2_vars].inspect
|
412
|
+
exec clean_env.merge('BUNDLE_GEMFILE' => autoproj_gemfile_path),
|
413
|
+
Gem.ruby, File.join(autoproj_install_dir, 'bin', 'autoproj'),
|
414
|
+
'install-stage2', root_dir, *stage2_vars
|
415
|
+
end
|
416
|
+
|
417
|
+
def stage2(*vars)
|
418
|
+
require 'autobuild'
|
419
|
+
puts "saving env.sh and .autoproj/env.sh"
|
420
|
+
save_env_sh(*vars)
|
421
|
+
puts "calling autoproj envsh"
|
422
|
+
system(Gem.ruby, $0, 'envsh')
|
423
|
+
end
|
381
424
|
end
|
382
425
|
end
|
383
426
|
end
|