autoproj 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,13 @@
1
+ = Version 1.3.4
2
+ * Improve the RubyGems support
3
+ - a given osdeps name can refer to a mixture of RubyGems and OS packages
4
+ - the osdeps name can be different from the RubyGems package name
5
+ * Fix: Autobuild::Package#depends_on_os_package(name) was not taken into
6
+ account
7
+ * Fix: the autoproj/ directory was deleted if "autoproj switch-config" fails.
8
+ Fix that for the common case. It can still happen if the VCS is not
9
+ accessible.
10
+
1
11
  = Version 1.3.3
2
12
  * Fix: some configuration options were not properly saved
3
13
  * Fix: env.sh was messed up by partial builds (builds where a directory and/or
@@ -228,13 +228,18 @@ def switch_config(*args)
228
228
 
229
229
  if vcs && (vcs.type == args[0] && vcs.url == args[1])
230
230
  # Don't need to do much: simply change the options and save the config
231
- # file, the VCS handler will take care of switching the options
231
+ # file, the VCS handler will take care of the actual switching
232
232
  else
233
233
  # We will have to delete the current autoproj directory. Ask the user.
234
- opt = Autoproj::BuildOption.new("delete current config", "boolean", Hash[:default => "false", :doc => "delete the current configuration ? (required to switch)"], nil)
234
+ opt = Autoproj::BuildOption.new("delete current config", "boolean",
235
+ Hash[:default => "false",
236
+ :doc => "delete the current configuration ? (required to switch)"], nil)
237
+
235
238
  return if !opt.ask(nil)
236
- FileUtils.rm_rf File.join(Autoproj.config_dir)
237
- do_switch_config(*args)
239
+
240
+ Dir.chdir(Autoproj.root_dir) do
241
+ do_switch_config(true, *args)
242
+ end
238
243
  end
239
244
 
240
245
  # And now save the options: note that we keep the current option set even
@@ -254,7 +259,7 @@ def switch_config(*args)
254
259
  Autoproj.save_config
255
260
  end
256
261
 
257
- def do_switch_config(*args)
262
+ def do_switch_config(delete_current, *args)
258
263
  vcs_def = Hash.new
259
264
  vcs_def[:type] = args.shift
260
265
  vcs_def[:url] = args.shift
@@ -268,7 +273,13 @@ def do_switch_config(*args)
268
273
  # Install the OS dependencies required for this VCS
269
274
  osdeps = Autoproj::OSDependencies.load_default
270
275
  osdeps.install([vcs.type])
271
- Autoproj::Manifest.update_source(vcs, "autoproj main configuration", 'autoproj_config', File.join(Dir.pwd, "autoproj"))
276
+
277
+ # Now check out the actual configuration
278
+ config_dir = File.join(Dir.pwd, "autoproj")
279
+ if delete_current
280
+ FileUtils.rm_rf config_dir
281
+ end
282
+ Autoproj::Manifest.update_source(vcs, "autoproj main configuration", 'autoproj_config', config_dir)
272
283
 
273
284
  # Now write it in the config file
274
285
  File.open(File.join(Autoproj.config_dir, "config.yml"), "a") do |io|
@@ -318,7 +329,7 @@ def do_bootstrap(*args)
318
329
  end
319
330
 
320
331
  elsif args.size >= 2 # is a VCS definition for the manifest itself ...
321
- do_switch_config(*args)
332
+ do_switch_config(false, *args)
322
333
  end
323
334
 
324
335
  # Finally, generate an env.sh script
@@ -59,12 +59,14 @@ module Autoproj
59
59
  end
60
60
  AUTOPROJ_OSDEPS = File.join(File.expand_path(File.dirname(__FILE__)), 'default.osdeps')
61
61
  def self.load_default
62
- OSDependencies.load(AUTOPROJ_OSDEPS)
62
+ @default_osdeps ||= OSDependencies.load(AUTOPROJ_OSDEPS)
63
63
  end
64
64
 
65
65
  attr_reader :definitions
66
+ attr_reader :gem_fetcher
66
67
  def initialize(defs = Hash.new)
67
68
  @definitions = defs.to_hash
69
+ @gem_fetcher = Gem::SpecFetcher.fetcher
68
70
  end
69
71
 
70
72
  def merge(info)
@@ -203,6 +205,8 @@ module Autoproj
203
205
  raise ConfigError, msg
204
206
  end
205
207
 
208
+ pkg_def = pkg_def.dup
209
+
206
210
  if pkg_def.respond_to?(:to_str)
207
211
  case(pkg_def.to_str)
208
212
  when "ignore" then
@@ -212,7 +216,15 @@ module Autoproj
212
216
  raise ConfigError, "unknown OS-independent package management type #{pkg_def} for #{name}"
213
217
  end
214
218
  else
215
- osdeps << name
219
+ pkg_def.delete_if do |distrib_name, defs|
220
+ if distrib_name == "gem"
221
+ gems.concat([*defs])
222
+ true
223
+ end
224
+ end
225
+ if !pkg_def.empty?
226
+ osdeps << name
227
+ end
216
228
  end
217
229
  end
218
230
  return osdeps, gems
@@ -249,21 +261,22 @@ module Autoproj
249
261
  did_something ||= true
250
262
  end
251
263
 
252
- # Don't install gems that are already there ...
253
- gems.delete_if do |name|
254
- version_requirements = Gem::Requirement.default
255
- installed = Gem.source_index.find_name(name, version_requirements)
256
- if !installed.empty? && Autobuild.do_update
257
- # Look if we can update the package ...
258
- dep = Gem::Dependency.new(name, version_requirements)
259
- remote = Gem::SpecFetcher.fetcher
260
- available = remote.find_matching(dep)
261
- installed_version = installed.map(&:version).max
262
- available_version = available.map { |(name, v), source| v }.max
263
- needs_update = (available_version > installed_version)
264
- !needs_update
265
- else
266
- !installed.empty?
264
+ if !gems.empty?
265
+ # Don't install gems that are already there ...
266
+ gems.delete_if do |name|
267
+ version_requirements = Gem::Requirement.default
268
+ installed = Gem.source_index.find_name(name, version_requirements)
269
+ if !installed.empty? && Autobuild.do_update
270
+ # Look if we can update the package ...
271
+ dep = Gem::Dependency.new(name, version_requirements)
272
+ available = @gem_fetcher.find_matching(dep)
273
+ installed_version = installed.map(&:version).max
274
+ available_version = available.map { |(name, v), source| v }.max
275
+ needs_update = (available_version > installed_version)
276
+ !needs_update
277
+ else
278
+ !installed.empty?
279
+ end
267
280
  end
268
281
  end
269
282
 
@@ -145,6 +145,10 @@ module Autoproj
145
145
  end
146
146
 
147
147
  def self.single_expansion(data, definitions)
148
+ if !data.respond_to?(:to_str)
149
+ return data
150
+ end
151
+
148
152
  definitions.each do |name, expanded|
149
153
  data = data.gsub /\$#{Regexp.quote(name)}\b/, expanded
150
154
  end
@@ -922,16 +926,21 @@ module Autoproj
922
926
  end
923
927
 
924
928
  def install_os_dependencies(packages)
925
-
926
929
  required_os_packages = Set.new
927
930
  package_os_deps = Hash.new { |h, k| h[k] = Array.new }
928
931
  packages.each do |pkg_name|
929
932
  if manifest = package_manifests[pkg_name]
930
- pkg_osdeps = manifest.each_os_dependency.to_set
931
- pkg_osdeps.each do |osdep_name|
933
+ manifest.each_os_dependency.each do |osdep_name|
934
+ package_os_deps[osdep_name] << pkg_name
935
+ required_os_packages << osdep_name
936
+ end
937
+ end
938
+
939
+ if pkg = Autobuild::Package[pkg_name]
940
+ pkg.os_packages.each do |osdep_name|
932
941
  package_os_deps[osdep_name] << pkg_name
942
+ required_os_packages << osdep_name
933
943
  end
934
- required_os_packages |= pkg_osdeps
935
944
  end
936
945
  end
937
946
 
@@ -159,6 +159,8 @@ module Autoproj
159
159
  raise ConfigError, msg
160
160
  end
161
161
 
162
+ pkg_def = pkg_def.dup
163
+
162
164
  if pkg_def.respond_to?(:to_str)
163
165
  case(pkg_def.to_str)
164
166
  when "ignore" then
@@ -168,7 +170,15 @@ module Autoproj
168
170
  raise ConfigError, "unknown OS-independent package management type #{pkg_def} for #{name}"
169
171
  end
170
172
  else
171
- osdeps << name
173
+ pkg_def.delete_if do |distrib_name, defs|
174
+ if distrib_name == "gem"
175
+ gems.concat([*defs])
176
+ true
177
+ end
178
+ end
179
+ if !pkg_def.empty?
180
+ osdeps << name
181
+ end
172
182
  end
173
183
  end
174
184
  return osdeps, gems
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.3.3"
2
+ VERSION = "1.3.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-08 00:00:00 +01:00
12
+ date: 2010-01-14 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency