autoproj 1.6.1 → 1.6.2.rc2

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.
data/Rakefile CHANGED
@@ -51,6 +51,7 @@ namespace 'dist' do
51
51
  task 'bootstrap' do
52
52
  require 'yaml'
53
53
  osdeps_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'osdeps.rb'))
54
+ options_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'options.rb'))
54
55
  osdeps_defaults = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'default.osdeps'))
55
56
  # Filter rubygems dependencies from the OSdeps default. They will be
56
57
  # installed at first build
@@ -67,6 +68,7 @@ namespace 'dist' do
67
68
 
68
69
  bootstrap_code = File.read(File.join(Dir.pwd, 'bin', 'autoproj_bootstrap.in')).
69
70
  gsub('OSDEPS_CODE', osdeps_code).
71
+ gsub('OPTIONS_CODE', options_code).
70
72
  gsub('OSDEPS_DEFAULTS', osdeps_defaults)
71
73
  File.open(File.join(Dir.pwd, 'doc', 'guide', 'src', 'autoproj_bootstrap'), 'w') do |io|
72
74
  io.write bootstrap_code
data/bin/autoproj CHANGED
@@ -21,8 +21,8 @@ end
21
21
  def report(debug)
22
22
  Autobuild::Reporting.report do
23
23
  yield
24
- Autobuild::Reporting.success
25
24
  end
25
+ Autobuild::Reporting.success
26
26
 
27
27
  rescue ConfigError => e
28
28
  STDERR.puts
@@ -51,7 +51,7 @@ Autoproj::OSDependencies.autodetect_ruby
51
51
  report(Autobuild.debug) do
52
52
  selected_packages =
53
53
  begin Autoproj::CmdLine.parse_arguments(ARGV.dup)
54
- rescue Exception => e
54
+ rescue RuntimeError => e
55
55
  if Autoproj::CmdLine.bootstrap? && !Autoproj.in_autoproj_installation?(Dir.pwd)
56
56
  STDERR.puts <<EOTEXT
57
57
 
@@ -86,8 +86,10 @@ EOTEXT
86
86
 
87
87
  # Basic initialization
88
88
  Autoproj::CmdLine.initialize
89
- Autoproj::CmdLine.update_myself
90
- Autoproj::CmdLine.update_configuration
89
+ if selected_packages.empty?
90
+ Autoproj::CmdLine.update_myself
91
+ Autoproj::CmdLine.update_configuration
92
+ end
91
93
  Autoproj::CmdLine.load_configuration
92
94
  manifest = Autoproj.manifest
93
95
 
@@ -154,6 +156,12 @@ EOTEXT
154
156
  all_enabled_packages = Autoproj::CmdLine.import_packages(selected_packages)
155
157
  Autoproj::CmdLine.snapshot(Autoproj::CmdLine.snapshot_dir, all_enabled_packages)
156
158
  exit(0)
159
+ elsif Autoproj::CmdLine.revshow_osdeps?
160
+ all_enabled_packages = Autoproj::CmdLine.import_packages(selected_packages)
161
+ Autoproj::CmdLine.revshow_osdeps(all_enabled_packages)
162
+ elsif Autoproj::CmdLine.show_osdeps?
163
+ all_enabled_packages = Autoproj::CmdLine.import_packages(selected_packages)
164
+ Autoproj::CmdLine.show_osdeps(all_enabled_packages)
157
165
  end
158
166
 
159
167
  STDERR.puts
@@ -165,36 +173,39 @@ EOTEXT
165
173
  Autoproj.osdeps.install(Autoproj.build_system_dependencies)
166
174
  end
167
175
 
168
- begin
169
- # Now, we actually do the import. Unfortunately, at this stage, we need to
170
- # import the package and its dependencies ourselves so that we are able to
171
- # build the list of packages that have actually been selected on the command
172
- # line.
173
- all_enabled_packages = Autoproj::CmdLine.import_packages(selected_packages)
174
-
175
- if Autoproj::CmdLine.build? || Autoproj::CmdLine.doc? || Autoproj::CmdLine.update_os_dependencies?
176
- if all_enabled_packages.empty?
177
- STDERR.puts color("autoproj: nothing to do", :bold)
178
- elsif Autoproj::CmdLine.build? || Autoproj::CmdLine.doc?
179
- Autoproj::CmdLine.build_packages(selected_packages, all_enabled_packages)
180
- elsif Autoproj::CmdLine.update_os_dependencies?
181
- manifest.install_os_dependencies(all_enabled_packages)
182
- end
176
+ # Now, we actually do the import. Unfortunately, at this stage, we need to
177
+ # import the package and its dependencies ourselves so that we are able to
178
+ # build the list of packages that have actually been selected on the command
179
+ # line.
180
+ all_enabled_packages = Autoproj::CmdLine.import_packages(selected_packages)
181
+
182
+ if all_enabled_packages.empty?
183
+ STDERR.puts color("autoproj: nothing to do", :bold)
184
+ elsif Autoproj::CmdLine.update_os_dependencies?
185
+ manifest.install_os_dependencies(all_enabled_packages)
186
+ elsif Autoproj::CmdLine.doc?
187
+ Autoproj::CmdLine.build_packages(selected_packages, all_enabled_packages)
188
+ elsif Autoproj::CmdLine.build?
189
+ begin
190
+ Autoproj::CmdLine.build_packages(selected_packages, all_enabled_packages)
183
191
 
184
192
  # Now, do some sanity checks on the result
185
193
  prefixes = all_enabled_packages.inject(Set.new) do |set, pkg_name|
186
194
  set << Autobuild::Package[pkg_name].prefix
187
195
  end
196
+
197
+ Autoproj.progress
198
+ Autoproj.progress "checking for undefined symbols in installed libraries", :bold
188
199
  prefixes.each do |prefix|
189
200
  libdir = File.join(prefix, "lib")
190
201
  if File.directory?(libdir)
191
202
  Autoproj.validate_solib_dependencies(libdir)
192
203
  end
193
204
  end
205
+ ensure
206
+ Autoproj.export_env_sh
207
+ STDERR.puts color("autoproj: updated #{Autoproj.root_dir}/env.sh", :green)
194
208
  end
195
- ensure
196
- Autoproj.export_env_sh
197
- STDERR.puts color("autoproj: updated #{Autoproj.root_dir}/env.sh", :green)
198
209
  end
199
210
  end
200
211
 
@@ -5,6 +5,30 @@ if RUBY_VERSION < "1.8.7"
5
5
  exit 1
6
6
  end
7
7
 
8
+ require 'set'
9
+ curdir_entries = Dir.entries('.').to_set - [".", "..", "autoproj_bootstrap", ".gems", 'env.sh'].to_set
10
+ if !curdir_entries.empty? && ENV['AUTOPROJ_BOOTSTRAP_IGNORE_NONEMPTY_DIR'] != '1'
11
+ while true
12
+ print "The current directory is not empty, continue bootstrapping anyway ? [yes] "
13
+ STDOUT.flush
14
+ answer = STDIN.readline.chomp
15
+ if answer == "no"
16
+ exit
17
+ elsif answer == "" || answer == "yes"
18
+ # Set the environment variable since we might restart the
19
+ # autoproj_bootstrap script and -- anyway -- will run "autoproj
20
+ # bootstrap" later on
21
+ break
22
+ else
23
+ STDOUT.puts "invalid answer. Please answer 'yes' or 'no'"
24
+ STDOUT.flush
25
+ end
26
+ end
27
+ end
28
+
29
+ # Environment is clean, so just mark it as so unconditionally
30
+ ENV['AUTOPROJ_BOOTSTRAP_IGNORE_NONEMPTY_DIR'] = '1'
31
+
8
32
  needed_gem_home = ENV['AUTOPROJ_GEM_HOME'] || "#{Dir.pwd}/.gems"
9
33
  if $LOADED_FEATURES.find { |str| str =~ /bygems/ }
10
34
  if ENV['GEM_HOME'] != needed_gem_home
@@ -27,26 +51,15 @@ module Autoproj
27
51
  class ConfigError < RuntimeError; end
28
52
  class << self
29
53
  attr_reader :verbose
30
- attr_reader :config
31
- end
32
- @config = Hash.new
33
-
34
- # Fake option management for the OSdeps class
35
- def self.has_config_key?(key)
36
- config.has_key?(key)
37
- end
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
54
  end
46
55
 
47
56
  def self.color(string, *args)
48
57
  string
49
58
  end
59
+
60
+ def self.progress(str)
61
+ STDERR.puts " #{str}"
62
+ end
50
63
  end
51
64
 
52
65
  module Autobuild
@@ -106,6 +119,9 @@ module Autoproj
106
119
  end
107
120
  @aliases = Hash.new
108
121
 
122
+ attr_writer :silent
123
+ def silent?; @silent end
124
+
109
125
  def self.alias(old_name, new_name)
110
126
  @aliases[new_name] = old_name
111
127
  end
@@ -138,17 +154,24 @@ module Autoproj
138
154
  # The Gem::SpecFetcher object that should be used to query RubyGems, and
139
155
  # install RubyGems packages
140
156
  def gem_fetcher
141
- @gem_fetcher ||= Gem::SpecFetcher.fetcher
157
+ if !@gem_fetcher
158
+ Autobuild.progress "looking for RubyGems updates"
159
+ @gem_fetcher = Gem::SpecFetcher.fetcher
160
+ end
161
+ @gem_fetcher
142
162
  end
143
163
 
144
164
  def initialize(defs = Hash.new, file = nil)
145
165
  @definitions = defs.to_hash
146
166
  @sources = Hash.new
167
+ @installed_packages = Array.new
147
168
  if file
148
169
  defs.each_key do |package_name|
149
170
  sources[package_name] = file
150
171
  end
151
172
  end
173
+ @silent = true
174
+ @filter_uptodate_packages = true
152
175
  end
153
176
 
154
177
  # Returns the full path to the osdeps file from which the package
@@ -194,10 +217,15 @@ module Autoproj
194
217
  # Returns true if it is possible to install packages for the operating
195
218
  # system on which we are installed
196
219
  def self.supported_operating_system?
197
- osdef = operating_system
198
- return false if !osdef
199
-
200
- OS_PACKAGE_INSTALL.has_key?(osdef[0])
220
+ if @supported_operating_system.nil?
221
+ osdef = operating_system
222
+ @supported_operating_system =
223
+ if !osdef then false
224
+ else
225
+ OS_AUTO_PACKAGE_INSTALL.has_key?(osdef[0])
226
+ end
227
+ end
228
+ return @supported_operating_system
201
229
  end
202
230
 
203
231
  # Autodetects the operating system name and version
@@ -214,11 +242,14 @@ module Autoproj
214
242
  if @operating_system
215
243
  return @operating_system
216
244
  elsif Autoproj.has_config_key?('operating_system')
217
- @operating_system = Autoproj.user_config('operating_system')
218
- elsif data = os_from_lsb
245
+ return (@operating_system = Autoproj.user_config('operating_system'))
246
+ end
247
+
248
+ Autoproj.progress " autodetecting the operating system"
249
+ if data = os_from_lsb
219
250
  if data[0] != "debian"
220
- # Fall back to reading debian_version, as
221
- # sid is listed as lenny by lsb-release
251
+ # if on Debian proper, fall back to reading debian_version,
252
+ # as sid is listed as lenny by lsb-release
222
253
  @operating_system = data
223
254
  end
224
255
  end
@@ -266,15 +297,48 @@ module Autoproj
266
297
  return [distributor, [codename, version]]
267
298
  end
268
299
 
300
+ # On a dpkg-enabled system, checks if the provided package is installed
301
+ # and returns true if it is the case
302
+ def self.dpkg_package_installed?(package_name)
303
+ if !@dpkg_installed_packages
304
+ @dpkg_installed_packages = Set.new
305
+ dpkg_status = File.readlines('/var/lib/dpkg/status')
306
+ dpkg_status.grep(/^(Package|Status)/).
307
+ each_slice(2) do |package, status|
308
+ if status.chomp == "Status: install ok installed"
309
+ @dpkg_installed_packages << package.split[1].chomp
310
+ end
311
+ end
312
+ end
313
+
314
+ if package_name =~ /^(\w[a-z0-9+-.]+)/
315
+ @dpkg_installed_packages.include?($1)
316
+ else
317
+ Autoproj.progress "WARN: #{package_name} is not a valid Debian package name"
318
+ false
319
+ end
320
+ end
269
321
 
270
322
  GAIN_ROOT_ACCESS = <<-EOSCRIPT
271
- if test `id -u` != "0"; then
272
- exec sudo /bin/bash $0 "$@"
273
-
274
- fi
323
+ # Gain root access using sudo
324
+ if test `id -u` != "0"; then
325
+ exec sudo /bin/bash $0 "$@"
326
+
327
+ fi
275
328
  EOSCRIPT
276
329
 
277
- OS_PACKAGE_INSTALL = {
330
+ OS_PACKAGE_CHECK = {
331
+ 'debian' => method(:dpkg_package_installed?),
332
+ 'ubuntu' => method(:dpkg_package_installed?)
333
+ }
334
+ OS_USER_PACKAGE_INSTALL = {
335
+ 'debian' => "apt-get install '%s'",
336
+ 'ubuntu' => "apt-get install '%s'",
337
+ 'gentoo' => "emerge '%s'",
338
+ 'arch' => "pacman '%s'"
339
+ }
340
+
341
+ OS_AUTO_PACKAGE_INSTALL = {
278
342
  'debian' => "export DEBIAN_FRONTEND=noninteractive; apt-get install -y '%s'",
279
343
  'ubuntu' => "export DEBIAN_FRONTEND=noninteractive; apt-get install -y '%s'",
280
344
  'gentoo' => "emerge --noreplace '%s'",
@@ -286,7 +350,6 @@ module Autoproj
286
350
  WRONG_OS_VERSION = 2
287
351
  IGNORE = 3
288
352
  PACKAGES = 4
289
- SHELL_SNIPPET = 5
290
353
  UNKNOWN_OS = 7
291
354
  AVAILABLE = 10
292
355
 
@@ -308,9 +371,6 @@ module Autoproj
308
371
  # [PACKAGES, definition]::
309
372
  # +definition+ is an array of package names that this OS's package
310
373
  # manager can understand
311
- # [SHELL_SNIPPET, definition]::
312
- # +definition+ is a string which is a shell snippet that will install
313
- # the package
314
374
  def resolve_package(name)
315
375
  os_name, os_version = OSDependencies.operating_system
316
376
 
@@ -346,7 +406,7 @@ module Autoproj
346
406
  version_list.to_s.split(',').
347
407
  map(&:downcase).
348
408
  any? do |v|
349
- os_version.any? { |osv| Regexp.new(v) =~ osv }
409
+ os_version.any? { |osv| Regexp.new(v) =~ osv }
350
410
  end
351
411
  end
352
412
 
@@ -361,7 +421,7 @@ module Autoproj
361
421
  elsif data.to_str =~ /\w+/
362
422
  return [PACKAGES, [data.to_str]]
363
423
  else
364
- return [SHELL_SNIPPET, data.to_str]
424
+ raise ConfigError, "invalid package specificiation #{data} in #{source_of(name)}"
365
425
  end
366
426
  end
367
427
 
@@ -373,7 +433,6 @@ module Autoproj
373
433
  os_name, os_version = OSDependencies.operating_system
374
434
 
375
435
  os_packages = []
376
- shell_snippets = []
377
436
  dependencies.each do |name|
378
437
  result = resolve_package(name)
379
438
  if result == NO_PACKAGE
@@ -381,32 +440,30 @@ module Autoproj
381
440
  elsif result == WRONG_OS
382
441
  raise ConfigError, "there is an osdeps definition for #{name}, but not for this operating system"
383
442
  elsif result == WRONG_OS_VERSION
384
- raise ConfigError, "there is an osdeps definition for #{name}, but no for this particular operating system version"
443
+ raise ConfigError, "there is an osdeps definition for #{name}, but not for this particular operating system version"
385
444
  elsif result == IGNORE
386
445
  next
387
446
  elsif result[0] == PACKAGES
388
447
  os_packages.concat(result[1])
389
- elsif result[0] == SHELL_SNIPPET
390
- shell_snippets << result[1]
391
448
  end
392
449
  end
393
450
 
394
- if !OS_PACKAGE_INSTALL.has_key?(os_name)
451
+ if !OS_AUTO_PACKAGE_INSTALL.has_key?(os_name)
395
452
  raise ConfigError, "I don't know how to install packages on #{os_name}"
396
453
  end
397
454
 
398
- return os_packages, shell_snippets
455
+ return os_packages
399
456
  end
400
457
 
401
458
 
402
- def generate_os_script(dependencies)
403
- os_name, os_version = OSDependencies.operating_system
404
- os_packages, shell_snippets = resolve_os_dependencies(dependencies)
405
-
406
- "#! /bin/bash\n" +
407
- GAIN_ROOT_ACCESS + "\n" +
408
- (OS_PACKAGE_INSTALL[os_name] % [os_packages.join("' '")]) +
409
- "\n" + shell_snippets.join("\n")
459
+ def generate_user_os_script(os_name, os_packages)
460
+ if OS_USER_PACKAGE_INSTALL[os_name]
461
+ (OS_USER_PACKAGE_INSTALL[os_name] % [os_packages.join("' '")])
462
+ else generate_auto_os_script(os_name, os_packages)
463
+ end
464
+ end
465
+ def generate_auto_os_script(os_name, os_packages)
466
+ (OS_AUTO_PACKAGE_INSTALL[os_name] % [os_packages.join("' '")])
410
467
  end
411
468
 
412
469
  # Returns true if +name+ is an acceptable OS package for this OS and
@@ -497,9 +554,25 @@ module Autoproj
497
554
  end
498
555
  end
499
556
 
500
- def filter_uptodate_gems(gems)
501
- Autobuild.progress "looking for RubyGems updates"
557
+ # Returns true if the osdeps system knows how to remove uptodate
558
+ # packages from the needs-to-be-installed package list on this OS
559
+ def can_filter_uptodate_packages?
560
+ os_name, _ = OSDependencies.operating_system
561
+ !!OS_PACKAGE_CHECK[os_name]
562
+ end
563
+
564
+ # Returns the set of packages in +packages+ that are not already
565
+ # installed on this OS, if it is supported
566
+ def filter_uptodate_os_packages(packages, os_name)
567
+ check_method = OS_PACKAGE_CHECK[os_name]
568
+ return packages.dup if !check_method
569
+
570
+ packages.find_all { |pkg| !check_method[pkg] }
571
+ end
502
572
 
573
+ # Returns the set of RubyGem packages in +packages+ that are not already
574
+ # installed, or that can be upgraded
575
+ def filter_uptodate_gems(gems)
503
576
  # Don't install gems that are already there ...
504
577
  gems = gems.dup
505
578
  gems.delete_if do |name|
@@ -520,143 +593,300 @@ module Autoproj
520
593
  gems
521
594
  end
522
595
 
523
- AUTOMATIC = true
524
- MANUAL = false
525
- WAIT = :wait
526
- ASK = :ask
596
+ HANDLE_ALL = 'all'
597
+ HANDLE_RUBY = 'ruby'
598
+ HANDLE_OS = 'os'
599
+ HANDLE_NONE = 'none'
600
+
601
+ def self.osdeps_mode_option_unsupported_os
602
+ long_doc =<<-EOT
603
+ The software packages that autoproj will have to build may require other
604
+ prepackaged softwares (a.k.a. OS dependencies) to be installed (RubyGems
605
+ packages, packages from your operating system/distribution, ...). Autoproj is
606
+ usually able to install those automatically, but unfortunately your operating
607
+ system is not (yet) supported by autoproj's osdeps mechanism, it can only offer
608
+ you some limited support.
609
+
610
+ RubyGem packages are a cross-platform mechanism, and are therefore supported.
611
+ However, you will have to install the kind of OS dependencies (so-called OS
612
+ packages)
613
+
614
+ This option is meant to allow you to control autoproj's behaviour while handling
615
+ OS dependencies.
616
+
617
+ * if you say "ruby", the RubyGem packages will be installed.
618
+ * if you say "none", autoproj will not do anything related to the OS
619
+ dependencies.
620
+
621
+ As any configuration value, the mode can be changed anytime by calling
622
+ an autoproj operation with the --reconfigure option (e.g. autoproj update
623
+ --reconfigure).
624
+
625
+ Finally, OS dependencies can be installed by calling "autoproj osdeps"
626
+ with the corresponding option (--all, --ruby, --os or --none). Calling
627
+ "autoproj osdeps" without arguments will also give you information as
628
+ to what you should install to compile the software successfully.
629
+ EOT
630
+ message = [ "Which prepackaged software (a.k.a. 'osdeps') should autoproj install automatically (ruby, none) ?", long_doc.strip ]
631
+
632
+ Autoproj.configuration_option 'osdeps_mode', 'string',
633
+ :default => 'ruby',
634
+ :doc => [short_doc, long_doc],
635
+ :possible_values => %w{ruby none},
636
+ :lowercase => true
637
+ end
527
638
 
528
- def automatic_osdeps_mode
529
- if mode = ENV['AUTOPROJ_AUTOMATIC_OSDEPS']
530
- mode =
531
- if mode == 'true' then AUTOMATIC
532
- elsif mode == 'false' then MANUAL
533
- elsif mode == 'wait' then WAIT
534
- else ASK
535
- end
536
- Autoproj.change_option('automatic_osdeps', mode, true)
537
- mode
639
+ def self.osdeps_mode_option_supported_os
640
+ long_doc =<<-EOT
641
+ The software packages that autoproj will have to build may require other
642
+ prepackaged softwares (a.k.a. OS dependencies) to be installed (RubyGems
643
+ packages, packages from your operating system/distribution, ...). Autoproj
644
+ is able to install those automatically for you.
645
+
646
+ Advanced users may want to control this behaviour. Additionally, the
647
+ installation of some packages require administration rights, which you may
648
+ not have. This option is meant to allow you to control autoproj's behaviour
649
+ while handling OS dependencies.
650
+
651
+ * if you say "all", it will install all packages automatically.
652
+ This requires root access thru 'sudo'
653
+ * if you say "ruby", only the Ruby packages will be installed.
654
+ Installing these packages does not require root access.
655
+ * if you say "os", only the OS-provided packages will be installed.
656
+ Installing these packages requires root access.
657
+ * if you say "none", autoproj will not do anything related to the
658
+ OS dependencies.
659
+
660
+ As any configuration value, the mode can be changed anytime by calling
661
+ an autoproj operation with the --reconfigure option (e.g. autoproj update
662
+ --reconfigure).
663
+
664
+ Finally, OS dependencies can be installed by calling "autoproj osdeps"
665
+ with the corresponding option (--all, --ruby, --os or --none).
666
+ EOT
667
+ message = [ "Which prepackaged software (a.k.a. 'osdeps') should autoproj install automatically (all, ruby, os, none) ?", long_doc.strip ]
668
+
669
+ Autoproj.configuration_option 'osdeps_mode', 'string',
670
+ :default => 'all',
671
+ :doc => message,
672
+ :possible_values => %w{all ruby os none},
673
+ :lowercase => true
674
+ end
675
+
676
+ def self.define_osdeps_mode_option
677
+ if supported_operating_system?
678
+ osdeps_mode_option_supported_os
538
679
  else
539
- Autoproj.user_config('automatic_osdeps')
680
+ osdeps_mode_option_unsupported_os
540
681
  end
541
682
  end
542
683
 
543
- # Requests the installation of the given set of packages
544
- def install(packages, package_osdeps = Hash.new)
545
- handled_os = OSDependencies.supported_operating_system?
546
- osdeps, gems = partition_packages(packages, package_osdeps)
547
- gems = filter_uptodate_gems(gems)
548
- if osdeps.empty? && gems.empty?
549
- return
684
+ def self.osdeps_mode_string_to_value(string)
685
+ string = string.downcase
686
+ case string
687
+ when 'all' then HANDLE_ALL
688
+ when 'ruby' then HANDLE_RUBY
689
+ when 'os' then HANDLE_OS
690
+ when 'none' then HANDLE_NONE
691
+ else raise ArgumentError, "invalid osdeps mode string '#{string}'"
550
692
  end
693
+ end
551
694
 
552
- if automatic_osdeps_mode == AUTOMATIC && !handled_os && !osdeps.empty?
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 " " + osdeps.join("\n ")
557
- puts Autoproj.color("==============================", :bold)
558
- puts
559
- end
560
-
561
- if !OSDependencies.force_osdeps && automatic_osdeps_mode != AUTOMATIC
562
- puts
563
- puts Autoproj.color("==============================", :bold)
564
- puts Autoproj.color("The packages that will be built require some other software to be installed", :bold)
565
- puts
566
- if !osdeps.empty?
567
- puts "From the operating system:"
568
- puts " " + osdeps.join("\n ")
569
- puts
570
- end
571
- if !gems.empty?
572
- puts "From RubyGems:"
573
- puts " " + gems.join("\n ")
574
- puts
575
- end
695
+ # If set to true (the default), #install will try to remove the list of
696
+ # already uptodate packages from the installed packages. Set to false to
697
+ # install all packages regardless of their status
698
+ attr_accessor :filter_uptodate_packages
699
+
700
+ # Override the osdeps mode
701
+ def osdeps_mode=(value)
702
+ @osdeps_mode = OSDependencies.osdeps_mode_string_to_value(value)
703
+ end
704
+
705
+ # Returns the osdeps mode chosen by the user
706
+ def osdeps_mode
707
+ # This has two uses. It caches the value extracted from the
708
+ # AUTOPROJ_OSDEPS_MODE and/or configuration file. Moreover, it
709
+ # allows to override the osdeps mode by using
710
+ # OSDependencies#osdeps_mode=
711
+ if @osdeps_mode
712
+ return @osdeps_mode
713
+ end
714
+
715
+ @osdeps_mode = OSDependencies.osdeps_mode
716
+ end
576
717
 
577
- if automatic_osdeps_mode == ASK
578
- if !handled_os
579
- if gems.empty?
580
- # Nothing we can do, but the users required "ASK".
581
- # So, at least, let him press enter
582
- print "There are external packages, but I can't install them on this OS. Press ENTER to continue"
583
- STDOUT.flush
584
- STDIN.readline
585
- do_osdeps = false
586
- else
587
- print "Should I install the RubyGems packages ? [yes] "
718
+ def self.osdeps_mode
719
+ puts caller.join("\n ")
720
+ while true
721
+ mode =
722
+ if !Autoproj.has_config_key?('osdeps_mode') &&
723
+ mode_name = ENV['AUTOPROJ_OSDEPS_MODE']
724
+ begin OSDependencies.osdeps_mode_string_to_value(mode_name)
725
+ rescue ArgumentError
726
+ Autoproj.warn "invalid osdeps mode given through AUTOPROJ_OSDEPS_MODE (#{mode})"
727
+ nil
588
728
  end
589
729
  else
590
- print "Should I install these packages ? [yes] "
591
- end
592
- STDOUT.flush
593
-
594
- do_osdeps = nil
595
- while do_osdeps.nil?
596
- answer = STDIN.readline.chomp
597
- if answer == ''
598
- do_osdeps = true
599
- elsif answer == "no"
600
- do_osdeps = false
601
- elsif answer == 'yes'
602
- do_osdeps = true
603
- else
604
- print "invalid answer. Please answer with 'yes' or 'no' "
605
- STDOUT.flush
730
+ mode_name = Autoproj.user_config('osdeps_mode')
731
+ begin OSDependencies.osdeps_mode_string_to_value(mode_name)
732
+ rescue ArgumentError
733
+ Autoproj.warn "invalid osdeps mode stored in configuration file"
734
+ nil
606
735
  end
607
736
  end
737
+
738
+ if mode
739
+ @osdeps_mode = mode
740
+ return mode
741
+ end
742
+
743
+ # Invalid configuration values. Retry
744
+ Autoproj.reset_option('osdeps_mode')
745
+ ENV['AUTOPROJ_OSDEPS_MODE'] = nil
746
+ end
747
+ end
748
+
749
+ # The set of packages that have already been installed
750
+ attr_reader :installed_packages
751
+
752
+ def osdeps_interaction_unknown_os(osdeps)
753
+ puts <<-EOMSG
754
+ #{Autoproj.color("The build process requires some other software packages to be installed on our operating system", :bold)}
755
+ #{Autoproj.color("If they are already installed, simply ignore this message", :red)}"
756
+
757
+ #{osdeps.join("\n ")}
758
+
759
+ EOMSG
760
+ print Autoproj.color("Press ENTER to continue", :bold)
761
+ STDOUT.flush
762
+ STDIN.readline
763
+ puts
764
+ nil
765
+ end
766
+
767
+ def osdeps_interaction(osdeps, os_packages, shell_script, silent)
768
+ if !OSDependencies.supported_operating_system?
769
+ if silent
770
+ return false
608
771
  else
609
- puts "Since you requested autoproj to not handle the osdeps automatically, you have to"
610
- puts "do it yourself. Alternatively, you can run 'autoproj osdeps' and/or change to"
611
- puts "automatic osdeps handling by running an autoproj operation with the --reconfigure"
612
- puts "option (e.g. autoproj build --reconfigure)"
613
- puts Autoproj.color("==============================", :bold)
614
- puts
615
-
616
- if automatic_osdeps_mode == WAIT
617
- print "Press ENTER to continue "
618
- STDOUT.flush
619
- STDIN.readline
620
- end
772
+ return osdeps_interaction_unknown_os(osdeps)
621
773
  end
774
+ elsif OSDependencies.force_osdeps
775
+ return true
776
+ elsif osdeps_mode == HANDLE_ALL || osdeps_mode == HANDLE_OS
777
+ return true
778
+ elsif silent
779
+ return false
780
+ end
781
+
782
+ # We're asked to not install the OS packages but to display them
783
+ # anyway, do so now
784
+ puts <<-EOMSG
785
+
786
+ #{Autoproj.color("The build process and/or the packages require some other software to be installed", :bold)}
787
+ #{Autoproj.color("and you required autoproj to not install them itself", :bold)}
788
+ #{Autoproj.color("\nIf these packages are already installed, simply ignore this message\n", :red) if !can_filter_uptodate_packages?}
789
+ The following packages are available as OS dependencies, i.e. as prebuilt
790
+ packages provided by your distribution / operating system. You will have to
791
+ install them manually if they are not already installed
792
+
793
+ #{os_packages.sort.join("\n ")}
794
+
795
+ the following command line(s) can be run as root to install them:
796
+
797
+ #{shell_script.split("\n").join("\n| ")}
798
+
799
+ EOMSG
800
+ print " #{Autoproj.color("Press ENTER to continue ", :bold)}"
801
+ STDOUT.flush
802
+ STDIN.readline
803
+ puts
804
+ false
805
+ end
806
+
807
+ def gems_interaction(gems, cmdline, silent)
808
+ if OSDependencies.force_osdeps
809
+ return true
810
+ elsif osdeps_mode == HANDLE_ALL || osdeps_mode == HANDLE_RUBY
811
+ return true
812
+ elsif silent
813
+ return false
814
+ end
815
+
816
+ # We're not supposed to install rubygem packages but silent is not
817
+ # set, so display information about them anyway
818
+ puts <<-EOMSG
819
+ #{Autoproj.color("The build process and/or the packages require some Ruby Gems to be installed", :bold)}
820
+ #{Autoproj.color("and you required autoproj to not do it itself", :bold)}
821
+ You can use the --all or --ruby options to autoproj osdeps to install these
822
+ packages anyway, and/or change to the osdeps handling mode by running an
823
+ autoproj operation with the --reconfigure option as for instance
824
+ autoproj build --reconfigure
825
+
826
+ The following command line can be used to install them manually
827
+
828
+ #{cmdline.join(" ")}
829
+
830
+ Autoproj expects these Gems to be installed in #{Autoproj.gem_home} This can
831
+ be overriden by setting the AUTOPROJ_GEM_HOME environment variable manually
832
+
833
+ EOMSG
834
+ print " #{Autoproj.color("Press ENTER to continue ", :bold)}"
835
+
836
+ STDOUT.flush
837
+ STDIN.readline
838
+ puts
839
+ false
840
+ end
622
841
 
623
- if !do_osdeps
624
- return
842
+ # Requests the installation of the given set of packages
843
+ def install(packages, package_osdeps = Hash.new)
844
+ handled_os = OSDependencies.supported_operating_system?
845
+ # Remove the set of packages that have already been installed
846
+ packages -= installed_packages
847
+ return if packages.empty?
848
+
849
+ osdeps, gems = partition_packages(packages, package_osdeps)
850
+ if handled_os
851
+ os_name, os_version = OSDependencies.operating_system
852
+ os_packages = resolve_os_dependencies(osdeps)
853
+ if filter_uptodate_packages
854
+ os_packages = filter_uptodate_os_packages(os_packages, os_name)
625
855
  end
626
856
  end
857
+ if filter_uptodate_packages
858
+ gems = filter_uptodate_gems(gems)
859
+ end
627
860
 
628
861
  did_something = false
629
862
 
630
- if handled_os && !osdeps.empty?
631
- shell_script = generate_os_script(osdeps)
632
- if Autoproj.verbose
633
- Autoproj.progress "Installing non-ruby OS dependencies with"
634
- Autoproj.progress shell_script
863
+ if !osdeps.empty? && (!os_packages || !os_packages.empty?)
864
+ if handled_os
865
+ shell_script = generate_auto_os_script(os_name, os_packages)
866
+ user_shell_script = generate_user_os_script(os_name, os_packages)
635
867
  end
868
+ if osdeps_interaction(osdeps, os_packages, user_shell_script, silent?)
869
+ Autoproj.progress " installing OS packages: #{os_packages.sort.join(", ")}"
636
870
 
637
- File.open('osdeps.sh', 'w') do |file|
638
- file.write shell_script
639
- end
640
- Autobuild.progress "installing/updating OS dependencies: #{osdeps.join(", ")}"
641
- begin
642
- Autobuild::Subprocess.run 'autoproj', 'osdeps', '/bin/bash', File.expand_path('osdeps.sh')
643
- ensure
644
- FileUtils.rm_f 'osdeps.sh'
645
- end
646
- did_something ||= true
647
- end
871
+ if Autoproj.verbose
872
+ Autoproj.progress "Generating installation script for non-ruby OS dependencies"
873
+ Autoproj.progress shell_script
874
+ end
648
875
 
649
- if !gems.empty?
650
- gems = filter_uptodate_gems(gems)
876
+ Tempfile.open('osdeps_sh') do |io|
877
+ io.puts "#! /bin/bash"
878
+ io.puts GAIN_ROOT_ACCESS
879
+ io.write shell_script
880
+ io.flush
881
+ Autobuild::Subprocess.run 'autoproj', 'osdeps', '/bin/bash', io.path
882
+ end
883
+ did_something = true
884
+ end
651
885
  end
652
886
 
653
- # Now install what is left
887
+ # Now install the RubyGems
654
888
  if !gems.empty?
655
889
  guess_gem_program
656
- if Autoproj.verbose
657
- Autoproj.progress "Installing rubygems dependencies with"
658
- Autoproj.progress "gem install #{gems.join(" ")}"
659
- end
660
890
 
661
891
  cmdline = [Autobuild.tool('gem'), 'install']
662
892
  if Autoproj::OSDependencies.gem_with_prerelease
@@ -664,9 +894,11 @@ module Autoproj
664
894
  end
665
895
  cmdline.concat(gems)
666
896
 
667
- Autobuild.progress "installing/updating RubyGems dependencies: #{gems.join(", ")}"
668
- Autobuild::Subprocess.run 'autoproj', 'osdeps', *cmdline
669
- did_something ||= true
897
+ if gems_interaction(gems, cmdline, silent?)
898
+ Autobuild.progress "installing/updating RubyGems dependencies: #{gems.sort.join(", ")}"
899
+ Autobuild::Subprocess.run 'autoproj', 'osdeps', *cmdline
900
+ did_something = true
901
+ end
670
902
  end
671
903
 
672
904
  did_something
@@ -675,53 +907,206 @@ module Autoproj
675
907
  end
676
908
 
677
909
 
910
+ module Autoproj
911
+ class InputError < RuntimeError; end
912
+
913
+ class BuildOption
914
+ attr_reader :name
915
+ attr_reader :type
916
+ attr_reader :options
917
+
918
+ attr_reader :validator
919
+
920
+ TRUE_STRINGS = %w{on yes y true}
921
+ FALSE_STRINGS = %w{off no n false}
922
+ def initialize(name, type, options, validator)
923
+ @name, @type, @options = name.to_str, type.to_str, options.to_hash
924
+ @validator = validator.to_proc if validator
925
+ if !BuildOption.respond_to?("validate_#{type}")
926
+ raise ConfigError, "invalid option type #{type}"
927
+ end
928
+ end
929
+
930
+ def short_doc
931
+ if short_doc = options[:short_doc]
932
+ short_doc
933
+ elsif doc = options[:doc]
934
+ if doc.respond_to?(:to_ary) then doc.first
935
+ else doc
936
+ end
937
+ else "#{name} (no documentation for this option)"
938
+ end
939
+ end
940
+
941
+ def doc
942
+ doc = (options[:doc] || "#{name} (no documentation for this option)")
943
+ if doc.respond_to?(:to_ary) # multi-line
944
+ first_line = Autoproj.color(doc[0], :bold)
945
+ remaining = doc[1..-1]
946
+ if !remaining.empty?
947
+ remaining = remaining.join("\n").split("\n").join("\n ")
948
+ first_line + "\n " + remaining
949
+ end
950
+ else
951
+ doc
952
+ end
953
+ end
954
+
955
+ def ask(current_value, doc = nil)
956
+ default_value =
957
+ if current_value then current_value.to_s
958
+ elsif options[:default] then options[:default].to_str
959
+ else ''
960
+ end
961
+
962
+ STDOUT.print " #{doc || self.doc} [#{default_value}] "
963
+ STDOUT.flush
964
+ answer = STDIN.readline.chomp
965
+ if answer == ''
966
+ answer = default_value
967
+ end
968
+ validate(answer)
969
+
970
+ rescue InputError => e
971
+ Autoproj.progress("invalid value: #{e.message}", :red)
972
+ retry
973
+ end
974
+
975
+ def validate(value)
976
+ value = BuildOption.send("validate_#{type}", value, options)
977
+ if validator
978
+ value = validator[value]
979
+ end
980
+ value
981
+ end
982
+
983
+ def self.validate_boolean(value, options)
984
+ if TRUE_STRINGS.include?(value.downcase)
985
+ true
986
+ elsif FALSE_STRINGS.include?(value.downcase)
987
+ false
988
+ else
989
+ raise InputError, "invalid boolean value '#{value}', accepted values are '#{TRUE_STRINGS.join(", ")}' for true, and '#{FALSE_STRINGS.join(", ")} for false"
990
+ end
991
+ end
992
+
993
+ def self.validate_string(value, options)
994
+ if possible_values = options[:possible_values]
995
+ if options[:lowercase]
996
+ value = value.downcase
997
+ end
998
+ if !possible_values.include?(value)
999
+ raise InputError, "invalid value '#{value}', accepted values are '#{possible_values.join(", ")}'"
1000
+ end
1001
+ end
1002
+ value
1003
+ end
1004
+ end
1005
+
1006
+ @user_config = Hash.new
1007
+
1008
+ def self.option_set
1009
+ @user_config.inject(Hash.new) do |h, (k, v)|
1010
+ h[k] = v.first
1011
+ h
1012
+ end
1013
+ end
1014
+
1015
+ def self.reset_option(key)
1016
+ @user_config.delete(key)
1017
+ end
1018
+
1019
+ def self.change_option(key, value, user_validated = false)
1020
+ @user_config[key] = [value, user_validated]
1021
+ end
1022
+
1023
+ def self.user_config(key)
1024
+ value, seen = @user_config[key]
1025
+ # All non-user options are always considered as "seen"
1026
+ seen ||= !@declared_options.has_key?(key)
1027
+
1028
+ if value.nil? || (!seen && Autoproj.reconfigure?)
1029
+ value = configure(key)
1030
+ else
1031
+ if !seen
1032
+ doc = @declared_options[key].short_doc
1033
+ if doc[-1, 1] != "?"
1034
+ doc = "#{doc}:"
1035
+ end
1036
+ Autoproj.progress " #{doc} #{value}"
1037
+ @user_config[key] = [value, true]
1038
+ end
1039
+ value
1040
+ end
1041
+ end
1042
+
1043
+ @declared_options = Hash.new
1044
+ def self.configuration_option(name, type, options, &validator)
1045
+ @declared_options[name] = BuildOption.new(name, type, options, validator)
1046
+ end
1047
+
1048
+ def self.declared_option?(name)
1049
+ @declared_options.has_key?(name)
1050
+ end
1051
+
1052
+ def self.configure(option_name)
1053
+ if opt = @declared_options[option_name]
1054
+ if current_value = @user_config[option_name]
1055
+ current_value = current_value.first
1056
+ end
1057
+ value = opt.ask(current_value)
1058
+ @user_config[option_name] = [value, true]
1059
+ value
1060
+ else
1061
+ raise ConfigError, "undeclared option '#{option_name}'"
1062
+ end
1063
+ end
1064
+
1065
+ def self.save_config
1066
+ File.open(File.join(Autoproj.config_dir, "config.yml"), "w") do |io|
1067
+ config = Hash.new
1068
+ @user_config.each_key do |key|
1069
+ config[key] = @user_config[key].first
1070
+ end
1071
+
1072
+ io.write YAML.dump(config)
1073
+ end
1074
+ end
1075
+
1076
+ def self.has_config_key?(name)
1077
+ @user_config.has_key?(name)
1078
+ end
1079
+
1080
+ def self.load_config
1081
+ config_file = File.join(Autoproj.config_dir, "config.yml")
1082
+ if File.exists?(config_file)
1083
+ config = YAML.load(File.read(config_file))
1084
+ config.each do |key, value|
1085
+ @user_config[key] = [value, false]
1086
+ end
1087
+ end
1088
+ end
1089
+
1090
+ class << self
1091
+ attr_accessor :reconfigure
1092
+ end
1093
+ def self.reconfigure?; @reconfigure end
1094
+ end
1095
+
1096
+
678
1097
 
679
1098
  DEFS = <<EODEFS
680
1099
  ---
681
- svn:
682
- arch: subversion
683
- gentoo: dev-util/subversion
684
- debian,ubuntu: subversion
685
- autobuild: gem
686
- zlib:
687
- debian,ubuntu: zlib1g-dev
688
- libxml2:
689
- arch: libxml2
690
- gentoo: dev-libs/libxml2
691
- debian,ubuntu: libxml2-dev
692
1100
  none: ignore
693
- autotools:
694
- arch: automake autoconf
695
- gentoo:
696
- - sys-devel/automake:1.9
697
- - sys-devel/autoconf
698
- debian,ubuntu:
699
- - automake1.9
700
- - autoconf
701
- autoproj: gem
702
- archive:
703
- arch:
704
- - tar
705
- - unzip
706
- gentoo:
707
- - app-arch/tar
708
- - app-arch/unzip
709
- debian,ubuntu:
710
- - tar
711
- - unzip
712
- lsb_release:
713
- arch:
714
- gentoo: sys-apps/lsb-release
715
- debian,ubuntu: lsb-release
716
1101
  ruby18:
717
- gentoo:
718
- - dev-lang/ruby:1.8
719
1102
  debian,ubuntu:
720
1103
  - ruby1.8-dev
721
1104
  - ruby1.8
722
1105
  - rubygems1.8
723
1106
  - ri1.8
724
1107
  - libopenssl-ruby1.8
1108
+ gentoo:
1109
+ - dev-lang/ruby:1.8
725
1110
  ruby19:
726
1111
  debian:
727
1112
  squeeze,sid:
@@ -732,104 +1117,72 @@ ruby19:
732
1117
  - ruby1.9.1
733
1118
  - ruby1.9.1-dev
734
1119
  - rubygems1.9.1
735
- arch:
736
- - ruby
737
- gentoo:
738
- - dev-lang/ruby:1.9
739
1120
  ubuntu:
740
1121
  - ruby1.9.1
741
1122
  - ruby1.9.1-dev
742
1123
  - rubygems1.9.1
743
1124
  - ri1.9.1
744
1125
  - libopenssl-ruby1.9.1
1126
+ gentoo:
1127
+ - dev-lang/ruby:1.9
1128
+ arch:
1129
+ - ruby
1130
+ rdoc: gem
1131
+ build-essential:
1132
+ debian,ubuntu: build-essential
1133
+ gentoo:
1134
+ arch:
1135
+ libxml2:
1136
+ debian,ubuntu: libxml2-dev
1137
+ gentoo: dev-libs/libxml2
1138
+ arch: libxml2
1139
+ libxslt:
1140
+ debian,ubuntu: libxslt1-dev
1141
+ gentoo: dev-libs/libxslt
1142
+ arch: libxslt
1143
+ zlib:
1144
+ debian,ubuntu: zlib1g-dev
1145
+ autobuild: gem
1146
+ autoproj: gem
745
1147
  git:
746
- arch: git
747
- gentoo: dev-vcs/git
748
1148
  debian,ubuntu: git-core
1149
+ gentoo: dev-vcs/git
1150
+ arch: git
1151
+ svn:
1152
+ debian,ubuntu: subversion
1153
+ gentoo: dev-util/subversion
1154
+ arch: subversion
749
1155
  cmake:
750
- arch: cmake
751
- gentoo: dev-util/cmake
752
1156
  debian,ubuntu: cmake
753
- build-essential:
1157
+ gentoo: dev-util/cmake
1158
+ arch: cmake
1159
+ autotools:
1160
+ debian,ubuntu:
1161
+ - automake1.9
1162
+ - autoconf
1163
+ gentoo:
1164
+ - sys-devel/automake:1.9
1165
+ - sys-devel/autoconf
1166
+ arch: automake autoconf
1167
+ lsb_release:
1168
+ debian,ubuntu: lsb-release
1169
+ gentoo: sys-apps/lsb-release
754
1170
  arch:
1171
+ archive:
1172
+ debian,ubuntu:
1173
+ - tar
1174
+ - unzip
755
1175
  gentoo:
756
- debian,ubuntu: build-essential
757
- libxslt:
758
- arch: libxslt
759
- gentoo: dev-libs/libxslt
760
- debian,ubuntu: libxslt1-dev
761
- rdoc: gem
1176
+ - app-arch/tar
1177
+ - app-arch/unzip
1178
+ arch:
1179
+ - tar
1180
+ - unzip
762
1181
 
763
1182
  EODEFS
764
1183
 
765
- if ENV['AUTOPROJ_AUTOMATIC_OSDEPS']
766
- automatic_osdeps = ENV['AUTOPROJ_AUTOMATIC_OSDEPS']
767
- else
768
- if !Autoproj::OSDependencies.supported_operating_system?
769
- puts <<-EOT
770
-
771
- autoproj is usually able to handle the installation of operating system packages
772
- himself. However, it does not handle your operating system (yet), and will
773
- therefore have to let you install the packages yourself.
774
-
775
- It can still install the RubyGems packages that are required by the built
776
- packages.
777
-
778
- If you answer 'no' to the following question, autoproj will always go on,
779
- assuming that all the required dependencies are already installed. If you answer
780
- 'yes', it will make sure that the RubyGems are installed himself, but it will
781
- assume that you took care of the other packages. If you answer 'wait', it will
782
- not install anything but will wait for you to press ENTER each time some
783
- external software is needed. Finally, if you answer 'ask', it will ask you each
784
- time what it should do when there is something to install
785
-
786
- EOT
787
-
788
- print "How should autoproj install RubyGems packages automatically (yes, no, wait or ask) ? [yes] "
789
- STDOUT.flush
790
- else
791
- # Before doing *anything*, we have to ask the user if he wants us to install
792
- # the osdeps ...
793
- puts <<-EOT
794
-
795
- autoproj is able to handle the installation of operating system packages
796
- himself. This functionality will use 'sudo' to gain root access each time
797
- it is needed.
798
-
799
- If you answer 'no' to the following question, autoproj will go on, assuming that
800
- all the required dependencies are already installed. If you answer 'yes', it
801
- will make sure that they are installed himself. If you answer 'wait', it will
802
- not install anything but wait for you to press ENTER each time some external
803
- software is needed. Finally, if you answer 'ask', it will ask you what it
804
- should do each time there is something to install.
805
-
806
- EOT
807
- print "Should autoproj install OS packages automatically (yes, no, wait or ask) ? [yes] "
808
- STDOUT.flush
809
- end
810
-
811
- automatic_osdeps = nil
812
- while automatic_osdeps.nil?
813
- answer = STDIN.readline.chomp
814
- if answer == ''
815
- automatic_osdeps = true
816
- elsif answer == "no"
817
- automatic_osdeps = false
818
- elsif answer == 'wait'
819
- automatic_osdeps = :wait
820
- elsif answer == 'ask'
821
- automatic_osdeps = :ask
822
- elsif answer == 'yes'
823
- automatic_osdeps = true
824
- else
825
- print "invalid answer. Please answer with 'yes', 'no', 'wait' or 'ask' "
826
- STDOUT.flush
827
- end
828
- end
829
- end
830
-
831
- Autoproj.config['automatic_osdeps'] =
832
- automatic_osdeps
1184
+ Autoproj::OSDependencies.define_osdeps_mode_option
1185
+ ENV['AUTOPROJ_OSDEPS_MODE'] = Autoproj::OSDependencies.osdeps_mode
833
1186
 
834
1187
  # First thing we do is install a proper ruby environment. We make sure that we
835
1188
  # aren't installing any gems for now (as we need to choose the right gem
@@ -887,7 +1240,6 @@ if ARGV.first != "localdev"
887
1240
  end
888
1241
  Autoproj::OSDependencies.gem_with_prerelease = false
889
1242
 
890
- ENV['AUTOPROJ_AUTOMATIC_OSDEPS'] = automatic_osdeps.to_s
891
1243
  if !system('autoproj', 'bootstrap', *ARGV)
892
1244
  STDERR.puts "ERROR: failed to run autoproj bootstrap #{ARGV.join(", ")}"
893
1245
  exit 1