autoproj 1.7.12.rc1 → 1.7.12.rc2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/autoproj CHANGED
@@ -47,6 +47,14 @@ end
47
47
 
48
48
  Autoproj::OSDependencies.autodetect_ruby
49
49
 
50
+ # Check the first element of ARGV. If a tool called autoproj-VALUE exists, just
51
+ # pass the hand to it
52
+ prefix = File.expand_path(__FILE__)
53
+ if File.file?("#{prefix}-#{ARGV.first}")
54
+ binary = "#{prefix}-#{ARGV.shift}"
55
+ exec(binary, *ARGV)
56
+ end
57
+
50
58
  # Find the autoproj root dir
51
59
  report do
52
60
  selected_packages =
@@ -217,20 +225,6 @@ EOTEXT
217
225
  Autoproj::CmdLine.build_packages(command_line_selection, all_enabled_packages)
218
226
  elsif Autoproj::CmdLine.build?
219
227
  Autoproj::CmdLine.build_packages(command_line_selection, all_enabled_packages)
220
-
221
- # Now, do some sanity checks on the result
222
- prefixes = all_enabled_packages.inject(Set.new) do |set, pkg_name|
223
- set << Autobuild::Package[pkg_name].prefix
224
- end
225
-
226
- Autoproj.progress
227
- Autoproj.progress "checking for undefined symbols in installed libraries", :bold
228
- prefixes.each do |prefix|
229
- libdir = File.join(prefix, "lib")
230
- if File.directory?(libdir)
231
- Autoproj.validate_solib_dependencies(libdir)
232
- end
233
- end
234
228
  end
235
229
 
236
230
  if Autoproj::CmdLine.update_envsh?
data/lib/autoproj.rb CHANGED
@@ -7,6 +7,7 @@ require 'autoproj/osdeps'
7
7
  require 'autoproj/system'
8
8
  require 'autoproj/options'
9
9
  require 'autoproj/cmdline'
10
+ require 'autoproj/query'
10
11
  require 'logger'
11
12
  require 'utilrb/logger'
12
13
 
@@ -348,6 +348,13 @@ module Autoproj
348
348
  package_sets << pkg_set
349
349
  all_packages[name] = [manifest.package(name).autobuild, pkg_set.name]
350
350
  end
351
+
352
+ metapackages = Set.new
353
+ manifest.metapackages.each_value do |metap|
354
+ if package_list.any? { |pkg_name| metap.include?(pkg_name) }
355
+ metapackages << metap
356
+ end
357
+ end
351
358
  else
352
359
  package_sets = manifest.each_package_set
353
360
  package_sets.each do |pkg_set|
@@ -355,6 +362,8 @@ module Autoproj
355
362
  all_packages[pkg.name] = [pkg, pkg_set.name]
356
363
  end
357
364
  end
365
+
366
+ metapackages = manifest.metapackages.values
358
367
  end
359
368
 
360
369
  if package_sets.empty?
@@ -364,7 +373,7 @@ module Autoproj
364
373
 
365
374
  Autoproj.progress
366
375
  Autoproj.progress("autoproj: package sets", :bold)
367
- package_sets.each do |pkg_set|
376
+ package_sets.sort_by(&:name).each do |pkg_set|
368
377
  next if pkg_set.empty?
369
378
  if pkg_set.imported_from
370
379
  Autoproj.progress "#{pkg_set.name} (imported by #{pkg_set.imported_from.name})"
@@ -393,6 +402,13 @@ module Autoproj
393
402
  Autoproj.progress " defines: #{set_packages.map(&:name).join(", ")}"
394
403
  end
395
404
 
405
+ Autoproj.progress
406
+ Autoproj.progress("autoproj: metapackages", :bold)
407
+ metapackages.sort_by(&:name).each do |metap|
408
+ Autoproj.progress "#{metap.name}"
409
+ Autoproj.progress " includes: #{metap.packages.map(&:name).sort.join(", ")}"
410
+ end
411
+
396
412
  packages_not_present = []
397
413
 
398
414
  Autoproj.progress
@@ -412,7 +428,7 @@ module Autoproj
412
428
  else
413
429
  Autoproj.progress " tags: #{pkg.tags.to_a.sort.join(", ")}"
414
430
  end
415
- Autoproj.progress " defined in #{pkg_set}"
431
+ Autoproj.progress " defined in package set #{pkg_set}"
416
432
  if File.directory?(pkg.srcdir)
417
433
  Autoproj.progress " checked out in #{pkg.srcdir}"
418
434
  else
@@ -982,6 +998,10 @@ where 'mode' is one of:
982
998
  @only_config = true
983
999
 
984
1000
  when "switch-config"
1001
+ if Dir.pwd.start_with?(Autoproj.remotes_dir) || Dir.pwd.start_with?(Autoproj.config_dir)
1002
+ raise ConfigError, "you cannot run autoproj switch-config from autoproj's configuration directory or one of its subdirectories"
1003
+ end
1004
+
985
1005
  # We must switch to the root dir first, as it is required by the
986
1006
  # configuration switch code. This is acceptable as long as we
987
1007
  # quit just after the switch
@@ -1187,7 +1207,7 @@ where 'mode' is one of:
1187
1207
  def self.switch_config(*args)
1188
1208
  Autoproj.load_config
1189
1209
  if Autoproj.has_config_key?('manifest_source')
1190
- vcs = Autoproj.normalize_vcs_definition(Autoproj.user_config('manifest_source'))
1210
+ vcs = VCSDefinition.from_raw(Autoproj.user_config('manifest_source'))
1191
1211
  end
1192
1212
 
1193
1213
  if args.first =~ /^(\w+)=/
@@ -1209,7 +1229,8 @@ where 'mode' is one of:
1209
1229
  opt_name, opt_value = opt.split('=')
1210
1230
  vcs_def[opt_name] = opt_value
1211
1231
  end
1212
- Autoproj.normalize_vcs_definition(vcs_def)
1232
+ # Validate the VCS definition, but save the hash as-is
1233
+ VCSDefinition.from_raw(vcs_def)
1213
1234
  Autoproj.change_option "manifest_source", vcs_def.dup, true
1214
1235
  Autoproj.save_config
1215
1236
  true
@@ -1238,7 +1259,7 @@ where 'mode' is one of:
1238
1259
  vcs_def[name] = value
1239
1260
  end
1240
1261
 
1241
- vcs = Autoproj.normalize_vcs_definition(vcs_def)
1262
+ vcs = VCSDefinition.from_raw(vcs_def)
1242
1263
 
1243
1264
  # Install the OS dependencies required for this VCS
1244
1265
  Autoproj::OSDependencies.define_osdeps_mode_option
@@ -1276,7 +1297,7 @@ where 'mode' is one of:
1276
1297
  vcs_def[opt_name] = opt_val
1277
1298
  end
1278
1299
  # Validate the option hash, just in case
1279
- Autoproj.normalize_vcs_definition(vcs_def)
1300
+ VCSDefinition.from_raw(vcs_def)
1280
1301
  # Save the new options
1281
1302
  Autoproj.change_option "manifest_source", vcs_def.dup, true
1282
1303
  Autoproj.save_config
@@ -60,40 +60,186 @@ module Autoproj
60
60
  @env_inherit |= names
61
61
  end
62
62
 
63
- # Resets the value of the given environment variable to the given
63
+ # Sets an environment variable
64
+ #
65
+ # This sets (or resets) the environment variable +name+ to the given value.
66
+ # If multiple values are given, they are joined with ':'
67
+ #
68
+ # The values can contain configuration parameters using the
69
+ # $CONF_VARIABLE_NAME syntax.
64
70
  def self.env_set(name, *value)
65
71
  Autobuild.env_clear(name)
66
72
  env_add(name, *value)
67
73
  end
74
+
75
+ # Adds new values to a given environment variable
76
+ #
77
+ # Adds the given value(s) to the environment variable named +name+. The
78
+ # values are added using the ':' marker.
79
+ #
80
+ # The values can contain configuration parameters using the
81
+ # $CONF_VARIABLE_NAME syntax.
68
82
  def self.env_add(name, *value)
69
83
  value = value.map { |v| expand_environment(v) }
70
84
  Autobuild.env_add(name, *value)
71
85
  end
86
+
87
+ # Sets an environment variable which is a path search variable (such as
88
+ # PATH, RUBYLIB, PYTHONPATH)
89
+ #
90
+ # This sets (or resets) the environment variable +name+ to the given value.
91
+ # If multiple values are given, they are joined with ':'. Unlike env_set,
92
+ # duplicate values will be removed.
93
+ #
94
+ # The values can contain configuration parameters using the
95
+ # $CONF_VARIABLE_NAME syntax.
72
96
  def self.env_set_path(name, *value)
73
97
  Autobuild.env_clear(name)
74
98
  env_add_path(name, *value)
75
99
  end
100
+
101
+ # Adds new values to a given environment variable, which is a path search
102
+ # variable (such as PATH, RUBYLIB, PYTHONPATH)
103
+ #
104
+ # Adds the given value(s) to the environment variable named +name+. The
105
+ # values are added using the ':' marker. Unlike env_set, duplicate values
106
+ # will be removed.
107
+ #
108
+ # The values can contain configuration parameters using the
109
+ # $CONF_VARIABLE_NAME syntax.
110
+ #
111
+ # This is usually used in package configuration blocks to add paths
112
+ # dependent on the place of install, such as
113
+ #
114
+ # cmake_package 'test' do |pkg|
115
+ # Autoproj.env_add_path 'RUBYLIB', File.join(pkg.srcdir, 'bindings', 'ruby')
116
+ # end
76
117
  def self.env_add_path(name, *value)
77
118
  value = value.map { |v| expand_environment(v) }
78
119
  Autobuild.env_add_path(name, *value)
79
120
  end
80
121
 
122
+ # Representation of a VCS definition contained in a source.yml file or in
123
+ # autoproj/manifest
81
124
  class VCSDefinition
82
125
  attr_reader :type
83
126
  attr_reader :url
84
127
  attr_reader :options
85
128
 
86
- def initialize(type, url, options)
129
+ # The original spec in hash form. Set if this VCSDefinition object has
130
+ # been created using VCSDefinition.from_raw
131
+ attr_reader :raw
132
+
133
+ def initialize(type, url, options, raw = nil)
134
+ if raw && !raw.respond_to?(:to_ary)
135
+ raise ArgumentError, "wrong format for the raw field (#{raw.inspect})"
136
+ end
137
+
87
138
  @type, @url, @options = type, url, options
88
139
  if type != "none" && type != "local" && !Autobuild.respond_to?(type)
89
140
  raise ConfigError.new, "version control #{type} is unknown to autoproj"
90
141
  end
142
+ @raw = raw
91
143
  end
92
144
 
93
145
  def local?
94
146
  @type == 'local'
95
147
  end
96
148
 
149
+ # Updates the VCS specification +old+ by the information contained in
150
+ # +new+
151
+ #
152
+ # Both +old+ and +new+ are supposed to be in hash form. It is assumed
153
+ # that +old+ has already been normalized by a call to
154
+ # Autoproj.vcs_definition_to_hash. +new+ can be in "raw" form.
155
+ def self.update_raw_vcs_spec(old, new)
156
+ new = vcs_definition_to_hash(new)
157
+ if new.has_key?(:type) && (old[:type] != new[:type])
158
+ # The type changed. We replace the old definition by the new one
159
+ # completely, and we make sure that the new definition is valid
160
+ from_raw(new)
161
+ new
162
+ else
163
+ old.merge(new)
164
+ end
165
+ end
166
+
167
+ # Normalizes a VCS definition contained in a YAML file into a hash
168
+ #
169
+ # It handles custom source handler expansion, as well as the bad habit
170
+ # of forgetting a ':' at the end of a line:
171
+ #
172
+ # - package_name
173
+ # branch: value
174
+ def self.vcs_definition_to_hash(spec)
175
+ options = Hash.new
176
+
177
+ plain = Array.new
178
+ filtered_spec = Hash.new
179
+ spec.each do |key, value|
180
+ keys = key.to_s.split(/\s+/)
181
+ plain.concat(keys[0..-2])
182
+ filtered_spec[keys[-1].to_sym] = value
183
+ end
184
+ spec = filtered_spec
185
+
186
+ if plain.size > 1
187
+ raise ConfigError.new, "invalid syntax"
188
+ elsif plain.size == 1
189
+ short_url = plain.first
190
+ vcs, *url = short_url.split(':')
191
+
192
+ # Check if VCS is a known version control system or source handler
193
+ # shortcut. If it is not, look for a local directory called
194
+ # short_url
195
+ if Autobuild.respond_to?(vcs)
196
+ spec.merge!(:type => vcs, :url => url.join(':'))
197
+ elsif Autoproj.has_source_handler?(vcs)
198
+ spec = Autoproj.call_source_handler(vcs, url.join(':'), spec)
199
+ else
200
+ source_dir = File.expand_path(File.join(Autoproj.config_dir, short_url))
201
+ if !File.directory?(source_dir)
202
+ raise ConfigError.new, "'#{spec.inspect}' is neither a remote source specification, nor a local source definition"
203
+ end
204
+ spec.merge!(:type => 'local', :url => source_dir)
205
+ end
206
+ end
207
+
208
+ spec, vcs_options = Kernel.filter_options spec, :type => nil, :url => nil
209
+ spec.merge!(vcs_options)
210
+ if !spec[:url]
211
+ # Verify that none of the keys are source handlers. If it is the
212
+ # case, convert
213
+ filtered_spec = Hash.new
214
+ spec.dup.each do |key, value|
215
+ if Autoproj.has_source_handler?(key)
216
+ spec.delete(key)
217
+ spec = Autoproj.call_source_handler(key, value, spec)
218
+ break
219
+ end
220
+ end
221
+ end
222
+
223
+ spec
224
+ end
225
+
226
+ # Autoproj configuration files accept VCS definitions in three forms:
227
+ # * as a plain string, which is a relative/absolute path
228
+ # * as a plain string, which is a vcs_type:url string
229
+ # * as a hash
230
+ #
231
+ # This method returns the VCSDefinition object matching one of these
232
+ # specs. It raises ConfigError if there is no type and/or url
233
+ def self.from_raw(spec, raw_spec = [[nil, spec]])
234
+ spec = vcs_definition_to_hash(spec)
235
+ if !(spec[:type] && (spec[:type] == 'none' || spec[:url]))
236
+ raise ConfigError.new, "the source specification #{spec.inspect} misses either the VCS type or an URL"
237
+ end
238
+
239
+ spec, vcs_options = Kernel.filter_options spec, :type => nil, :url => nil
240
+ return VCSDefinition.new(spec[:type], spec[:url], vcs_options, raw_spec)
241
+ end
242
+
97
243
  def ==(other_vcs)
98
244
  return false if !other_vcs.kind_of?(VCSDefinition)
99
245
  if local?
@@ -117,6 +263,10 @@ module Autoproj
117
263
  url
118
264
  end
119
265
 
266
+ # Returns a properly configured instance of a subclass of
267
+ # Autobuild::Importer that match this VCS definition
268
+ #
269
+ # Returns nil if the VCS type is 'none'
120
270
  def create_autobuild_importer
121
271
  return if type == "none"
122
272
 
@@ -124,6 +274,7 @@ module Autoproj
124
274
  Autobuild.send(type, url, options)
125
275
  end
126
276
 
277
+ # Returns a pretty representation of this VCS definition
127
278
  def to_s
128
279
  if type == "none"
129
280
  "none"
@@ -186,74 +337,11 @@ module Autoproj
186
337
  @custom_source_handlers[name.to_s] = lambda(&handler)
187
338
  end
188
339
 
189
- def self.vcs_definition_to_hash(spec)
190
- options = Hash.new
191
-
192
- plain = Array.new
193
- filtered_spec = Hash.new
194
- spec.each do |key, value|
195
- keys = key.to_s.split(/\s+/)
196
- plain.concat(keys[0..-2])
197
- filtered_spec[keys[-1].to_sym] = value
198
- end
199
- spec = filtered_spec
200
-
201
- if plain.size > 1
202
- raise ConfigError.new, "invalid syntax"
203
- elsif plain.size == 1
204
- short_url = plain.first
205
- vcs, *url = short_url.split(':')
206
-
207
- # Check if VCS is a known version control system or source handler
208
- # shortcut. If it is not, look for a local directory called
209
- # short_url
210
- if Autobuild.respond_to?(vcs)
211
- spec.merge!(:type => vcs, :url => url.join(':'))
212
- elsif has_source_handler?(vcs)
213
- spec = call_source_handler(vcs, url.join(':'), spec)
214
- else
215
- source_dir = File.expand_path(File.join(Autoproj.config_dir, short_url))
216
- if !File.directory?(source_dir)
217
- raise ConfigError.new, "'#{spec.inspect}' is neither a remote source specification, nor a local source definition"
218
- end
219
- spec.merge!(:type => 'local', :url => source_dir)
220
- end
221
- end
222
-
223
- spec, vcs_options = Kernel.filter_options spec, :type => nil, :url => nil
224
- spec.merge!(vcs_options)
225
- if !spec[:url]
226
- # Verify that none of the keys are source handlers. If it is the
227
- # case, convert
228
- filtered_spec = Hash.new
229
- spec.dup.each do |key, value|
230
- if has_source_handler?(key)
231
- spec.delete(key)
232
- spec = call_source_handler(key, value, spec)
233
- break
234
- end
235
- end
236
- end
237
-
238
- spec
239
- end
240
-
241
- # Autoproj configuration files accept VCS definitions in three forms:
242
- # * as a plain string, which is a relative/absolute path
243
- # * as a plain string, which is a vcs_type:url string
244
- # * as a hash
340
+ # Does a non-recursive expansion in +data+ of configuration variables
341
+ # ($VAR_NAME) listed in +definitions+
245
342
  #
246
- # This method normalizes the three forms into a VCSDefinition object
247
- def self.normalize_vcs_definition(spec)
248
- spec = vcs_definition_to_hash(spec)
249
- if !(spec[:type] && (spec[:type] == 'none' || spec[:url]))
250
- raise ConfigError.new, "the source specification #{spec.inspect} misses either the VCS type or an URL"
251
- end
252
-
253
- spec, vcs_options = Kernel.filter_options spec, :type => nil, :url => nil
254
- return VCSDefinition.new(spec[:type], spec[:url], vcs_options)
255
- end
256
-
343
+ # If the values listed in +definitions+ also contain configuration
344
+ # variables, they do not get expanded
257
345
  def self.single_expansion(data, definitions)
258
346
  if !data.respond_to?(:to_str)
259
347
  return data
@@ -300,6 +388,10 @@ module Autoproj
300
388
  end
301
389
  end
302
390
 
391
+ # Resolves all possible variable references from +constants+
392
+ #
393
+ # I.e. replaces variables by their values, so that no value in +constants+
394
+ # refers to variables defined in +constants+
303
395
  def self.resolve_constant_definitions(constants)
304
396
  constants = constants.dup
305
397
  constants['HOME'] = ENV['HOME']
@@ -319,6 +411,7 @@ module Autoproj
319
411
  # dependencies that are provided by the operating system (.osdeps file).
320
412
  class PackageSet
321
413
  attr_reader :manifest
414
+
322
415
  # The VCSDefinition object that defines the version control holding
323
416
  # information for this source. Local package sets (i.e. the ones that are not
324
417
  # under version control) use the 'local' version control name. For them,
@@ -402,15 +495,15 @@ module Autoproj
402
495
 
403
496
  # Create a PackageSet instance from its description as found in YAML
404
497
  # configuration files
405
- def self.from_spec(manifest, spec, load_description)
406
- spec = Autoproj.vcs_definition_to_hash(spec)
498
+ def self.from_spec(manifest, raw_spec, load_description)
499
+ spec = VCSDefinition.vcs_definition_to_hash(raw_spec)
407
500
  options, vcs_spec = Kernel.filter_options spec, :auto_imports => true
408
501
 
409
502
  # Look up for short notation (i.e. not an explicit hash). It is
410
503
  # either vcs_type:url or just url. In the latter case, we expect
411
504
  # 'url' to be a path to a local directory
412
505
  vcs_spec = Autoproj.expand(vcs_spec, manifest.constant_definitions)
413
- vcs_def = Autoproj.normalize_vcs_definition(vcs_spec)
506
+ vcs_def = VCSDefinition.from_raw(vcs_spec, [[nil, raw_spec]])
414
507
 
415
508
  source = PackageSet.new(manifest, vcs_def)
416
509
  source.auto_imports = options[:auto_imports]
@@ -428,6 +521,12 @@ module Autoproj
428
521
  source
429
522
  end
430
523
 
524
+ # Returns a string that uniquely represents the version control
525
+ # information for this package set.
526
+ #
527
+ # I.e. for two package sets set1 and set2, if set1.repository_id ==
528
+ # set2.repository_id, it means that both package sets are checked out
529
+ # from exactly the same source.
431
530
  def repository_id
432
531
  if local?
433
532
  local_dir
@@ -621,6 +720,7 @@ module Autoproj
621
720
  end
622
721
  end
623
722
 
723
+ raw = []
624
724
  vcs_spec = Hash.new
625
725
 
626
726
  if all_vcs
@@ -659,7 +759,7 @@ module Autoproj
659
759
  if spec == "none"
660
760
  spec = { :type => "none" }
661
761
  else
662
- raise ConfigError.new, "invalid VCS specification '#{name}: #{spec}'"
762
+ raise ConfigError.new, "invalid VCS specification in the #{section_name} section '#{name}: #{spec}'"
663
763
  end
664
764
  end
665
765
  end
@@ -669,7 +769,13 @@ module Autoproj
669
769
  name_match = Regexp.new("^" + name_match)
670
770
  end
671
771
  if name_match === package_name
672
- vcs_spec = vcs_spec.merge(spec)
772
+ raw << [self.name, spec]
773
+ vcs_spec =
774
+ begin
775
+ VCSDefinition.update_raw_vcs_spec(vcs_spec, spec)
776
+ rescue ConfigError => e
777
+ raise ConfigError.new, "invalid VCS definition in the #{section_name} section for '#{name}': #{e.message}", e.backtrace
778
+ end
673
779
  end
674
780
  end
675
781
  end
@@ -682,7 +788,6 @@ module Autoproj
682
788
  "AUTOPROJ_SOURCE_DIR" => local_dir]
683
789
 
684
790
  vcs_spec = expand(vcs_spec, expansions)
685
- vcs_spec = Autoproj.vcs_definition_to_hash(vcs_spec)
686
791
  vcs_spec.dup.each do |name, value|
687
792
  vcs_spec[name] = expand(value, expansions)
688
793
  end
@@ -690,9 +795,15 @@ module Autoproj
690
795
  # If required, verify that the configuration is a valid VCS
691
796
  # configuration
692
797
  if validate
693
- Autoproj.normalize_vcs_definition(vcs_spec)
798
+ begin
799
+ VCSDefinition.from_raw(vcs_spec)
800
+ rescue ConfigError => e
801
+ raise ConfigError.new, "invalid resulting VCS definition for package #{package_name}: #{e.message}", e.backtrace
802
+ end
694
803
  end
695
- vcs_spec
804
+ return vcs_spec, raw
805
+ else
806
+ return nil, []
696
807
  end
697
808
  end
698
809
 
@@ -701,9 +812,11 @@ module Autoproj
701
812
  #
702
813
  # The definition is an instance of VCSDefinition
703
814
  def importer_definition_for(package_name)
704
- vcs_spec = version_control_field(package_name, 'version_control')
705
- if vcs_spec
706
- Autoproj.normalize_vcs_definition(vcs_spec)
815
+ Autoproj.in_file source_file do
816
+ vcs_spec, raw = version_control_field(package_name, 'version_control')
817
+ if vcs_spec
818
+ VCSDefinition.from_raw(vcs_spec, raw)
819
+ end
707
820
  end
708
821
  end
709
822
 
@@ -733,7 +846,7 @@ module Autoproj
733
846
  # Specialization of the PackageSet class for the overrides listed in autoproj/
734
847
  class LocalPackageSet < PackageSet
735
848
  def initialize(manifest)
736
- super(manifest, Autoproj.normalize_vcs_definition(:type => 'local', :url => Autoproj.config_dir))
849
+ super(manifest, VCSDefinition.from_raw(:type => 'local', :url => Autoproj.config_dir))
737
850
  end
738
851
 
739
852
  def name
@@ -752,7 +865,7 @@ module Autoproj
752
865
  # Returns the default importer for this package set
753
866
  def default_importer
754
867
  importer_definition_for('default') ||
755
- Autoproj.normalize_vcs_definition(:type => 'none')
868
+ VCSDefinition.from_raw(:type => 'none')
756
869
  end
757
870
 
758
871
  def raw_description_file
@@ -782,6 +895,7 @@ module Autoproj
782
895
  attr_reader :file
783
896
  def setup?; !!@setup end
784
897
  attr_writer :setup
898
+ attr_accessor :vcs
785
899
 
786
900
  def initialize(autobuild, package_set, file)
787
901
  @autobuild, @package_set, @file =
@@ -935,7 +1049,7 @@ module Autoproj
935
1049
 
936
1050
  @constant_definitions = Hash.new
937
1051
  if Autoproj.has_config_key?('manifest_source')
938
- @vcs = Autoproj.normalize_vcs_definition(Autoproj.user_config('manifest_source'))
1052
+ @vcs = VCSDefinition.from_raw(Autoproj.user_config('manifest_source'))
939
1053
  end
940
1054
  end
941
1055
 
@@ -1193,7 +1307,7 @@ module Autoproj
1193
1307
  @package_sets = each_package_set(false).to_a
1194
1308
  @package_sets.each do |pkg_set|
1195
1309
  @metapackages[pkg_set.name] ||= Metapackage.new(pkg_set.name)
1196
- @metapackages["#{pkg_set.name}.all"] ||= Metapackage.new(pkg_set.name)
1310
+ @metapackages["#{pkg_set.name}.all"] ||= Metapackage.new("#{pkg_set.name}.all")
1197
1311
  end
1198
1312
  end
1199
1313
 
@@ -1402,16 +1516,25 @@ module Autoproj
1402
1516
 
1403
1517
  # Get the version control information from the package source. There
1404
1518
  # must be one
1405
- vcs_spec = package_source.version_control_field(package_name, 'version_control')
1519
+ vcs_spec, raw = Autoproj.in_file package_source.source_file do
1520
+ package_source.version_control_field(package_name, 'version_control')
1521
+ end
1406
1522
  return if !vcs_spec
1407
1523
 
1408
1524
  sources.each do |src|
1409
- overrides_spec = src.version_control_field(package_name, 'overrides', false)
1525
+ overrides_spec, raw_additional = src.version_control_field(package_name, 'overrides', false)
1526
+ raw = raw.concat(raw_additional)
1410
1527
  if overrides_spec
1411
- vcs_spec.merge!(overrides_spec)
1528
+ vcs_spec = Autoproj.in_file src.source_file do
1529
+ begin
1530
+ VCSDefinition.update_raw_vcs_spec(vcs_spec, overrides_spec)
1531
+ rescue ConfigError => e
1532
+ raise ConfigError.new, "invalid resulting VCS specification in the overrides section for package #{package_name}: #{e.message}"
1533
+ end
1534
+ end
1412
1535
  end
1413
1536
  end
1414
- Autoproj.normalize_vcs_definition(vcs_spec)
1537
+ VCSDefinition.from_raw(vcs_spec, raw)
1415
1538
  end
1416
1539
 
1417
1540
  # Sets up the package importers based on the information listed in
@@ -1437,6 +1560,7 @@ module Autoproj
1437
1560
 
1438
1561
  if vcs
1439
1562
  Autoproj.add_build_system_dependency vcs.type
1563
+ pkg.vcs = vcs
1440
1564
  pkg.autobuild.importer = vcs.create_autobuild_importer
1441
1565
  else
1442
1566
  raise ConfigError.new, "source #{pkg.package_set.name} defines #{pkg.autobuild.name}, but does not provide a version control definition for it"
@@ -1450,6 +1574,16 @@ module Autoproj
1450
1574
  each_package_set(false).find { |set| set.name == name }
1451
1575
  end
1452
1576
 
1577
+ # Returns the PackageSet object for the given package set, or raises
1578
+ # ArgumentError if none exists with that name
1579
+ def package_set(name)
1580
+ set = each_package_set(false).find { |set| set.name == name }
1581
+ if !set
1582
+ raise ArgumentError, "no package set called #{name} exists"
1583
+ end
1584
+ set
1585
+ end
1586
+
1453
1587
  # +name+ can either be the name of a source or the name of a package. In
1454
1588
  # the first case, we return all packages defined by that source. In the
1455
1589
  # latter case, we return the singleton array [name]
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.7.12.rc1"
2
+ VERSION = "1.7.12.rc2"
3
3
  end
data/shell/autoproj_bash CHANGED
@@ -1,6 +1,6 @@
1
1
  function acd {
2
2
  local pkg_path
3
- pkg_path=$(autolocate $1)
3
+ pkg_path=$(autoproj locate $1)
4
4
 
5
5
  if [ $? != 0 ]; then
6
6
  return 1
data/shell/autoproj_zsh CHANGED
@@ -1,6 +1,6 @@
1
1
  function acd {
2
2
  local pkg_path
3
- pkg_path=$(autolocate $1)
3
+ pkg_path=$(autoproj locate $1)
4
4
 
5
5
  if [ $? != 0 ]; then
6
6
  return 1
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424039
4
+ hash: 15424033
5
5
  prerelease: 7
6
6
  segments:
7
7
  - 1
8
8
  - 7
9
9
  - 12
10
10
  - rc
11
- - 1
12
- version: 1.7.12.rc1
11
+ - 2
12
+ version: 1.7.12.rc2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Sylvain Joyeux
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-07-14 00:00:00 Z
20
+ date: 2011-08-05 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: autobuild