autoproj 1.5.8 → 1.6.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Rakefile +38 -35
- data/bin/autoproj +1 -1
- data/doc/guide/src/autoproj_bootstrap +337 -92
- data/doc/guide/src/package_sets/index.page +3 -1
- data/lib/autoproj/autobuild.rb +67 -19
- data/lib/autoproj/cmdline.rb +93 -9
- data/lib/autoproj/manifest.rb +3 -2
- data/lib/autoproj/options.rb +17 -7
- data/lib/autoproj/osdeps.rb +250 -82
- data/lib/autoproj/system.rb +24 -2
- data/lib/autoproj/version.rb +1 -1
- metadata +11 -8
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
= Version 1.6.0
|
2
|
+
* version that will be used in the Orocos project
|
3
|
+
* the osdeps management is now fully configurable. What is means is that you
|
4
|
+
can ask autoproj to *not* install osdeps packages at all
|
5
|
+
|
1
6
|
= Version 1.5.8
|
2
7
|
* add a way to add some ignore regexp to the dependency tracking. Updated user
|
3
8
|
guide about that.
|
data/Rakefile
CHANGED
@@ -24,45 +24,11 @@ begin
|
|
24
24
|
['webgen', '>= 0.5.9'] <<
|
25
25
|
['rdoc', '>= 2.4.0']
|
26
26
|
end
|
27
|
-
|
28
|
-
Rake.clear_tasks(/dist:publish_docs/)
|
29
|
-
task 'publish_docs' => 'doc' do
|
30
|
-
if !system('doc/update_github')
|
31
|
-
raise "cannot update the gh-pages branch for GitHub"
|
32
|
-
end
|
33
|
-
if !system('git', 'push', 'origin', '+gh-pages')
|
34
|
-
raise "cannot push the documentation"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
desc "generate the bootstrap script"
|
39
|
-
task 'bootstrap' do
|
40
|
-
osdeps_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'osdeps.rb'))
|
41
|
-
osdeps_defaults = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'default.osdeps'))
|
42
|
-
# Filter rubygems dependencies from the OSdeps default. They will be
|
43
|
-
# installed at first build
|
44
|
-
osdeps = YAML.load(osdeps_defaults)
|
45
|
-
osdeps.delete_if do |name, content|
|
46
|
-
if content.respond_to?(:delete)
|
47
|
-
content.delete('gem')
|
48
|
-
content.empty?
|
49
|
-
else
|
50
|
-
content == 'gem'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
osdeps_defaults = YAML.dump(osdeps)
|
54
|
-
|
55
|
-
bootstrap_code = File.read(File.join(Dir.pwd, 'bin', 'autoproj_bootstrap.in')).
|
56
|
-
gsub('OSDEPS_CODE', osdeps_code).
|
57
|
-
gsub('OSDEPS_DEFAULTS', osdeps_defaults)
|
58
|
-
File.open(File.join(Dir.pwd, 'doc', 'guide', 'src', 'autoproj_bootstrap'), 'w') do |io|
|
59
|
-
io.write bootstrap_code
|
60
|
-
end
|
61
|
-
end
|
62
27
|
end
|
63
28
|
|
64
29
|
# Define our own documentation handling. Rake.clear_tasks is defined by Hoe
|
65
30
|
Rake.clear_tasks(/dist:(re|clobber_|)docs/)
|
31
|
+
Rake.clear_tasks(/dist:publish_docs/)
|
66
32
|
|
67
33
|
rescue LoadError
|
68
34
|
STDERR.puts "cannot load the Hoe gem. Distribution is disabled"
|
@@ -71,6 +37,43 @@ rescue Exception => e
|
|
71
37
|
STDERR.puts "error message is: #{e.message}"
|
72
38
|
end
|
73
39
|
|
40
|
+
namespace 'dist' do
|
41
|
+
task 'publish_docs' => 'doc' do
|
42
|
+
if !system('doc/update_github')
|
43
|
+
raise "cannot update the gh-pages branch for GitHub"
|
44
|
+
end
|
45
|
+
if !system('git', 'push', 'origin', '+gh-pages')
|
46
|
+
raise "cannot push the documentation"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "generate the bootstrap script"
|
51
|
+
task 'bootstrap' do
|
52
|
+
require 'yaml'
|
53
|
+
osdeps_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'osdeps.rb'))
|
54
|
+
osdeps_defaults = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'default.osdeps'))
|
55
|
+
# Filter rubygems dependencies from the OSdeps default. They will be
|
56
|
+
# installed at first build
|
57
|
+
osdeps = YAML.load(osdeps_defaults)
|
58
|
+
osdeps.delete_if do |name, content|
|
59
|
+
if content.respond_to?(:delete)
|
60
|
+
content.delete('gem')
|
61
|
+
content.empty?
|
62
|
+
else
|
63
|
+
content == 'gem'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
osdeps_defaults = YAML.dump(osdeps)
|
67
|
+
|
68
|
+
bootstrap_code = File.read(File.join(Dir.pwd, 'bin', 'autoproj_bootstrap.in')).
|
69
|
+
gsub('OSDEPS_CODE', osdeps_code).
|
70
|
+
gsub('OSDEPS_DEFAULTS', osdeps_defaults)
|
71
|
+
File.open(File.join(Dir.pwd, 'doc', 'guide', 'src', 'autoproj_bootstrap'), 'w') do |io|
|
72
|
+
io.write bootstrap_code
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
74
77
|
do_doc = begin
|
75
78
|
require 'webgen/webgentask'
|
76
79
|
require 'rdoc/task'
|
data/bin/autoproj
CHANGED
@@ -28,7 +28,7 @@ def report(debug)
|
|
28
28
|
rescue ConfigError => e
|
29
29
|
STDERR.puts
|
30
30
|
STDERR.puts color(e.message, :red, :bold)
|
31
|
-
root_dir = /^#{Regexp.quote(Autoproj.root_dir)}/
|
31
|
+
root_dir = /^#{Regexp.quote(Autoproj.root_dir)}(?!\/\.gems)/
|
32
32
|
e.backtrace.find_all { |path| path =~ root_dir }.
|
33
33
|
each do |path|
|
34
34
|
STDERR.puts color(" in #{path}", :red, :bold)
|
@@ -27,14 +27,25 @@ module Autoproj
|
|
27
27
|
class ConfigError < RuntimeError; end
|
28
28
|
class << self
|
29
29
|
attr_reader :verbose
|
30
|
+
attr_reader :config
|
30
31
|
end
|
32
|
+
@config = Hash.new
|
31
33
|
|
32
34
|
# Fake option management for the OSdeps class
|
33
|
-
def self.has_config_key?(
|
34
|
-
|
35
|
+
def self.has_config_key?(key)
|
36
|
+
config.has_key?(key)
|
35
37
|
end
|
36
|
-
|
37
|
-
|
38
|
+
|
39
|
+
def self.user_config(key)
|
40
|
+
config[key]
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.change_option(name, value, ignored = true)
|
44
|
+
config[name] = value
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.color(string, *args)
|
48
|
+
string
|
38
49
|
end
|
39
50
|
end
|
40
51
|
|
@@ -90,6 +101,8 @@ module Autoproj
|
|
90
101
|
|
91
102
|
class << self
|
92
103
|
attr_reader :aliases
|
104
|
+
attr_accessor :force_osdeps
|
105
|
+
attr_accessor :gem_with_prerelease
|
93
106
|
end
|
94
107
|
@aliases = Hash.new
|
95
108
|
|
@@ -217,11 +230,13 @@ module Autoproj
|
|
217
230
|
['gentoo', [version]]
|
218
231
|
elsif File.exists?('/etc/arch-release')
|
219
232
|
['arch', []]
|
220
|
-
else
|
221
|
-
raise ConfigError, "Unknown operating system"
|
222
233
|
end
|
223
234
|
end
|
224
235
|
|
236
|
+
if !@operating_system
|
237
|
+
return
|
238
|
+
end
|
239
|
+
|
225
240
|
# Normalize the names to lowercase
|
226
241
|
@operating_system =
|
227
242
|
[@operating_system[0].downcase,
|
@@ -257,62 +272,118 @@ module Autoproj
|
|
257
272
|
'arch' => 'pacman -Sy --noconfirm %s'
|
258
273
|
}
|
259
274
|
|
260
|
-
|
261
|
-
|
275
|
+
NO_PACKAGE = 0
|
276
|
+
WRONG_OS = 1
|
277
|
+
WRONG_OS_VERSION = 2
|
278
|
+
IGNORE = 3
|
279
|
+
PACKAGES = 4
|
280
|
+
SHELL_SNIPPET = 5
|
281
|
+
UNKNOWN_OS = 7
|
282
|
+
AVAILABLE = 10
|
283
|
+
|
284
|
+
# Check for the definition of +name+ for this operating system
|
262
285
|
#
|
263
|
-
#
|
264
|
-
|
286
|
+
# It can return
|
287
|
+
#
|
288
|
+
# NO_PACKAGE::
|
289
|
+
# there are no package definition for +name
|
290
|
+
# UNKNOWN_OS::
|
291
|
+
# this is not an OS autoproj knows how to deal with
|
292
|
+
# WRONG_OS::
|
293
|
+
# there are a package definition, but not for this OS
|
294
|
+
# WRONG_OS_VERSION::
|
295
|
+
# there is a package definition for this OS, but not for this
|
296
|
+
# particular version of the OS
|
297
|
+
# IGNORE::
|
298
|
+
# there is a package definition that told us to ignore the package
|
299
|
+
# [PACKAGES, definition]::
|
300
|
+
# +definition+ is an array of package names that this OS's package
|
301
|
+
# manager can understand
|
302
|
+
# [SHELL_SNIPPET, definition]::
|
303
|
+
# +definition+ is a string which is a shell snippet that will install
|
304
|
+
# the package
|
305
|
+
def resolve_package(name)
|
265
306
|
os_name, os_version = OSDependencies.operating_system
|
266
|
-
|
267
|
-
|
307
|
+
|
308
|
+
dep_def = definitions[name]
|
309
|
+
if !dep_def
|
310
|
+
return NO_PACKAGE
|
268
311
|
end
|
269
312
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
313
|
+
if !os_name
|
314
|
+
return UNKNOWN_OS
|
315
|
+
end
|
316
|
+
|
317
|
+
# Find a matching entry for the OS name
|
318
|
+
os_entry = dep_def.find do |name_list, data|
|
319
|
+
name_list.split(',').
|
320
|
+
map(&:downcase).
|
321
|
+
any? { |n| n == os_name }
|
322
|
+
end
|
323
|
+
|
324
|
+
if !os_entry
|
325
|
+
return WRONG_OS
|
326
|
+
end
|
327
|
+
|
328
|
+
data = os_entry.last
|
329
|
+
|
330
|
+
# This package does not need to be installed on this operating system (example: build tools on Gentoo)
|
331
|
+
if !data || data == "ignore"
|
332
|
+
return IGNORE
|
333
|
+
end
|
277
334
|
|
278
|
-
|
279
|
-
|
280
|
-
|
335
|
+
if data.kind_of?(Hash)
|
336
|
+
version_entry = data.find do |version_list, data|
|
337
|
+
version_list.to_s.split(',').
|
281
338
|
map(&:downcase).
|
282
|
-
any?
|
339
|
+
any? do |v|
|
340
|
+
os_version.any? { |osv| Regexp.new(v) =~ osv }
|
341
|
+
end
|
283
342
|
end
|
284
343
|
|
285
|
-
if !
|
286
|
-
|
344
|
+
if !version_entry
|
345
|
+
return WRONG_OS_VERSION
|
287
346
|
end
|
347
|
+
data = version_entry.last
|
348
|
+
end
|
288
349
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
350
|
+
if data.respond_to?(:to_ary)
|
351
|
+
return [PACKAGES, data]
|
352
|
+
elsif data.to_str =~ /\w+/
|
353
|
+
return [PACKAGES, [data.to_str]]
|
354
|
+
else
|
355
|
+
return [SHELL_SNIPPET, data.to_str]
|
356
|
+
end
|
357
|
+
end
|
293
358
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
end
|
301
|
-
end
|
359
|
+
# Resolves the given OS dependencies into the actual packages that need
|
360
|
+
# to be installed on this particular OS.
|
361
|
+
#
|
362
|
+
# Raises ConfigError if some packages can't be found
|
363
|
+
def resolve_os_dependencies(dependencies)
|
364
|
+
os_name, os_version = OSDependencies.operating_system
|
302
365
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
366
|
+
os_packages = []
|
367
|
+
shell_snippets = []
|
368
|
+
dependencies.each do |name|
|
369
|
+
result = resolve_package(name)
|
370
|
+
if result == NO_PACKAGE
|
371
|
+
raise ConfigError, "there is no osdeps definition for #{name}"
|
372
|
+
elsif result == WRONG_OS
|
373
|
+
raise ConfigError, "there is an osdeps definition for #{name}, but not for this operating system"
|
374
|
+
elsif result == WRONG_OS_VERSION
|
375
|
+
raise ConfigError, "there is an osdeps definition for #{name}, but no for this particular operating system version"
|
376
|
+
elsif result == IGNORE
|
377
|
+
next
|
378
|
+
elsif result[0] == PACKAGES
|
379
|
+
os_packages.concat(result[1])
|
380
|
+
elsif result[0] == SHELL_SNIPPET
|
381
|
+
shell_snippets << result[1]
|
307
382
|
end
|
383
|
+
end
|
308
384
|
|
309
|
-
|
310
|
-
|
311
|
-
elsif data.to_str =~ /\w+/
|
312
|
-
os_packages << data.to_str
|
313
|
-
else
|
314
|
-
shell_snippets << data.to_str
|
315
|
-
end
|
385
|
+
if !OS_PACKAGE_INSTALL.has_key?(os_name)
|
386
|
+
raise ConfigError, "I don't know how to install packages on #{os_name}"
|
316
387
|
end
|
317
388
|
|
318
389
|
return os_packages, shell_snippets
|
@@ -329,14 +400,27 @@ module Autoproj
|
|
329
400
|
"\n" + shell_snippets.join("\n")
|
330
401
|
end
|
331
402
|
|
332
|
-
# Returns true if
|
333
|
-
#
|
403
|
+
# Returns true if +name+ is an acceptable OS package for this OS and
|
404
|
+
# version
|
334
405
|
def has?(name)
|
406
|
+
availability_of(name) == AVAILABLE
|
407
|
+
end
|
408
|
+
|
409
|
+
# If +name+ is an osdeps that is available for this operating system,
|
410
|
+
# returns AVAILABLE. Otherwise, returns the same error code than
|
411
|
+
# resolve_package.
|
412
|
+
def availability_of(name)
|
335
413
|
osdeps, gemdeps = partition_packages([name].to_set)
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
414
|
+
if !osdeps.empty?
|
415
|
+
status = resolve_package(name)
|
416
|
+
if status.respond_to?(:to_ary) || status == IGNORE
|
417
|
+
AVAILABLE
|
418
|
+
else
|
419
|
+
status
|
420
|
+
end
|
421
|
+
else
|
422
|
+
AVAILABLE
|
423
|
+
end
|
340
424
|
end
|
341
425
|
|
342
426
|
# call-seq:
|
@@ -357,12 +441,10 @@ module Autoproj
|
|
357
441
|
package_set.to_set.each do |name|
|
358
442
|
pkg_def = definitions[name]
|
359
443
|
if !pkg_def
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
raise ConfigError, msg
|
444
|
+
# Error cases are taken care of later, because that is were
|
445
|
+
# the automatic/manual osdeps logic lies
|
446
|
+
osdeps << name
|
447
|
+
next
|
366
448
|
end
|
367
449
|
|
368
450
|
pkg_def = pkg_def.dup
|
@@ -373,6 +455,9 @@ module Autoproj
|
|
373
455
|
when "gem" then
|
374
456
|
gems << name
|
375
457
|
else
|
458
|
+
# This is *not* handled later, as is the absence of a
|
459
|
+
# package definition. The reason is that it is a bad
|
460
|
+
# configuration file, and should be fixed by the user
|
376
461
|
raise ConfigError, "unknown OS-independent package management type #{pkg_def} for #{name}"
|
377
462
|
end
|
378
463
|
else
|
@@ -403,19 +488,123 @@ module Autoproj
|
|
403
488
|
end
|
404
489
|
end
|
405
490
|
|
491
|
+
def filter_uptodate_gems(gems)
|
492
|
+
Autobuild.progress "looking for RubyGems updates"
|
493
|
+
|
494
|
+
# Don't install gems that are already there ...
|
495
|
+
gems = gems.dup
|
496
|
+
gems.delete_if do |name|
|
497
|
+
version_requirements = Gem::Requirement.default
|
498
|
+
installed = Gem.source_index.find_name(name, version_requirements)
|
499
|
+
if !installed.empty? && Autobuild.do_update
|
500
|
+
# Look if we can update the package ...
|
501
|
+
dep = Gem::Dependency.new(name, version_requirements)
|
502
|
+
available = gem_fetcher.find_matching(dep)
|
503
|
+
installed_version = installed.map(&:version).max
|
504
|
+
available_version = available.map { |(name, v), source| v }.max
|
505
|
+
needs_update = (available_version > installed_version)
|
506
|
+
!needs_update
|
507
|
+
else
|
508
|
+
!installed.empty?
|
509
|
+
end
|
510
|
+
end
|
511
|
+
gems
|
512
|
+
end
|
513
|
+
|
514
|
+
AUTOMATIC = true
|
515
|
+
MANUAL = false
|
516
|
+
WAIT = :wait
|
517
|
+
ASK = :ask
|
518
|
+
|
519
|
+
def automatic_osdeps_mode
|
520
|
+
if mode = ENV['AUTOPROJ_AUTOMATIC_OSDEPS']
|
521
|
+
mode =
|
522
|
+
if mode == 'true' then AUTOMATIC
|
523
|
+
elsif mode == 'false' then MANUAL
|
524
|
+
elsif mode == 'wait' then WAIT
|
525
|
+
else ASK
|
526
|
+
end
|
527
|
+
Autoproj.change_option('automatic_osdeps', mode, true)
|
528
|
+
mode
|
529
|
+
else
|
530
|
+
Autoproj.user_config('automatic_osdeps')
|
531
|
+
end
|
532
|
+
end
|
533
|
+
|
406
534
|
# Requests the installation of the given set of packages
|
407
535
|
def install(packages, package_osdeps = Hash.new)
|
536
|
+
os_def = OSDependencies.operating_system
|
408
537
|
osdeps, gems = partition_packages(packages, package_osdeps)
|
538
|
+
gems = filter_uptodate_gems(gems)
|
539
|
+
if osdeps.empty? && gems.empty?
|
540
|
+
return
|
541
|
+
end
|
542
|
+
|
543
|
+
if automatic_osdeps_mode == AUTOMATIC && !os_def && !osdeps.empty?
|
544
|
+
puts
|
545
|
+
puts Autoproj.color("==============================", :bold)
|
546
|
+
puts Autoproj.color("The packages that will be built require some other software to be installed", :bold)
|
547
|
+
puts " " + osdeps.join("\n ")
|
548
|
+
puts Autoproj.color("==============================", :bold)
|
549
|
+
puts
|
550
|
+
end
|
551
|
+
|
552
|
+
if !OSDependencies.force_osdeps && automatic_osdeps_mode != AUTOMATIC
|
553
|
+
puts
|
554
|
+
puts Autoproj.color("==============================", :bold)
|
555
|
+
puts Autoproj.color("The packages that will be built require some other software to be installed", :bold)
|
556
|
+
puts
|
557
|
+
if !osdeps.empty?
|
558
|
+
puts "From the operating system:"
|
559
|
+
puts " " + osdeps.join("\n ")
|
560
|
+
puts
|
561
|
+
end
|
562
|
+
if !gems.empty?
|
563
|
+
puts "From RubyGems:"
|
564
|
+
puts " " + gems.join("\n ")
|
565
|
+
puts
|
566
|
+
end
|
567
|
+
|
568
|
+
if automatic_osdeps_mode == ASK
|
569
|
+
print "Should I install these packages ? [yes] "
|
570
|
+
STDOUT.flush
|
571
|
+
do_osdeps = nil
|
572
|
+
while do_osdeps.nil?
|
573
|
+
answer = STDIN.readline.chomp
|
574
|
+
if answer == ''
|
575
|
+
do_osdeps = true
|
576
|
+
elsif answer == "no"
|
577
|
+
do_osdeps = false
|
578
|
+
elsif answer == 'yes'
|
579
|
+
do_osdeps = true
|
580
|
+
else
|
581
|
+
print "invalid answer. Please answer with 'yes' or 'no' "
|
582
|
+
STDOUT.flush
|
583
|
+
end
|
584
|
+
end
|
585
|
+
else
|
586
|
+
puts "Since you requested autoproj to not handle the osdeps automatically, you have to"
|
587
|
+
puts "do it yourself. Alternatively, you can run 'autoproj osdeps' and/or change to"
|
588
|
+
puts "automatic osdeps handling by running an autoproj operation with the --reconfigure"
|
589
|
+
puts "option (e.g. autoproj build --reconfigure)"
|
590
|
+
puts Autoproj.color("==============================", :bold)
|
591
|
+
puts
|
592
|
+
|
593
|
+
if automatic_osdeps_mode == WAIT
|
594
|
+
print "Press ENTER to continue "
|
595
|
+
STDOUT.flush
|
596
|
+
STDIN.readline
|
597
|
+
end
|
598
|
+
end
|
599
|
+
|
600
|
+
if !do_osdeps
|
601
|
+
return
|
602
|
+
end
|
603
|
+
end
|
409
604
|
|
410
605
|
did_something = false
|
411
606
|
|
412
|
-
|
413
|
-
# Unfortunately, this is C++ code and I don't want to install the
|
414
|
-
# whole ROS stack just for rosdep ...
|
415
|
-
#
|
416
|
-
# So, for now, reimplement rosdep by ourselves. Given how things
|
417
|
-
# are done, this is actually not so hard.
|
418
|
-
if !osdeps.empty?
|
607
|
+
if os_def && !osdeps.empty?
|
419
608
|
shell_script = generate_os_script(osdeps)
|
420
609
|
if Autoproj.verbose
|
421
610
|
Autoproj.progress "Installing non-ruby OS dependencies with"
|
@@ -435,35 +624,25 @@ module Autoproj
|
|
435
624
|
end
|
436
625
|
|
437
626
|
if !gems.empty?
|
438
|
-
|
439
|
-
# Don't install gems that are already there ...
|
440
|
-
gems.delete_if do |name|
|
441
|
-
version_requirements = Gem::Requirement.default
|
442
|
-
installed = Gem.source_index.find_name(name, version_requirements)
|
443
|
-
if !installed.empty? && Autobuild.do_update
|
444
|
-
# Look if we can update the package ...
|
445
|
-
dep = Gem::Dependency.new(name, version_requirements)
|
446
|
-
available = gem_fetcher.find_matching(dep)
|
447
|
-
installed_version = installed.map(&:version).max
|
448
|
-
available_version = available.map { |(name, v), source| v }.max
|
449
|
-
needs_update = (available_version > installed_version)
|
450
|
-
!needs_update
|
451
|
-
else
|
452
|
-
!installed.empty?
|
453
|
-
end
|
454
|
-
end
|
627
|
+
gems = filter_uptodate_gems(gems)
|
455
628
|
end
|
456
629
|
|
457
630
|
# Now install what is left
|
458
631
|
if !gems.empty?
|
459
632
|
guess_gem_program
|
460
|
-
|
461
633
|
if Autoproj.verbose
|
462
634
|
Autoproj.progress "Installing rubygems dependencies with"
|
463
635
|
Autoproj.progress "gem install #{gems.join(" ")}"
|
464
636
|
end
|
637
|
+
|
638
|
+
cmdline = [Autobuild.tool('gem'), 'install']
|
639
|
+
if Autobuild::OSDependencies.gem_with_prerelease
|
640
|
+
cmdline << "--prerelease"
|
641
|
+
end
|
642
|
+
cmdline.concat(gems)
|
643
|
+
|
465
644
|
Autobuild.progress "installing/updating RubyGems dependencies: #{gems.join(", ")}"
|
466
|
-
Autobuild::Subprocess.run 'autoproj', 'osdeps',
|
645
|
+
Autobuild::Subprocess.run 'autoproj', 'osdeps', *cmdline
|
467
646
|
did_something ||= true
|
468
647
|
end
|
469
648
|
|
@@ -560,6 +739,69 @@ rdoc: gem
|
|
560
739
|
|
561
740
|
EODEFS
|
562
741
|
|
742
|
+
operating_system = Autoproj::OSDependencies.operating_system
|
743
|
+
if !operating_system
|
744
|
+
puts <<-EOT
|
745
|
+
|
746
|
+
autoproj is usually able to handle the installation of operating system packages
|
747
|
+
himself. However, it does not know about your operating system, and will
|
748
|
+
therefore have to let you install the packages yourself.
|
749
|
+
|
750
|
+
It can still install the RubyGems packages that are required by the built
|
751
|
+
packages.
|
752
|
+
|
753
|
+
If you answer 'no' to the following question, autoproj will always go on,
|
754
|
+
assuming that all the required dependencies are already installed. If you answer
|
755
|
+
'yes', it will make sure that the RubyGems are installed himself, but it will
|
756
|
+
assume that you took care of the other packages. If you answer 'wait', it will
|
757
|
+
not install anything but will wait for you to press ENTER each time some
|
758
|
+
external software is needed. Finally, if you answer 'ask', it will ask you each
|
759
|
+
time what it should do when there is something to install
|
760
|
+
|
761
|
+
EOT
|
762
|
+
|
763
|
+
print "How should autoproj install RubyGems packages automatically (yes, no, wait or ask) ? [yes] "
|
764
|
+
STDOUT.flush
|
765
|
+
else
|
766
|
+
# Before doing *anything*, we have to ask the user if he wants us to install
|
767
|
+
# the osdeps ...
|
768
|
+
puts <<-EOT
|
769
|
+
|
770
|
+
autoproj is able to handle the installation of operating system packages
|
771
|
+
himself. This functionality will use 'sudo' to gain root access each time
|
772
|
+
it is needed.
|
773
|
+
|
774
|
+
If you answer 'no' to the following question, autoproj will go on, assuming that
|
775
|
+
all the required dependencies are already installed. If you answer 'yes', it
|
776
|
+
will make sure that they are installed himself. If you answer 'wait', it will
|
777
|
+
not install anything but wait for you to press ENTER each time some external
|
778
|
+
software is needed. Finally, if you answer 'ask', it will ask you what it
|
779
|
+
should do each time there is something to install.
|
780
|
+
|
781
|
+
EOT
|
782
|
+
print "Should autoproj install OS packages automatically (yes, no, wait or ask) ? [yes] "
|
783
|
+
STDOUT.flush
|
784
|
+
end
|
785
|
+
|
786
|
+
automatic_osdeps = nil
|
787
|
+
while automatic_osdeps.nil?
|
788
|
+
answer = STDIN.readline.chomp
|
789
|
+
if answer == ''
|
790
|
+
automatic_osdeps = true
|
791
|
+
elsif answer == "no"
|
792
|
+
automatic_osdeps = false
|
793
|
+
elsif answer == 'ask'
|
794
|
+
automatic_osdeps = :ask
|
795
|
+
elsif answer == 'yes'
|
796
|
+
automatic_osdeps = true
|
797
|
+
else
|
798
|
+
print "invalid answer. Please answer with 'yes', 'no' or 'ask' "
|
799
|
+
STDOUT.flush
|
800
|
+
end
|
801
|
+
end
|
802
|
+
Autoproj.config['automatic_osdeps'] =
|
803
|
+
automatic_osdeps
|
804
|
+
|
563
805
|
# First thing we do is install a proper ruby environment. We make sure that we
|
564
806
|
# aren't installing any gems for now (as we need to choose the right gem
|
565
807
|
# binary) by setting Autobuild.programs['gem'] to nil
|
@@ -582,10 +824,7 @@ USER_PACKAGES = %w{autoproj}
|
|
582
824
|
ENV['RUBYOPT'] = "-rubygems"
|
583
825
|
require 'rubygems'
|
584
826
|
|
585
|
-
packages = PACKAGES
|
586
|
-
if ARGV.first != "dev"
|
587
|
-
packages += USER_PACKAGES
|
588
|
-
end
|
827
|
+
packages = PACKAGES + USER_PACKAGES
|
589
828
|
|
590
829
|
begin
|
591
830
|
osdeps_management = Autoproj::OSDependencies.new(YAML.load(DEFS))
|
@@ -596,8 +835,14 @@ rescue Autoproj::ConfigError => e
|
|
596
835
|
exit(1)
|
597
836
|
end
|
598
837
|
|
599
|
-
if ARGV.first
|
600
|
-
|
838
|
+
if ARGV.first == "dev"
|
839
|
+
Autoproj::OSDependencies.gem_with_prerelease = true
|
840
|
+
end
|
841
|
+
|
842
|
+
ENV['AUTOPROJ_AUTOMATIC_OSDEPS'] = automatic_osdeps.to_s
|
843
|
+
if !system('autoproj', 'bootstrap', *ARGV)
|
844
|
+
STDERR.puts "ERROR: failed to run autoproj bootstrap #{ARGV.join(", ")}"
|
845
|
+
exit 1
|
601
846
|
end
|
602
847
|
|
603
848
|
File.open('env.sh', 'w') do |io|
|