autoproj 1.6.2 → 1.7.0.b1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,24 @@
1
+ = Version 1.7.0
2
+ * 1.6.2 should have been 1.7.0. Bump it now.
3
+ * introduced cross-package-set imports. A package set can now tell autoproj to
4
+ install another one in a recursive manner (see user's guide)
5
+ * added optional dependencies, which will not be considered if the
6
+ depended-upon package is either not existing or is explicitely excluded from
7
+ the build. It is specified in Ruby with
8
+ pkg.optional_dependency pkg_name
9
+ or in the package's manifest.xml files by setting the "optional" attribute to 1:
10
+ <depend package="pkg_name" optional="1" />
11
+
12
+ * added the #package toplevel method to get a package handle, i.e.
13
+ package('orocos/rtt')
14
+ is equivalent to the former
15
+ Autobuild::Package['orocos/rtt']
16
+ * added the --randomize-layout option which makes autoproj build each package
17
+ in a separate non-trivial subfolder, and install it in a separate folder as
18
+ well. This is meant to test the definition and handling of dependencies
19
+ between the different packages.
20
+ * added the autolocate tool, which returns the full path to a certain package
21
+
1
22
  = Version 1.6.2
2
23
  * overhauled osdeps fine-grained configuration. See
3
24
  http://orocos.org/dfki/autoproj/osdeps.html
@@ -10,7 +31,7 @@
10
31
  errors are properly presented at the end of the run.
11
32
  * when boostrapping, check that the current directory is empty and warn the
12
33
  user if it is not.
13
- * a few minor bugfixes
34
+ * a few more minor bugfixes
14
35
 
15
36
  = Version 1.6.1
16
37
  * fix a limitation of giving directories on the command line. Before, only
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ begin
14
14
  self.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
15
15
 
16
16
  extra_deps <<
17
- ['autobuild', '>= 1.5.23'] <<
17
+ ['autobuild', '>= 1.5.24'] <<
18
18
  ['rmail', '>= 1.0.0'] <<
19
19
  ['utilrb', '>= 1.3.3'] <<
20
20
  ['nokogiri', '>= 1.3.3'] <<
data/bin/autoproj CHANGED
@@ -1,5 +1,12 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
+ if !ARGV.grep("--env").empty?
4
+ require 'autoproj/system'
5
+ puts File.join(Autoproj.root_dir, "env.sh")
6
+ exit
7
+ end
8
+
9
+
3
10
  if RUBY_VERSION < "1.8.7"
4
11
  STDERR.puts "autoproj requires Ruby >= 1.8.7"
5
12
  exit 1
@@ -103,9 +110,13 @@ EOTEXT
103
110
  Autobuild.do_update = Autoproj.auto_update?
104
111
  end
105
112
 
113
+ selected_packages = Autoproj::CmdLine.resolve_user_selection(selected_packages)
114
+ Autoproj.manifest.explicit_selection = selected_packages
115
+ Autoproj::CmdLine.initial_package_setup
116
+
106
117
  # If in verbose mode, or if we only update sources, list the sources
107
118
  if Autoproj.verbose || Autoproj::CmdLine.display_configuration?
108
- Autoproj::CmdLine.display_sources(manifest)
119
+ Autoproj::CmdLine.display_configuration(manifest, selected_packages)
109
120
  end
110
121
 
111
122
  if Autoproj::CmdLine.bootstrap?
@@ -136,10 +147,6 @@ EOTEXT
136
147
  exit(0)
137
148
  end
138
149
 
139
- selected_packages = Autoproj::CmdLine.resolve_user_selection(selected_packages)
140
- Autoproj.manifest.explicit_selection = selected_packages
141
- Autoproj::CmdLine.initial_package_setup
142
-
143
150
  if Autoproj::CmdLine.only_status?
144
151
  all_enabled_packages = Autoproj::CmdLine.import_packages(selected_packages)
145
152
  Autoproj::CmdLine.status(all_enabled_packages)
@@ -180,7 +187,13 @@ EOTEXT
180
187
  all_enabled_packages = Autoproj::CmdLine.import_packages(selected_packages)
181
188
 
182
189
  if Autoproj::CmdLine.update_os_dependencies? && !all_enabled_packages.empty?
183
- manifest.install_os_dependencies(all_enabled_packages)
190
+ begin
191
+ update_mode = Autobuild.do_update
192
+ Autobuild.do_update ||= Autoproj::CmdLine.osdeps?
193
+ manifest.install_os_dependencies(all_enabled_packages)
194
+ ensure
195
+ Autobuild.do_update = update_mode
196
+ end
184
197
  end
185
198
 
186
199
  if all_enabled_packages.empty?
@@ -106,7 +106,7 @@ module Autoproj
106
106
  data = YAML.load(File.read(file)) || Hash.new
107
107
  verify_definitions(data)
108
108
  rescue ArgumentError => e
109
- raise ConfigError, "error in #{file}: #{e.message}"
109
+ raise ConfigError.new, "error in #{file}: #{e.message}"
110
110
  end
111
111
 
112
112
  OSDependencies.new(data, file)
@@ -243,8 +243,9 @@ module Autoproj
243
243
  return @operating_system
244
244
  elsif Autoproj.has_config_key?('operating_system')
245
245
  os = Autoproj.user_config('operating_system')
246
- if !os.respond_to?(:to_ary) # upgrade from previous format
247
- @operating_system = nil
246
+ if os.respond_to?(:to_ary) # upgrade from previous format
247
+ @operating_system = os
248
+ return os
248
249
  end
249
250
  end
250
251
 
@@ -434,7 +435,7 @@ fi
434
435
  elsif data.respond_to?(:to_str)
435
436
  return [PACKAGES, [data.to_str]]
436
437
  else
437
- raise ConfigError, "invalid package specificiation #{data} in #{source_of(name)}"
438
+ raise ConfigError.new, "invalid package specificiation #{data} in #{source_of(name)}"
438
439
  end
439
440
  end
440
441
 
@@ -449,11 +450,11 @@ fi
449
450
  dependencies.each do |name|
450
451
  result = resolve_package(name)
451
452
  if result == NO_PACKAGE
452
- raise ConfigError, "there is no osdeps definition for #{name}"
453
+ raise ConfigError.new, "there is no osdeps definition for #{name}"
453
454
  elsif result == WRONG_OS
454
- raise ConfigError, "there is an osdeps definition for #{name}, but not for this operating system"
455
+ raise ConfigError.new, "there is an osdeps definition for #{name}, but not for this operating system"
455
456
  elsif result == WRONG_OS_VERSION
456
- raise ConfigError, "there is an osdeps definition for #{name}, but not for this particular operating system version"
457
+ raise ConfigError.new, "there is an osdeps definition for #{name}, but not for this particular operating system version"
457
458
  elsif result == IGNORE
458
459
  next
459
460
  elsif result[0] == PACKAGES
@@ -462,7 +463,7 @@ fi
462
463
  end
463
464
 
464
465
  if !os_names.any? { |os_name| OS_AUTO_PACKAGE_INSTALL.has_key?(os_name) }
465
- raise ConfigError, "I don't know how to install packages on #{os_names.first}"
466
+ raise ConfigError.new, "I don't know how to install packages on #{os_names.first}"
466
467
  end
467
468
 
468
469
  return os_packages
@@ -545,7 +546,7 @@ fi
545
546
  # This is *not* handled later, as is the absence of a
546
547
  # package definition. The reason is that it is a bad
547
548
  # configuration file, and should be fixed by the user
548
- raise ConfigError, "unknown OS-independent package management type #{pkg_def} for #{name}"
549
+ raise ConfigError.new, "unknown OS-independent package management type #{pkg_def} for #{name}"
549
550
  end
550
551
  else
551
552
  pkg_def.delete_if do |distrib_name, defs|
@@ -609,7 +610,7 @@ fi
609
610
  installed_version = installed.map(&:version).max
610
611
  available_version = available.map { |(name, v), source| v }.max
611
612
  if !available_version
612
- raise ConfigError, "cannot find any gem with the name '#{name}'"
613
+ raise ConfigError.new, "cannot find any gem with the name '#{name}'"
613
614
  end
614
615
  needs_update = (available_version > installed_version)
615
616
  !needs_update
@@ -950,7 +951,7 @@ module Autoproj
950
951
  @name, @type, @options = name.to_str, type.to_str, options.to_hash
951
952
  @validator = validator.to_proc if validator
952
953
  if !BuildOption.respond_to?("validate_#{type}")
953
- raise ConfigError, "invalid option type #{type}"
954
+ raise ConfigError.new, "invalid option type #{type}"
954
955
  end
955
956
  end
956
957
 
@@ -1023,9 +1024,12 @@ module Autoproj
1023
1024
  if possible_values = options[:possible_values]
1024
1025
  if options[:lowercase]
1025
1026
  value = value.downcase
1027
+ elsif options[:uppercase]
1028
+ value = value.upcase
1026
1029
  end
1030
+
1027
1031
  if !possible_values.include?(value)
1028
- raise InputError, "invalid value '#{value}', accepted values are '#{possible_values.join(", ")}'"
1032
+ raise InputError, "invalid value '#{value}', accepted values are '#{possible_values.join("', '")}' (without the quotes)"
1029
1033
  end
1030
1034
  end
1031
1035
  value
@@ -1087,7 +1091,7 @@ module Autoproj
1087
1091
  @user_config[option_name] = [value, true]
1088
1092
  value
1089
1093
  else
1090
- raise ConfigError, "undeclared option '#{option_name}'"
1094
+ raise ConfigError.new, "undeclared option '#{option_name}'"
1091
1095
  end
1092
1096
  end
1093
1097
 
@@ -1315,85 +1319,85 @@ end
1315
1319
 
1316
1320
  DEFS = <<EODEFS
1317
1321
  ---
1322
+ svn:
1323
+ arch: subversion
1324
+ gentoo: dev-util/subversion
1325
+ debian,ubuntu: subversion
1326
+ autobuild: gem
1327
+ zlib:
1328
+ debian,ubuntu: zlib1g-dev
1329
+ libxml2:
1330
+ arch: libxml2
1331
+ gentoo: dev-libs/libxml2
1332
+ debian,ubuntu: libxml2-dev
1318
1333
  none: ignore
1334
+ autotools:
1335
+ arch: automake autoconf
1336
+ gentoo:
1337
+ - sys-devel/automake:1.9
1338
+ - sys-devel/autoconf
1339
+ debian,ubuntu:
1340
+ - automake1.9
1341
+ - autoconf
1342
+ autoproj: gem
1343
+ archive:
1344
+ arch:
1345
+ - tar
1346
+ - unzip
1347
+ gentoo:
1348
+ - app-arch/tar
1349
+ - app-arch/unzip
1350
+ debian,ubuntu:
1351
+ - tar
1352
+ - unzip
1353
+ lsb_release:
1354
+ arch:
1355
+ gentoo: sys-apps/lsb-release
1356
+ debian,ubuntu: lsb-release
1319
1357
  ruby18:
1358
+ gentoo:
1359
+ - dev-lang/ruby:1.8
1320
1360
  debian,ubuntu:
1321
1361
  - ruby1.8-dev
1322
1362
  - ruby1.8
1323
1363
  - rubygems1.8
1324
1364
  - ri1.8
1325
1365
  - libopenssl-ruby1.8
1326
- gentoo:
1327
- - dev-lang/ruby:1.8
1328
1366
  ruby19:
1329
1367
  debian:
1330
1368
  - ruby1.9.1
1331
1369
  - ruby1.9.1-dev
1332
1370
  - rubygems1.9.1
1371
+ arch:
1372
+ - ruby
1373
+ gentoo:
1374
+ - dev-lang/ruby:1.9
1333
1375
  ubuntu:
1334
1376
  - ruby1.9.1
1335
1377
  - ruby1.9.1-dev
1336
1378
  - rubygems1.9.1
1337
1379
  - ri1.9.1
1338
1380
  - libopenssl-ruby1.9.1
1339
- gentoo:
1340
- - dev-lang/ruby:1.9
1341
- arch:
1342
- - ruby
1343
- rdoc: gem
1344
- build-essential:
1345
- debian,ubuntu: build-essential
1346
- gentoo:
1347
- arch:
1348
- libxml2:
1349
- debian,ubuntu: libxml2-dev
1350
- gentoo: dev-libs/libxml2
1351
- arch: libxml2
1352
- libxslt:
1353
- debian,ubuntu: libxslt1-dev
1354
- gentoo: dev-libs/libxslt
1355
- arch: libxslt
1356
- zlib:
1357
- debian,ubuntu: zlib1g-dev
1358
- autobuild: gem
1359
- autoproj: gem
1360
1381
  git:
1361
1382
  debian:
1362
1383
  lenny: git
1363
1384
  default: git-core
1364
- ubuntu: git-core
1365
- gentoo: dev-vcs/git
1366
1385
  arch: git
1367
- svn:
1368
- debian,ubuntu: subversion
1369
- gentoo: dev-util/subversion
1370
- arch: subversion
1386
+ gentoo: dev-vcs/git
1387
+ ubuntu: git-core
1371
1388
  cmake:
1372
- debian,ubuntu: cmake
1373
- gentoo: dev-util/cmake
1374
1389
  arch: cmake
1375
- autotools:
1376
- debian,ubuntu:
1377
- - automake1.9
1378
- - autoconf
1379
- gentoo:
1380
- - sys-devel/automake:1.9
1381
- - sys-devel/autoconf
1382
- arch: automake autoconf
1383
- lsb_release:
1384
- debian,ubuntu: lsb-release
1385
- gentoo: sys-apps/lsb-release
1390
+ gentoo: dev-util/cmake
1391
+ debian,ubuntu: cmake
1392
+ build-essential:
1386
1393
  arch:
1387
- archive:
1388
- debian,ubuntu:
1389
- - tar
1390
- - unzip
1391
1394
  gentoo:
1392
- - app-arch/tar
1393
- - app-arch/unzip
1394
- arch:
1395
- - tar
1396
- - unzip
1395
+ debian,ubuntu: build-essential
1396
+ libxslt:
1397
+ arch: libxslt
1398
+ gentoo: dev-libs/libxslt
1399
+ debian,ubuntu: libxslt1-dev
1400
+ rdoc: gem
1397
1401
 
1398
1402
  EODEFS
1399
1403
 
@@ -74,6 +74,27 @@ module Autobuild
74
74
  depends_on(name)
75
75
  end
76
76
 
77
+ def optional_dependency(name)
78
+ optional_dependencies << name
79
+ end
80
+
81
+ def resolve_optional_dependencies
82
+ optional_dependencies.each do |name|
83
+ if Autobuild::Package[name] && Autoproj.manifest.package_enabled?(name)
84
+ if Autoproj.verbose
85
+ STDERR.puts "adding optional dependency #{self.name} => #{name}"
86
+ end
87
+ depends_on(name)
88
+ elsif Autoproj.verbose
89
+ STDERR.puts "NOT adding optional dependency #{self.name} => #{name}"
90
+ end
91
+ end
92
+ end
93
+
94
+ def optional_dependencies
95
+ @optional_dependencies ||= Set.new
96
+ end
97
+
77
98
  def os_packages
78
99
  @os_packages ||= Set.new
79
100
  end
@@ -133,9 +154,9 @@ module Autoproj
133
154
  end
134
155
 
135
156
  if source.local?
136
- raise ConfigError, "#{path}:#{line_number} #{error.message}", error.backtrace
157
+ raise ConfigError.new(path), "#{path}:#{line_number} #{error.message}", error.backtrace
137
158
  else
138
- raise ConfigError, "#{File.basename(path)}(source=#{source.name}):#{line_number} #{error.message}", error.backtrace
159
+ raise ConfigError.new(path), "#{File.basename(path)}(source=#{source.name}):#{line_number} #{error.message}", error.backtrace
139
160
  end
140
161
  else
141
162
  raise error
@@ -443,3 +464,18 @@ class Autobuild::ArchiveImporter
443
464
  end
444
465
  end
445
466
 
467
+ def package(name)
468
+ Autobuild::Package[name]
469
+ end
470
+
471
+ # Returns true if +name+ is a valid package and is included in the build
472
+ def package_enabled?(name)
473
+ Autoproj.manifest.package_enabled?(name, false)
474
+ end
475
+
476
+ # If used in init.rb, allows to disable automatic imports from specific package
477
+ # sets
478
+ def disable_imports_from(name)
479
+ Autoproj.manifest.disable_imports_from(name)
480
+ end
481
+
data/lib/autoproj/base.rb CHANGED
@@ -1,6 +1,28 @@
1
1
  module Autoproj
2
- class ConfigError < RuntimeError; end
2
+ class ConfigError < RuntimeError
3
+ attr_accessor :file
4
+ def initialize(file = nil)
5
+ super
6
+ @file = file
7
+ end
8
+ end
3
9
  class InternalError < RuntimeError; end
10
+
11
+ # Yields, and if the given block raises a ConfigError with no file assigned,
12
+ # add that file to both the object and the exception message
13
+ def self.in_file(file, exception_t = ConfigError)
14
+ yield
15
+
16
+ rescue exception_t => e
17
+ if exception_t != ConfigError
18
+ raise ConfigError.new(file), "in #{file}: #{e.message}", e.backtrace
19
+ elsif !e.file
20
+ e.file = file
21
+ raise e, "in #{file}: #{e.message}", e.backtrace
22
+ else
23
+ raise e
24
+ end
25
+ end
4
26
  end
5
27
 
6
28
 
@@ -42,10 +42,14 @@ module Autoproj
42
42
  Autoproj.prefix = Autoproj.user_config('prefix')
43
43
  end
44
44
 
45
+ if Autoproj.has_config_key?('randomize_layout')
46
+ @randomize_layout = Autoproj.user_config('randomize_layout')
47
+ end
48
+
45
49
  # If we are under rubygems, check that the GEM_HOME is right ...
46
50
  if $LOADED_FEATURES.any? { |l| l =~ /rubygems/ }
47
51
  if ENV['GEM_HOME'] != Autoproj.gem_home
48
- raise ConfigError, "RubyGems is already loaded with a different GEM_HOME, make sure you are loading the right env.sh script !"
52
+ raise ConfigError.new, "RubyGems is already loaded with a different GEM_HOME, make sure you are loading the right env.sh script !"
49
53
  end
50
54
  end
51
55
 
@@ -71,14 +75,16 @@ module Autoproj
71
75
  Autoproj.env_add 'PATH', bindir
72
76
  end
73
77
 
78
+ Autoproj.manifest = Manifest.new
79
+
74
80
  # We load the local init.rb first so that the manifest loading
75
81
  # process can use options defined there for the autoproj version
76
82
  # control information (for instance)
77
- local_source = LocalSource.new
83
+ local_source = LocalPackageSet.new(Autoproj.manifest)
78
84
  Autoproj.load_if_present(local_source, local_source.local_dir, "init.rb")
79
85
 
80
86
  manifest_path = File.join(Autoproj.config_dir, 'manifest')
81
- Autoproj.manifest = Manifest.load(manifest_path)
87
+ Autoproj.manifest.load(manifest_path)
82
88
 
83
89
  # Once thing left to do: handle the Autoproj.auto_update
84
90
  # configuration parameter. This has to be done here as the rest of
@@ -102,10 +108,10 @@ module Autoproj
102
108
  end
103
109
  # Do that AFTER we have properly setup Autoproj.osdeps as to avoid
104
110
  # unnecessarily redetecting the operating system
105
- Autoproj::OSDependencies.define_osdeps_mode_option
106
111
  if update_os_dependencies? || osdeps?
107
112
  Autoproj.reset_option('operating_system')
108
113
  end
114
+ Autoproj::OSDependencies.define_osdeps_mode_option
109
115
  Autoproj.osdeps.osdeps_mode
110
116
  end
111
117
 
@@ -137,6 +143,7 @@ module Autoproj
137
143
 
138
144
  def self.load_configuration(silent = false)
139
145
  manifest = Autoproj.manifest
146
+ manifest.cache_package_sets
140
147
 
141
148
  # Load init.rb files. each_source must not load the source.yml file, as
142
149
  # init.rb may define configuration options that are used there
@@ -177,7 +184,7 @@ module Autoproj
177
184
  if manifest.vcs
178
185
  manifest.update_yourself
179
186
  manifest_path = File.join(Autoproj.config_dir, 'manifest')
180
- Autoproj.manifest = manifest = Manifest.load(manifest_path)
187
+ manifest.load(manifest_path)
181
188
  end
182
189
 
183
190
  source_os_dependencies = manifest.each_remote_source(false).
@@ -213,13 +220,20 @@ module Autoproj
213
220
  # First, we allow to user to specify packages based on disk paths, so
214
221
  # resolve those
215
222
  seen = Set.new
216
- manifest.each_package_set do |name, packages, enabled_packages|
223
+ manifest.each_layout_level do |name, packages, enabled_packages|
217
224
  packages -= seen
218
225
 
219
- srcdir = File.join(Autoproj.root_dir, name)
220
- prefix = File.join(Autoproj.build_dir, name)
221
- logdir = File.join(prefix, "log")
222
226
  packages.each do |pkg_name|
227
+ place =
228
+ if randomize_layout?
229
+ Digest::SHA256.hexdigest(pkg_name)[0, 12]
230
+ else name
231
+ end
232
+
233
+ srcdir = File.join(Autoproj.root_dir, place)
234
+ prefix = File.join(Autoproj.build_dir, place)
235
+ logdir = File.join(prefix, "log")
236
+
223
237
  pkg = Autobuild::Package[pkg_name]
224
238
  pkg.srcdir = File.join(srcdir, pkg_name)
225
239
  pkg.prefix = prefix
@@ -237,6 +251,9 @@ module Autoproj
237
251
  end
238
252
  end
239
253
 
254
+ # Resolve optional dependencies
255
+ manifest.resolve_optional_dependencies
256
+
240
257
  # Load the package's override files. each_source must not load the
241
258
  # source.yml file, as init.rb may define configuration options that are used
242
259
  # there
@@ -250,51 +267,97 @@ module Autoproj
250
267
  end
251
268
 
252
269
 
253
- def self.display_sources(manifest)
270
+ def self.display_configuration(manifest, package_list = nil)
254
271
  # We can't have the Manifest class load the source.yml file, as it
255
272
  # cannot resolve all constants. So we need to do it ourselves to get
256
273
  # the name ...
257
- sources = manifest.each_source(false).to_a
274
+ sets = manifest.each_package_set(false).to_a
258
275
 
259
- if sources.empty?
276
+ if sets.empty?
260
277
  Autoproj.progress("autoproj: no package sets defined in autoproj/manifest", :bold, :red)
278
+ return
279
+ end
280
+
281
+ all_packages = Hash.new
282
+ if package_list
283
+ package_sets = Set.new
284
+ package_list.each do |name|
285
+ pkg_set = manifest.definition_source(name)
286
+ package_sets << pkg_set
287
+ all_packages[name] = [manifest.package(name).autobuild, pkg_set.name]
288
+ end
261
289
  else
262
- Autoproj.progress("autoproj: available package sets", :bold)
263
- manifest.each_source(false) do |source|
264
- source_yml = source.raw_description_file
265
- Autoproj.progress " #{source_yml['name']}"
266
- if source.local?
267
- Autoproj.progress " local source in #{source.local_dir}"
268
- else
269
- Autoproj.progress " from: #{source.vcs}"
270
- Autoproj.progress " local: #{source.local_dir}"
290
+ package_sets = manifest.each_package_set
291
+ package_sets.each do |pkg_set|
292
+ pkg_set.each_package.each do |pkg|
293
+ all_packages[pkg.name] = [pkg, pkg_set.name]
271
294
  end
295
+ end
296
+ end
272
297
 
273
- lines = []
274
- source.each_package.
275
- map { |pkg| [pkg.name, manifest.package_manifests[pkg.name]] }.
276
- sort_by { |name, _| name }.
277
- each do |name, source_manifest|
278
- vcs_def = manifest.importer_definition_for(name)
279
- if source_manifest
280
- lines << [name, source_manifest.short_documentation]
281
- lines << ["", vcs_def.to_s]
282
- else
283
- lines << [name, vcs_def.to_s]
284
- end
285
- end
298
+ Autoproj.progress
299
+ Autoproj.progress("autoproj: package sets", :bold)
300
+ package_sets.each do |pkg_set|
301
+ next if pkg_set.empty?
302
+ if pkg_set.imported_from
303
+ Autoproj.progress "#{pkg_set.name} (imported by #{pkg_set.imported_from.name})"
304
+ else
305
+ Autoproj.progress "#{pkg_set.name} (listed in manifest)"
306
+ end
307
+ if pkg_set.local?
308
+ Autoproj.progress " local set in #{pkg_set.local_dir}"
309
+ else
310
+ Autoproj.progress " from: #{pkg_set.vcs}"
311
+ Autoproj.progress " local: #{pkg_set.local_dir}"
312
+ end
286
313
 
287
- w_col1, w_col2 = nil
288
- lines.each do |col1, col2|
289
- w_col1 = col1.size if !w_col1 || col1.size > w_col1
290
- w_col2 = col2.size if !w_col2 || col2.size > w_col2
314
+ imports = pkg_set.each_imported_set.to_a
315
+ if !imports.empty?
316
+ Autoproj.progress " imports #{imports.size} package sets"
317
+ if !pkg_set.auto_imports?
318
+ Autoproj.progress " automatic imports are DISABLED for this set"
291
319
  end
292
- puts " packages:"
293
- format = " | %-#{w_col1}s | %-#{w_col2}s |"
294
- lines.each do |col1, col2|
295
- puts(format % [col1, col2])
320
+ imports.each do |imported_set|
321
+ Autoproj.progress " #{imported_set.name}"
296
322
  end
297
323
  end
324
+
325
+ set_packages = pkg_set.each_package.sort_by(&:name)
326
+ Autoproj.progress " defines: #{set_packages.map(&:name).join(", ")}"
327
+ end
328
+
329
+ Autoproj.progress
330
+ Autoproj.progress("autoproj: packages", :bold)
331
+ all_packages.to_a.sort_by(&:first).map(&:last).each do |pkg, pkg_set|
332
+ if File.exists?(File.join(pkg.srcdir, "manifest.xml"))
333
+ manifest.load_package_manifest(pkg.name)
334
+ manifest.resolve_optional_dependencies
335
+ end
336
+
337
+ pkg_manifest = manifest.package_manifests[pkg.name];
338
+ vcs_def = manifest.importer_definition_for(pkg.name)
339
+ Autoproj.progress "#{pkg.name}#{": #{pkg_manifest.short_documentation}" if pkg_manifest && pkg_manifest.short_documentation}", :bold
340
+ Autoproj.progress " defined in #{pkg_set}"
341
+ Autoproj.progress " #{vcs_def.to_s}"
342
+
343
+ if !File.directory?(pkg.srcdir)
344
+ Autoproj.progress " NOT checked out yet, reported dependencies will be partial"
345
+ end
346
+
347
+ optdeps = pkg.optional_dependencies.to_set
348
+ real_deps = pkg.dependencies.to_a
349
+ actual_real_deps = real_deps.find_all { |dep_name| !optdeps.include?(dep_name) }
350
+ if !actual_real_deps.empty?
351
+ Autoproj.progress " deps: #{actual_real_deps.join(", ")}"
352
+ end
353
+
354
+ selected_opt_deps, opt_deps = optdeps.partition { |dep_name| real_deps.include?(dep_name) }
355
+ if !selected_opt_deps.empty?
356
+ Autoproj.progress " enabled opt deps: #{selected_opt_deps.join(", ")}"
357
+ end
358
+ if !opt_deps.empty?
359
+ Autoproj.progress " disabled opt deps: #{opt_deps.join(", ")}"
360
+ end
298
361
  end
299
362
  end
300
363
 
@@ -325,11 +388,11 @@ module Autoproj
325
388
 
326
389
  def self.verify_package_availability(pkg_name)
327
390
  if reason = Autoproj.manifest.exclusion_reason(pkg_name)
328
- raise ConfigError, "#{pkg_name} is excluded from the build: #{reason}"
391
+ raise ConfigError.new, "#{pkg_name} is excluded from the build: #{reason}"
329
392
  end
330
393
  pkg = Autobuild::Package[pkg_name]
331
394
  if !pkg
332
- raise ConfigError, "#{pkg_name} does not seem to exist"
395
+ raise ConfigError.new, "#{pkg_name} does not seem to exist"
333
396
  end
334
397
 
335
398
  # Verify that its dependencies are there, and add
@@ -349,7 +412,7 @@ module Autoproj
349
412
  map do |pkg_name|
350
413
  pkg = Autobuild::Package[pkg_name]
351
414
  if !pkg
352
- raise ConfigError, "selected package #{pkg_name} does not exist"
415
+ raise ConfigError.new, "selected package #{pkg_name} does not exist"
353
416
  end
354
417
  pkg
355
418
  end.to_set
@@ -397,11 +460,13 @@ module Autoproj
397
460
  # If the package has no importer, the source directory must
398
461
  # be there
399
462
  if !pkg.importer && !File.directory?(pkg.srcdir)
400
- raise ConfigError, "#{pkg.name} has no VCS, but is not checked out in #{pkg.srcdir}"
463
+ raise ConfigError.new, "#{pkg.name} has no VCS, but is not checked out in #{pkg.srcdir}"
401
464
  end
402
465
 
403
466
  Rake::Task["#{pkg.name}-import"].invoke
404
467
  manifest.load_package_manifest(pkg.name)
468
+ pkg.resolve_optional_dependencies
469
+ verify_package_availability(pkg.name)
405
470
  end
406
471
 
407
472
  current_packages.each do |pkg|
@@ -496,6 +561,7 @@ module Autoproj
496
561
  def self.check?; !!@check end
497
562
  def self.manifest_update?; !!@manifest_update end
498
563
  def self.only_config?; !!@only_config end
564
+ def self.randomize_layout?; !!@randomize_layout end
499
565
  def self.update_os_dependencies?
500
566
  # Check if the mode disables osdeps anyway ...
501
567
  if !@update_os_dependencies.nil? && !@update_os_dependencies
@@ -515,7 +581,7 @@ module Autoproj
515
581
  def self.partial_build?; !!@partial_build end
516
582
  def self.mail_config; @mail_config || Hash.new end
517
583
  def self.update_packages?; @mode == "update" || @mode == "envsh" || build? end
518
- def self.update_envsh?; @mode == "envsh" || build? end
584
+ def self.update_envsh?; @mode == "envsh" || build? || @mode == "update" end
519
585
  def self.build?; @mode =~ /build/ end
520
586
  def self.doc?; @mode == "doc" end
521
587
  def self.snapshot?; @mode == "snapshot" end
@@ -531,7 +597,7 @@ module Autoproj
531
597
  end
532
598
  end
533
599
  def self.list_newest?; @list_newest end
534
- def self.parse_arguments(args)
600
+ def self.parse_arguments(args, with_mode = true)
535
601
  @only_status = false
536
602
  @only_local = false
537
603
  @show_osdeps = false
@@ -680,6 +746,10 @@ where 'mode' is one of:
680
746
  opts.on("--local", "for status, do not access the network") do
681
747
  @only_local = true
682
748
  end
749
+ opts.on('--randomize-layout', 'in build and full-build, generate a random layout') do
750
+ @randomize_layout = true
751
+ Autoproj.change_option('randomize_layout', true)
752
+ end
683
753
 
684
754
  opts.on("--verbose", "verbose output") do
685
755
  Autoproj.verbose = true
@@ -722,14 +792,16 @@ where 'mode' is one of:
722
792
  parser.parse!(args)
723
793
  @mail_config = mail_config
724
794
 
725
- @mode = args.shift
726
- unknown_mode = catch(:unknown) do
727
- handle_mode(@mode, args)
728
- end
729
- if unknown_mode
730
- STDERR.puts "unknown mode #{@mode}"
731
- STDERR.puts "run autoproj --help for more documentation"
732
- exit(1)
795
+ if with_mode
796
+ @mode = args.shift
797
+ unknown_mode = catch(:unknown) do
798
+ handle_mode(@mode, args)
799
+ end
800
+ if unknown_mode
801
+ STDERR.puts "unknown mode #{@mode}"
802
+ STDERR.puts "run autoproj --help for more documentation"
803
+ exit(1)
804
+ end
733
805
  end
734
806
 
735
807
  selection = args.dup
@@ -912,8 +984,8 @@ where 'mode' is one of:
912
984
  console = Autoproj.console
913
985
 
914
986
  sources = Autoproj.manifest.each_configuration_source.
915
- map do |vcs, text_name, pkg_name, local_dir|
916
- Autoproj::Manifest.create_autobuild_package(vcs, text_name, pkg_name, local_dir)
987
+ map do |vcs, text_name, local_dir|
988
+ Autoproj::Manifest.create_autobuild_package(vcs, text_name, local_dir)
917
989
  end
918
990
 
919
991
  if !sources.empty?
@@ -1010,7 +1082,7 @@ where 'mode' is one of:
1010
1082
 
1011
1083
  FileUtils.mv config_dir, backup_name
1012
1084
  end
1013
- Autoproj::Manifest.update_source(vcs, "autoproj main configuration", 'autoproj_config', config_dir)
1085
+ Autoproj::Manifest.update_package_set(vcs, "autoproj main configuration", config_dir)
1014
1086
 
1015
1087
  # Now write it in the config file
1016
1088
  File.open(File.join(Autoproj.config_dir, "config.yml"), "a") do |io|
@@ -1035,7 +1107,7 @@ manifest_source:
1035
1107
 
1036
1108
  def self.bootstrap(*args)
1037
1109
  if File.exists?(File.join("autoproj", "manifest"))
1038
- raise ConfigError, "this installation is already bootstrapped. Remove the autoproj directory if it is not the case"
1110
+ raise ConfigError.new, "this installation is already bootstrapped. Remove the autoproj directory if it is not the case"
1039
1111
  end
1040
1112
 
1041
1113
  require 'set'
@@ -1096,7 +1168,7 @@ manifest_source:
1096
1168
  manifest_data =
1097
1169
  begin open(manifest_url) { |file| file.read }
1098
1170
  rescue
1099
- raise ConfigError, "cannot read #{manifest_url}, did you mean 'autoproj bootstrap VCSTYPE #{manifest_url}' ?"
1171
+ raise ConfigError.new, "cannot read #{manifest_url}, did you mean 'autoproj bootstrap VCSTYPE #{manifest_url}' ?"
1100
1172
  end
1101
1173
 
1102
1174
  File.open(File.join(Autoproj.config_dir, "manifest"), "w") do |io|
@@ -1109,6 +1181,8 @@ manifest_source:
1109
1181
  do_switch_config(false, type, url, *options)
1110
1182
  end
1111
1183
 
1184
+ Autoproj.save_config
1185
+
1112
1186
  # Finally, generate an env.sh script
1113
1187
  File.open('env.sh', 'w') do |io|
1114
1188
  io.write <<-EOSHELL