autoproj 1.5.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ = Version 1.5.4
2
+ * better error message when a dependency does not exist
3
+
1
4
  = Version 1.5.3
2
5
  * use osdeps-provided packages instead of autobuild-built ones even if they are
3
6
  implicitely selected in the layout (i.e. because of a package set name).
data/Rakefile CHANGED
@@ -39,6 +39,19 @@ begin
39
39
  task 'bootstrap' do
40
40
  osdeps_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'osdeps.rb'))
41
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
+
42
55
  bootstrap_code = File.read(File.join(Dir.pwd, 'bin', 'autoproj_bootstrap.in')).
43
56
  gsub('OSDEPS_CODE', osdeps_code).
44
57
  gsub('OSDEPS_DEFAULTS', osdeps_defaults)
@@ -98,7 +98,16 @@ module Autoproj
98
98
 
99
99
  AUTOPROJ_OSDEPS = File.join(File.expand_path(File.dirname(__FILE__)), 'default.osdeps')
100
100
  def self.load_default
101
- @default_osdeps ||= OSDependencies.load(AUTOPROJ_OSDEPS)
101
+ if @default_osdeps
102
+ @default_osdeps
103
+ else
104
+ file = ENV['AUTOPROJ_DEFAULT_OSDEPS'] || AUTOPROJ_OSDEPS
105
+ if !File.file?(file)
106
+ STDERR.puts "WARN: #{file} (from AUTOPROJ_DEFAULT_OSDEPS) is not a file, falling back to #{AUTOPROJ_OSDEPS}"
107
+ file = AUTOPROJ_OSDEPS
108
+ end
109
+ @default_osdeps = OSDependencies.load(file)
110
+ end
102
111
  end
103
112
 
104
113
  attr_reader :definitions
@@ -195,14 +204,18 @@ module Autoproj
195
204
  'arch' => 'pacman -Sy --noconfirm %s'
196
205
  }
197
206
 
198
- def generate_os_script(dependencies)
207
+ # Resolves the given OS dependencies into the actual packages that need
208
+ # to be installed on this particular OS.
209
+ #
210
+ # Raises ConfigError if some packages can't be found
211
+ def resolve_os_dependencies(dependencies)
199
212
  os_name, os_version = operating_system
200
213
  if !OS_PACKAGE_INSTALL.has_key?(os_name)
201
214
  raise ConfigError, "I don't know how to install packages on #{os_name}"
202
215
  end
203
216
 
204
- shell_snippets = ""
205
217
  os_packages = []
218
+ shell_snippets = []
206
219
  dependencies.each do |name|
207
220
  dep_def = definitions[name]
208
221
  if !dep_def
@@ -221,6 +234,7 @@ module Autoproj
221
234
  end
222
235
 
223
236
  data = os_entry.last
237
+
224
238
  # This package does not need to be installed on this operating system (example: build tools on Gentoo)
225
239
  next if !data || data == "ignore"
226
240
 
@@ -244,20 +258,29 @@ module Autoproj
244
258
  elsif data.to_str =~ /\w+/
245
259
  os_packages << data.to_str
246
260
  else
247
- shell_snippets << "\n" << data << "\n"
261
+ shell_snippets << data.to_str
248
262
  end
249
263
  end
250
264
 
265
+ return os_packages, shell_snippets
266
+ end
267
+
268
+
269
+ def generate_os_script(dependencies)
270
+ os_name, os_version = operating_system
271
+ os_packages, shell_snippets = resolve_os_dependencies(dependencies)
272
+
251
273
  "#! /bin/bash\n" +
252
274
  GAIN_ROOT_ACCESS + "\n" +
253
275
  (OS_PACKAGE_INSTALL[os_name] % [os_packages.join(" ")]) +
254
- "\n" + shell_snippets
276
+ "\n" + shell_snippets.join("\n")
255
277
  end
256
278
 
257
279
  # Returns true if there is an operating-system package with that name,
258
280
  # and false otherwise
259
281
  def has?(name)
260
- partition_packages([name].to_set)
282
+ osdeps, gemdeps = partition_packages([name].to_set)
283
+ resolve_os_dependencies(osdeps)
261
284
  true
262
285
  rescue ConfigError
263
286
  false
@@ -398,92 +421,86 @@ end
398
421
 
399
422
 
400
423
  DEFS = <<EODEFS
401
- # The following definitions are needed to bootstrap autoproj
424
+ ---
402
425
  none: ignore
403
-
404
- ruby18:
405
- debian,ubuntu:
406
- - ruby1.8-dev
407
- - ruby1.8
408
- - rubygems1.8
409
- - ri1.8
410
- - libopenssl-ruby1.8
411
- gentoo:
412
- - dev-lang/ruby:1.8
413
-
414
- ruby19:
415
- debian:
416
- squeeze,sid:
417
- - ruby1.9.1
418
- - ruby1.9.1-dev
419
- - rubygems1.9.1
420
- stable:
421
- - ruby1.9.1
422
- - ruby1.9.1-dev
423
- - rubygems1.9.1
424
-
425
- ubuntu:
426
- - ruby1.9.1
427
- - ruby1.9.1-dev
428
- - rubygems1.9.1
429
- - ri1.9.1
430
- - libopenssl-ruby1.9.1
431
- gentoo:
432
- - dev-lang/ruby:1.9
433
- arch:
434
- - ruby
435
-
426
+ ruby18:
427
+ debian,ubuntu:
428
+ - ruby1.8-dev
429
+ - ruby1.8
430
+ - rubygems1.8
431
+ - ri1.8
432
+ - libopenssl-ruby1.8
433
+ gentoo:
434
+ - dev-lang/ruby:1.8
435
+ ruby19:
436
+ debian:
437
+ squeeze,sid:
438
+ - ruby1.9.1
439
+ - ruby1.9.1-dev
440
+ - rubygems1.9.1
441
+ stable:
442
+ - ruby1.9.1
443
+ - ruby1.9.1-dev
444
+ - rubygems1.9.1
445
+ ubuntu:
446
+ - ruby1.9.1
447
+ - ruby1.9.1-dev
448
+ - rubygems1.9.1
449
+ - ri1.9.1
450
+ - libopenssl-ruby1.9.1
451
+ gentoo:
452
+ - dev-lang/ruby:1.9
453
+ arch:
454
+ - ruby
436
455
  rdoc: gem
437
-
438
- build-essential:
439
- debian,ubuntu: build-essential
440
- gentoo:
441
- arch:
442
-
443
- libxml2:
444
- debian,ubuntu: libxml2-dev
445
- gentoo: dev-libs/libxml2
446
- arch: libxml2
447
-
448
- libxslt:
449
- debian,ubuntu: libxslt1-dev
450
- gentoo: dev-libs/libxslt
451
- arch: libxslt
452
-
456
+ build-essential:
457
+ debian,ubuntu: build-essential
458
+ gentoo:
459
+ arch:
460
+ libxml2:
461
+ debian,ubuntu: libxml2-dev
462
+ gentoo: dev-libs/libxml2
463
+ arch: libxml2
464
+ libxslt:
465
+ debian,ubuntu: libxslt1-dev
466
+ gentoo: dev-libs/libxslt
467
+ arch: libxslt
453
468
  autobuild: gem
454
469
  autoproj: gem
455
-
456
- # The following definitions are for the VCS and build systems
457
- git:
458
- debian,ubuntu: git-core
459
- gentoo: dev-vcs/git
460
- arch: git
461
- svn:
462
- debian,ubuntu: subversion
463
- gentoo: dev-util/subversion
464
- arch: subversion
465
- cmake:
466
- debian,ubuntu: cmake
467
- gentoo: dev-util/cmake
468
- arch: cmake
469
-
470
- autotools:
471
- debian,ubuntu: [automake1.9, autoconf]
472
- gentoo: [sys-devel/automake:1.9, sys-devel/autoconf]
473
- arch: automake autoconf
474
-
475
- lsb_release:
476
- debian,ubuntu: lsb-release
477
- gentoo: sys-apps/lsb-release
478
- arch:
479
-
480
- archive:
481
- debian,ubuntu: [tar, unzip]
482
- gentoo: [app-arch/tar, app-arch/unzip]
483
- arch: [tar, unzip]
484
-
485
- # vim: expandtab
486
-
470
+ git:
471
+ debian,ubuntu: git-core
472
+ gentoo: dev-vcs/git
473
+ arch: git
474
+ svn:
475
+ debian,ubuntu: subversion
476
+ gentoo: dev-util/subversion
477
+ arch: subversion
478
+ cmake:
479
+ debian,ubuntu: cmake
480
+ gentoo: dev-util/cmake
481
+ arch: cmake
482
+ autotools:
483
+ debian,ubuntu:
484
+ - automake1.9
485
+ - autoconf
486
+ gentoo:
487
+ - sys-devel/automake:1.9
488
+ - sys-devel/autoconf
489
+ arch: automake autoconf
490
+ lsb_release:
491
+ debian,ubuntu: lsb-release
492
+ gentoo: sys-apps/lsb-release
493
+ arch:
494
+ archive:
495
+ debian,ubuntu:
496
+ - tar
497
+ - unzip
498
+ gentoo:
499
+ - app-arch/tar
500
+ - app-arch/unzip
501
+ arch:
502
+ - tar
503
+ - unzip
487
504
 
488
505
  EODEFS
489
506
 
@@ -11,11 +11,22 @@ module Autobuild
11
11
 
12
12
  alias __depends_on__ depends_on
13
13
  def depends_on(name)
14
- if Autoproj.osdeps.has?(name) && !Autoproj.manifest.explicitly_selected_package?(name)
14
+ explicit_selection = Autoproj.manifest.explicitly_selected_package?(name)
15
+ if Autoproj.osdeps.has?(name) && !explicit_selection
15
16
  @os_packages ||= Set.new
16
17
  @os_packages << name
17
18
  else
18
- __depends_on__(name)
19
+ begin
20
+ __depends_on__(name)
21
+ rescue Exception => e
22
+ if explicit_selection
23
+ raise e
24
+ else
25
+ # Re-call osdeps to get a proper error message
26
+ osdeps, gems = Autoproj.osdeps.partition_packages([name].to_set)
27
+ Autoproj.osdeps.resolve_os_dependencies(osdeps)
28
+ end
29
+ end
19
30
  end
20
31
  end
21
32
 
@@ -1018,7 +1018,9 @@ module Autoproj
1018
1018
  begin
1019
1019
  package.depends_on name
1020
1020
  rescue Autobuild::ConfigException => e
1021
- raise ConfigError, "manifest of #{package.name} from #{source.name} lists '#{name}' as dependency, but this package does not exist (manifest file: #{manifest_path})"
1021
+ raise ConfigError, "manifest #{manifest_path} of #{package.name} from #{source.name} lists '#{name}' as dependency, which is listed in the layout but has no autobuild definition"
1022
+ rescue ConfigError => e
1023
+ raise ConfigError, "manifest #{manifest_path} of #{package.name} from #{source.name} lists '#{name}' as dependency, but it is neither a normal package nor an osdeps package. osdeps reports: #{e.message}"
1022
1024
  end
1023
1025
  end
1024
1026
  end
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.5.3"
2
+ VERSION = "1.5.4"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 5
8
- - 3
9
- version: 1.5.3
8
+ - 4
9
+ version: 1.5.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sylvain Joyeux
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-08 00:00:00 +02:00
17
+ date: 2010-06-15 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency