autoproj 1.11.0.b2 → 1.11.0.b3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c670cf6b348389cab2ef3f09609abdc52cf34d26
4
- data.tar.gz: 8359d7efde856edd985fb20b04ce408ab4cb78f7
3
+ metadata.gz: b9bddbed5843f00a95b7b18d043b2b4b9793fbc6
4
+ data.tar.gz: 392659a2bb4009fde57fd5a72480193919752381
5
5
  SHA512:
6
- metadata.gz: c82b58a30b359849675696ed7b53a805a4da7520a04769946275ec3c105e127d5cb1964b6dd4ea60cd448f391d41e0cedec0c30ac91c443b2117cc7b99b77eb3
7
- data.tar.gz: b07ecf4b6f0b34f12516aa60eccf3c9695a63aee0c87b7ba819b309e42893020396f1a132ca42a22de2a9b8a2a6866460461c8dd43fe7c1b2ac61dcaf0a91562
6
+ metadata.gz: 430da15aab04ac6421ff38116ffb24b151669d632bb70e81d360117c3a36b8381fdac41a0080129d419c5d39837126636d4606659784186222b86d888f32eefc
7
+ data.tar.gz: 8576957180d5a637bb43949ca77fe5cd7d411699054827ba4d56e00bc9ca600fa1bf6b66b349b316189b45bbfd1eaaf2f3a2c60fb7cca666de9d791da58cfe41
data/bin/autoproj CHANGED
@@ -89,16 +89,6 @@ Autoproj::CmdLine.report do
89
89
  Autoproj::CmdLine.load_configuration
90
90
  manifest = Autoproj.manifest
91
91
 
92
- # Once thing left to do: handle the Autoproj.auto_update configuration
93
- # parameter
94
- #
95
- # Namely, we must check if Autobuild.do_update has been explicitely set to
96
- # true or false. If that is the case, don't do anything. Otherwise, set it
97
- # to the value of Autoproj.auto_update
98
- if Autobuild.do_update.nil?
99
- Autobuild.do_update = Autoproj.auto_update?
100
- end
101
-
102
92
  Autoproj::CmdLine.setup_all_package_directories
103
93
  # resolve_user_selection auto-adds packages present on disk but not listed
104
94
  # in the manifest. However, since we have not yet loaded overrides /
@@ -3,6 +3,10 @@ require 'autoproj'
3
3
  require 'autoproj/ops/main_config_switcher'
4
4
 
5
5
  root_dir = Dir.pwd
6
+ if File.exists?(File.join(root_dir, 'autoproj', "manifest"))
7
+ raise ConfigError.new, "this installation is already bootstrapped. Remove the autoproj directory if it is not the case"
8
+ end
9
+
6
10
  Autoproj::CmdLine.report do
7
11
  switcher = Autoproj::Ops::MainConfigSwitcher.new(root_dir)
8
12
  begin
@@ -10,6 +14,7 @@ Autoproj::CmdLine.report do
10
14
  manifest = Autoproj::Manifest.load(File.join(Autoproj.config_dir, 'manifest'))
11
15
  update = Autoproj::Ops::Configuration.new(manifest, Autoproj::Ops.loader)
12
16
  update.update_configuration
17
+ Autoproj.save_config
13
18
 
14
19
  STDERR.puts <<EOTEXT
15
20
 
@@ -25,8 +30,8 @@ your consoles, or run the following in them:
25
30
  $ source #{root_dir}/#{Autoproj::ENV_FILENAME}
26
31
 
27
32
  #{color('To import and build the packages', :bold)}, you can now run
28
- autoproj update
29
- autoproj build
33
+ aup
34
+ amake
30
35
 
31
36
  The resulting software is installed in
32
37
  #{root_dir}/install
@@ -18,6 +18,7 @@ Autoproj::CmdLine.report do
18
18
  manifest = Autoproj::Manifest.load(File.join(Autoproj.config_dir, 'manifest'))
19
19
  update = Autoproj::Ops::Configuration.new(manifest, Autoproj::Ops.loader)
20
20
  update.update_configuration
21
+ Autoproj.save_config
21
22
  end
22
23
  end
23
24
 
@@ -290,13 +290,15 @@ module Autoproj
290
290
  end
291
291
 
292
292
  # Get the value for a given option
293
- def get(key)
293
+ def get(key, default_value = nil)
294
294
  if overrides.has_key?(key)
295
295
  return overrides[key]
296
296
  end
297
297
 
298
298
  value, validated = config[key]
299
- if value.nil? || (declared?(key) && !validated)
299
+ if value.nil? && !declared?(key) && !default_value.nil?
300
+ default_value
301
+ elsif value.nil? || (declared?(key) && !validated)
300
302
  value = configure(key)
301
303
  else
302
304
  if declared?(key) && (displayed_options[key] != value)
@@ -389,9 +391,68 @@ module Autoproj
389
391
  io.write YAML.dump(h)
390
392
  end
391
393
  end
394
+
395
+ def each_reused_autoproj_installation
396
+ if has_value_for?('reused_autoproj_installations')
397
+ get('reused_autoproj_installations').each(&proc)
398
+ else [].each(&proc)
399
+ end
400
+ end
401
+
402
+ def ruby_executable
403
+ @ruby_executable ||= OSDependencies.autodetect_ruby_program
404
+ end
405
+
406
+ def validate_ruby_executable
407
+ if has_value_for?('ruby_executable')
408
+ expected = get('ruby_executable')
409
+ if expected != ruby_executable
410
+ raise ConfigError.new, "this autoproj installation was bootstrapped using #{expected}, but you are currently running under #{ruby_executable}. This is usually caused by calling a wrong gem program (for instance, gem1.8 instead of gem1.9.1)"
411
+ end
412
+ end
413
+ set('ruby_executable', ruby_executable, true)
414
+ end
415
+
416
+ def use_prerelease?
417
+ use_prerelease =
418
+ if env_flag = ENV['AUTOPROJ_USE_PRERELEASE']
419
+ env_flag == '1'
420
+ elsif has_value_for?('autoproj_use_prerelease')
421
+ get('autoproj_use_prerelease')
422
+ end
423
+ set "autoproj_use_prerelease", (use_prerelease ? true : false), true
424
+ use_prerelease
425
+ end
426
+
427
+ def apply_autobuild_configuration
428
+ if has_value_for?('autobuild')
429
+ params = get('autobuild')
430
+ if params.kind_of?(Hash)
431
+ params.each do |k, v|
432
+ Autobuild.send("#{k}=", v)
433
+ end
434
+ end
435
+ end
436
+ end
437
+
438
+ def apply_autoproj_prefix
439
+ if has_value_for?('prefix')
440
+ Autoproj.prefix = get('prefix')
441
+ else Autoproj.prefix = 'install'
442
+ end
443
+ end
444
+
445
+ def randomize_layout?
446
+ get('randomize_layout', false)
447
+ end
448
+
449
+ def randomize_layout=(value)
450
+ set('randomize_layout', value, true)
451
+ end
392
452
  end
393
453
  end
394
454
 
455
+
395
456
  module Autoproj
396
457
  def self.config
397
458
  @config ||= Configuration.new
@@ -43,21 +43,15 @@ module Autoproj
43
43
  end
44
44
 
45
45
  module CmdLine
46
- class << self
47
- attr_reader :ruby_executable
46
+ def self.config
47
+ Autoproj.config
48
48
  end
49
49
 
50
- def self.handle_ruby_version
51
- @ruby_executable = Autoproj::OSDependencies.autodetect_ruby_program
52
-
53
- if Autoproj.has_config_key?('ruby_executable')
54
- expected = Autoproj.user_config('ruby_executable')
55
- if expected != ruby_executable
56
- raise ConfigError.new, "this autoproj installation was bootstrapped using #{expected}, but you are currently running under #{ruby_executable}. This is usually caused by calling a wrong gem program (for instance, gem1.8 instead of gem1.9.1)"
57
- end
58
- end
59
- Autoproj.change_option('ruby_executable', ruby_executable, true)
50
+ def self.ruby_executable
51
+ Autoproj.config.ruby_executable
52
+ end
60
53
 
54
+ def self.install_ruby_shims
61
55
  install_suffix = ""
62
56
  if match = /ruby(.*)$/.match(RbConfig::CONFIG['RUBY_INSTALL_NAME'])
63
57
  install_suffix = match[1]
@@ -110,60 +104,32 @@ module Autoproj
110
104
  Autoproj.loaded_autobuild_files.clear
111
105
  Autoproj.load_config
112
106
 
113
- handle_ruby_version
107
+ config.validate_ruby_executable
108
+ install_ruby_shims
114
109
 
115
- if Autoproj.has_config_key?('autobuild')
116
- params = Autoproj.user_config('autobuild')
117
- if params.kind_of?(Hash)
118
- params.each do |k, v|
119
- Autobuild.send("#{k}=", v)
120
- end
121
- end
122
- end
123
-
124
- if Autoproj.has_config_key?('prefix')
125
- Autoproj.prefix = Autoproj.user_config('prefix')
126
- end
110
+ config.apply_autobuild_configuration
111
+ config.apply_autoproj_prefix
127
112
 
128
- if Autoproj.has_config_key?('randomize_layout')
129
- @randomize_layout = Autoproj.user_config('randomize_layout')
130
- end
131
-
132
- Autoproj.manifest = Manifest.new
113
+ manifest = Manifest.new
114
+ Autoproj.manifest = manifest
133
115
  Autoproj.prepare_environment
134
116
  Autobuild.prefix = Autoproj.build_dir
135
117
  Autobuild.srcdir = Autoproj.root_dir
136
118
  Autobuild.logdir = File.join(Autobuild.prefix, 'log')
137
119
 
138
- load_autoprojrc
120
+ Ops::Tools.load_autoprojrc
139
121
 
140
- Autoproj.manifest.each_reused_autoproj_installation do |p|
141
- Autoproj.manifest.reuse(p)
122
+ config.each_reused_autoproj_installation do |p|
123
+ manifest.reuse(p)
142
124
  end
143
125
 
144
126
  # We load the local init.rb first so that the manifest loading
145
127
  # process can use options defined there for the autoproj version
146
128
  # control information (for instance)
147
- local_source = LocalPackageSet.new(Autoproj.manifest)
148
- Autoproj.load_if_present(local_source, local_source.local_dir, "init.rb")
129
+ Ops::Tools.load_main_initrb(manifest)
149
130
 
150
131
  manifest_path = File.join(Autoproj.config_dir, 'manifest')
151
- Autoproj.manifest.load(manifest_path)
152
-
153
- # Once thing left to do: handle the Autoproj.auto_update
154
- # configuration parameter. This has to be done here as the rest of
155
- # the configuration update/loading procedure rely on it.
156
- #
157
- # Namely, we must check if Autobuild.do_update has been explicitely
158
- # set to true or false. If that is the case, don't do anything.
159
- # Otherwise, set it to the value of auto_update (set in the
160
- # manifest)
161
- if Autobuild.do_update.nil?
162
- Autobuild.do_update = manifest.auto_update?
163
- end
164
- if @update_os_dependencies.nil?
165
- @update_os_dependencies = manifest.auto_update?
166
- end
132
+ manifest.load(manifest_path)
167
133
 
168
134
  # Initialize the Autoproj.osdeps object by loading the default. The
169
135
  # rest is loaded later
@@ -190,23 +156,7 @@ module Autoproj
190
156
  end
191
157
 
192
158
  def self.load_autoprojrc
193
- home_dir =
194
- if Dir.respond_to?(:home) # 1.9 specific
195
- Dir.home
196
- else ENV['HOME']
197
- end
198
-
199
- # Load the user-wide autoproj RC file
200
- if home_dir
201
- rcfile = File.join(home_dir, '.autoprojrc')
202
- if File.file?(rcfile)
203
- begin
204
- Kernel.load rcfile
205
- rescue Interrupt
206
- raise
207
- end
208
- end
209
- end
159
+ Ops::Tools.load_autoprojrc
210
160
  end
211
161
 
212
162
  def self.update_myself(options = Hash.new)
@@ -214,7 +164,7 @@ module Autoproj
214
164
  force: false, restart_on_update: true
215
165
  return if !options[:force] && !Autoproj::CmdLine.update_os_dependencies?
216
166
 
217
- handle_ruby_version
167
+ Autoproj.config.validate_ruby_executable
218
168
 
219
169
  # This is a guard to avoid infinite recursion in case the user is
220
170
  # running autoproj osdeps --force
@@ -222,18 +172,10 @@ module Autoproj
222
172
  return
223
173
  end
224
174
 
225
- use_prerelease =
226
- if env_flag = ENV['AUTOPROJ_USE_PRERELEASE']
227
- env_flag == '1'
228
- elsif Autoproj.has_config_key?('autoproj_use_prerelease')
229
- Autoproj.user_config('autoproj_use_prerelease')
230
- end
231
- Autoproj.change_option "autoproj_use_prerelease", (use_prerelease ? true : false), true
232
-
233
175
  did_update =
234
176
  begin
235
177
  saved_flag = PackageManagers::GemManager.with_prerelease
236
- PackageManagers::GemManager.with_prerelease = use_prerelease
178
+ PackageManagers::GemManager.with_prerelease = Autoproj.config.use_prerelease?
237
179
  OSDependencies.load_default.install(%w{autobuild autoproj})
238
180
  ensure
239
181
  PackageManagers::GemManager.with_prerelease = saved_flag
@@ -326,7 +268,7 @@ module Autoproj
326
268
  pkg_name = pkg.name
327
269
 
328
270
  layout =
329
- if randomize_layout?
271
+ if config.randomize_layout?
330
272
  Digest::SHA256.hexdigest(pkg_name)[0, 12]
331
273
  else manifest.whereis(pkg_name)
332
274
  end
@@ -840,7 +782,7 @@ module Autoproj
840
782
  def self.check?; !!@check end
841
783
  def self.manifest_update?; !!@manifest_update end
842
784
  def self.only_config?; !!@only_config end
843
- def self.randomize_layout?; !!@randomize_layout end
785
+ def self.randomize_layout?; config.randomize_layout? end
844
786
  def self.update_os_dependencies?
845
787
  # Check if the mode disables osdeps anyway ...
846
788
  if !@update_os_dependencies.nil? && !@update_os_dependencies
@@ -1070,8 +1012,7 @@ where 'mode' is one of:
1070
1012
  @status_exit_code = true
1071
1013
  end
1072
1014
  opts.on('--randomize-layout', 'in build and full-build, generate a random layout') do
1073
- @randomize_layout = true
1074
- Autoproj.change_option('randomize_layout', true)
1015
+ config.randomize_layout = true
1075
1016
  end
1076
1017
 
1077
1018
  opts.on("--verbose", "verbose output") do
@@ -58,13 +58,15 @@ module Autoproj
58
58
  end
59
59
 
60
60
  # Get the value for a given option
61
- def get(key)
61
+ def get(key, default_value = nil)
62
62
  if overrides.has_key?(key)
63
63
  return overrides[key]
64
64
  end
65
65
 
66
66
  value, validated = config[key]
67
- if value.nil? || (declared?(key) && !validated)
67
+ if value.nil? && !declared?(key) && !default_value.nil?
68
+ default_value
69
+ elsif value.nil? || (declared?(key) && !validated)
68
70
  value = configure(key)
69
71
  else
70
72
  if declared?(key) && (displayed_options[key] != value)
@@ -157,5 +159,64 @@ module Autoproj
157
159
  io.write YAML.dump(h)
158
160
  end
159
161
  end
162
+
163
+ def each_reused_autoproj_installation
164
+ if has_value_for?('reused_autoproj_installations')
165
+ get('reused_autoproj_installations').each(&proc)
166
+ else [].each(&proc)
167
+ end
168
+ end
169
+
170
+ def ruby_executable
171
+ @ruby_executable ||= OSDependencies.autodetect_ruby_program
172
+ end
173
+
174
+ def validate_ruby_executable
175
+ if has_value_for?('ruby_executable')
176
+ expected = get('ruby_executable')
177
+ if expected != ruby_executable
178
+ raise ConfigError.new, "this autoproj installation was bootstrapped using #{expected}, but you are currently running under #{ruby_executable}. This is usually caused by calling a wrong gem program (for instance, gem1.8 instead of gem1.9.1)"
179
+ end
180
+ end
181
+ set('ruby_executable', ruby_executable, true)
182
+ end
183
+
184
+ def use_prerelease?
185
+ use_prerelease =
186
+ if env_flag = ENV['AUTOPROJ_USE_PRERELEASE']
187
+ env_flag == '1'
188
+ elsif has_value_for?('autoproj_use_prerelease')
189
+ get('autoproj_use_prerelease')
190
+ end
191
+ set "autoproj_use_prerelease", (use_prerelease ? true : false), true
192
+ use_prerelease
193
+ end
194
+
195
+ def apply_autobuild_configuration
196
+ if has_value_for?('autobuild')
197
+ params = get('autobuild')
198
+ if params.kind_of?(Hash)
199
+ params.each do |k, v|
200
+ Autobuild.send("#{k}=", v)
201
+ end
202
+ end
203
+ end
204
+ end
205
+
206
+ def apply_autoproj_prefix
207
+ if has_value_for?('prefix')
208
+ Autoproj.prefix = get('prefix')
209
+ else Autoproj.prefix = 'install'
210
+ end
211
+ end
212
+
213
+ def randomize_layout?
214
+ get('randomize_layout', false)
215
+ end
216
+
217
+ def randomize_layout=(value)
218
+ set('randomize_layout', value, true)
219
+ end
160
220
  end
161
221
  end
222
+
@@ -101,12 +101,6 @@ module Autoproj
101
101
  end
102
102
  end
103
103
 
104
- # True if autoproj should run an update automatically when the user
105
- # uses" build"
106
- def auto_update?
107
- !!data['auto_update']
108
- end
109
-
110
104
  attr_reader :constant_definitions
111
105
 
112
106
  attr_reader :metapackages
@@ -1091,10 +1085,9 @@ module Autoproj
1091
1085
  result
1092
1086
  end
1093
1087
 
1088
+ # @deprecated use Autoproj.config.each_reused_autoproj_installation
1094
1089
  def each_reused_autoproj_installation
1095
- if Autoproj.has_config_key?('reused_autoproj_installations')
1096
- Autoproj.user_config('reused_autoproj_installations').each(&proc)
1097
- end
1090
+ Autoproj.config.each_reused_autoproj_installation(&proc)
1098
1091
  end
1099
1092
 
1100
1093
  def reuse(*dir)
@@ -45,6 +45,14 @@ module Autoproj
45
45
  File.join(config_dir, "remotes")
46
46
  end
47
47
 
48
+ # The path to the main manifest file
49
+ #
50
+ # @return [String]
51
+ def manifest_path
52
+ File.join(config_dir, 'manifest')
53
+ end
54
+
55
+
48
56
  # @param [Manifest] manifest
49
57
  # @param [Loader] loader
50
58
  # @option options [InstallationManifest] :update_from
@@ -278,9 +286,9 @@ module Autoproj
278
286
  # installed (i.e. that the user did not remove it)
279
287
  if manifest.vcs && !manifest.vcs.local?
280
288
  update_main_configuration(only_local)
281
- manifest_path = File.join(config_dir, 'manifest')
282
- manifest.load(manifest_path)
283
289
  end
290
+ Tools.load_main_initrb(manifest)
291
+ manifest.load(manifest_path)
284
292
 
285
293
  root_pkg_set = LocalPackageSet.new(manifest)
286
294
  root_pkg_set.load_description_file
@@ -83,15 +83,12 @@ module Autoproj
83
83
  reuse << path
84
84
  end
85
85
  end
86
+ Tools.common_options(parser)
86
87
  args = parser.parse(args)
87
88
  return args, reuse
88
89
  end
89
90
 
90
91
  def bootstrap(*args)
91
- if File.exists?(File.join(root_dir, 'autoproj', "manifest"))
92
- raise ConfigError.new, "this installation is already bootstrapped. Remove the autoproj directory if it is not the case"
93
- end
94
-
95
92
  check_root_dir_empty
96
93
  args, reuse = handle_bootstrap_options(args)
97
94
  validate_autoproj_current_root(reuse)
@@ -102,15 +99,13 @@ module Autoproj
102
99
  Autobuild.logdir = File.join(Autobuild.prefix, 'log')
103
100
 
104
101
  Autoproj.manifest = Manifest.new
105
- load_autoprojrc
102
+ Tools.load_autoprojrc
106
103
  Autoproj.prepare_environment
107
104
 
108
105
  Autoproj::OSDependencies.define_osdeps_mode_option
109
106
  osdeps = Autoproj::OSDependencies.load_default
110
- if osdeps_forced_mode
111
- osdeps.osdeps_mode = osdeps_forced_mode
112
- end
113
107
  osdeps.osdeps_mode
108
+ Autoproj.osdeps = osdeps
114
109
 
115
110
  CmdLine.update_myself :force => true, :restart_on_update => false
116
111
  Autoproj.change_option 'reused_autoproj_installations', reuse, true
@@ -47,6 +47,37 @@ module Autoproj
47
47
  raise ConfigError.new, "cannot import #{text_name}: #{e.message}", e.backtrace
48
48
  end
49
49
 
50
+ def load_autoprojrc
51
+ # Load the user-wide autoproj RC file
52
+ if home_dir = Dir.home
53
+ rcfile = File.join(home_dir, '.autoprojrc')
54
+ if File.file?(rcfile)
55
+ Kernel.load rcfile
56
+ end
57
+ end
58
+ end
59
+
60
+ def load_main_initrb(manifest = Autoproj.manifest)
61
+ local_source = LocalPackageSet.new(manifest)
62
+ Autoproj.load_if_present(local_source, local_source.local_dir, "init.rb")
63
+ end
64
+
65
+ def common_options(parser)
66
+ parser.on '--verbose' do
67
+ Autoproj.verbose = true
68
+ Autobuild.verbose = true
69
+ Rake.application.options.trace = false
70
+ Autobuild.debug = false
71
+ end
72
+
73
+ parser.on '--debug' do
74
+ Autoproj.verbose = true
75
+ Autobuild.verbose = true
76
+ Rake.application.options.trace = true
77
+ Autobuild.debug = true
78
+ end
79
+ end
80
+
50
81
  extend Tools
51
82
  end
52
83
  end
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.11.0.b2"
2
+ VERSION = "1.11.0.b3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0.b2
4
+ version: 1.11.0.b3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rock Core Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-17 00:00:00.000000000 Z
11
+ date: 2014-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autobuild