autoproj 1.5.6 → 1.5.7

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,14 @@
1
+ = Version 1.5.7
2
+ * allow using options and constants in the manifest as well
3
+ This is so that we can use variables in the VCS definition for package sets.
4
+ * display a status message before we access the RubyGems server. Ruby may block
5
+ there in some cases, and it therefore gives a clue at what is actually
6
+ failing.
7
+ * fix autoproj status with remote sources: display the source name instead of
8
+ the URL
9
+ * fix symlink in autoproj/remotes after a checkout. The URL was used instead of
10
+ the source name. Further updates were fixing it.
11
+
1
12
  = Version 1.5.6
2
13
  * quickfix stupid bug in 1.5.5
3
14
 
data/bin/autoproj CHANGED
@@ -9,7 +9,6 @@ require 'autoproj'
9
9
  require 'autoproj/autobuild'
10
10
  require 'open-uri'
11
11
  require 'autoproj/cmdline'
12
- require 'pp'
13
12
 
14
13
  require 'highline'
15
14
  include Autoproj
@@ -278,7 +278,7 @@ module Autoproj
278
278
 
279
279
 
280
280
  def generate_os_script(dependencies)
281
- os_name, os_version = operating_system
281
+ os_name, os_version = OSDependencies.operating_system
282
282
  os_packages, shell_snippets = resolve_os_dependencies(dependencies)
283
283
 
284
284
  "#! /bin/bash\n" +
@@ -328,7 +328,6 @@ def not_on(*architectures)
328
328
 
329
329
  os = OSDependencies.operating_system
330
330
  matching_archs = architectures.find_all { |arch| arch[0] == os[0] }
331
- STDERR.puts matching_archs.inspect
332
331
  if matching_archs.empty?
333
332
  return yield
334
333
  elsif matching_archs.all? { |arch| arch[1] && !os[1].include?(arch[1].downcase) }
@@ -37,6 +37,12 @@ module Autoproj
37
37
  Autoproj.env_add 'PATH', bindir
38
38
  end
39
39
 
40
+ # We load the local init.rb first so that the manifest loading
41
+ # process can use options defined there for the autoproj version
42
+ # control information (for instance)
43
+ local_source = LocalSource.new
44
+ Autoproj.load_if_present(local_source, local_source.local_dir, "init.rb")
45
+
40
46
  manifest_path = File.join(Autoproj.config_dir, 'manifest')
41
47
  Autoproj.manifest = Manifest.load(manifest_path)
42
48
 
@@ -604,6 +610,12 @@ where 'mode' is one of:
604
610
  packages.each do |pkg|
605
611
  lines = []
606
612
 
613
+ pkg_name =
614
+ if pkg.respond_to?(:text_name)
615
+ pkg.text_name
616
+ else pkg.autoproj_name
617
+ end
618
+
607
619
  if !pkg.importer.respond_to?(:status)
608
620
  lines << color(" the #{pkg.importer.class.name.gsub(/.*::/, '')} importer does not support status display", :bold, :red)
609
621
  elsif !File.directory?(pkg.srcdir)
@@ -618,9 +630,9 @@ where 'mode' is one of:
618
630
  when Autobuild::Importer::Status::UP_TO_DATE
619
631
  if !status.uncommitted_code
620
632
  if last_was_in_sync
621
- STDERR.print ", #{pkg.autoproj_name}"
633
+ STDERR.print ", #{pkg_name}"
622
634
  else
623
- STDERR.print pkg.autoproj_name
635
+ STDERR.print pkg_name
624
636
  end
625
637
  last_was_in_sync = true
626
638
  next
@@ -655,11 +667,7 @@ where 'mode' is one of:
655
667
  end
656
668
 
657
669
  last_was_in_sync = false
658
- if pkg.respond_to?(:text_name)
659
- STDERR.print "#{pkg.text_name}:"
660
- else
661
- STDERR.print "#{pkg.autoproj_name}:"
662
- end
670
+ STDERR.print "#{pkg_name}:"
663
671
 
664
672
  if lines.size == 1
665
673
  STDERR.puts lines.first
@@ -166,13 +166,59 @@ module Autoproj
166
166
  if !data.respond_to?(:to_str)
167
167
  return data
168
168
  end
169
-
170
- definitions.each do |name, expanded|
171
- data = data.gsub /\$#{Regexp.quote(name)}\b/, expanded
169
+ definitions = { 'HOME' => ENV['HOME'] }.merge(definitions)
170
+
171
+ data = data.gsub /\$(\w+)/ do |constant_name|
172
+ constant_name = constant_name[1..-1]
173
+ if !(value = definitions[constant_name])
174
+ if !(value = Autoproj.user_config(constant_name))
175
+ if !block_given? || !(value = yield(constant_name))
176
+ raise ArgumentError, "cannot find a definition for $#{constant_name}"
177
+ end
178
+ end
179
+ end
180
+ value
172
181
  end
173
182
  data
174
183
  end
175
184
 
185
+ def self.expand(value, definitions = Hash.new)
186
+ if value.respond_to?(:to_hash)
187
+ value.dup.each do |name, definition|
188
+ value[name] = expand(definition, definitions)
189
+ end
190
+ value
191
+ else
192
+ value = single_expansion(value, definitions)
193
+ if contains_expansion?(value)
194
+ raise ConfigError, "some expansions are not defined in #{value.inspect}"
195
+ end
196
+ value
197
+ end
198
+ end
199
+
200
+ # True if the given string contains expansions
201
+ def self.contains_expansion?(string); string =~ /\$/ end
202
+
203
+ def self.resolve_one_constant(name, value, result, definitions)
204
+ result[name] = single_expansion(value, result) do |missing_name|
205
+ result[missing_name] = resolve_one_constant(missing_name, definitions.delete(missing_name), definitions)
206
+ end
207
+ end
208
+
209
+ def self.resolve_constant_definitions(constants)
210
+ constants = constants.dup
211
+ constants['HOME'] = ENV['HOME']
212
+
213
+ result = Hash.new
214
+ while !constants.empty?
215
+ name = constants.keys.first
216
+ value = constants.delete(name)
217
+ resolve_one_constant(name, value, result, constants)
218
+ end
219
+ result
220
+ end
221
+
176
222
  # A source is a version control repository which contains general source
177
223
  # information with package version control information (source.yml file),
178
224
  # package definitions (.autobuild files), and finally definition of
@@ -314,43 +360,21 @@ module Autoproj
314
360
  @source_definition = raw_description_file
315
361
  load_name
316
362
 
363
+
317
364
  # Compute the definition of constants
318
365
  begin
319
366
  constants = source_definition['constants'] || Hash.new
320
- constants['HOME'] = ENV['HOME']
321
-
322
- redo_expansion = true
323
- @constants_definitions = constants
324
- while redo_expansion
325
- redo_expansion = false
326
- constants.dup.each do |name, url|
327
- # Extract all expansions in the url
328
- if url =~ /\$(\w+)/
329
- expansion_name = $1
330
-
331
- if constants[expansion_name]
332
- constants[name] = single_expansion(url)
333
- else
334
- begin constants[name] = single_expansion(url,
335
- expansion_name => Autoproj.user_config(expansion_name))
336
- rescue ConfigError => e
337
- raise ConfigError, "constant '#{expansion_name}', used in the definition of '#{name}' is defined nowhere"
338
- end
339
- end
340
- redo_expansion = true
341
- end
342
- end
343
- end
367
+ @constants_definitions = Autoproj.resolve_constant_definitions(constants)
344
368
 
345
369
  rescue ConfigError => e
346
370
  raise ConfigError, "#{File.join(local_dir, "source.yml")}: #{e.message}", e.backtrace
347
371
  end
348
372
  end
349
373
 
350
- # True if the given string contains expansions
351
- def contains_expansion?(string); string =~ /\$/ end
352
-
353
374
  def single_expansion(data, additional_expansions = Hash.new)
375
+ if !source_definition
376
+ load_description_file
377
+ end
354
378
  Autoproj.single_expansion(data, additional_expansions.merge(constants_definitions))
355
379
  end
356
380
 
@@ -361,19 +385,7 @@ module Autoproj
361
385
  if !source_definition
362
386
  load_description_file
363
387
  end
364
-
365
- if data.respond_to?(:to_hash)
366
- data.dup.each do |name, value|
367
- data[name] = expand(value, additional_expansions)
368
- end
369
- else
370
- data = single_expansion(data, additional_expansions)
371
- if contains_expansion?(data)
372
- raise ConfigError, "some expansions are not defined in #{data.inspect}"
373
- end
374
- end
375
-
376
- data
388
+ Autoproj.expand(data, additional_expansions.merge(constants_definitions))
377
389
  end
378
390
 
379
391
  # Returns the default importer definition for this package set, as a
@@ -610,16 +622,24 @@ module Autoproj
610
622
  !!data['auto_update']
611
623
  end
612
624
 
625
+ attr_reader :constant_definitions
626
+
613
627
  def initialize(file, data)
614
628
  @file = file
615
629
  @data = data
616
630
  @packages = Hash.new
617
631
  @package_manifests = Hash.new
618
632
  @automatic_exclusions = Hash.new
633
+ @constants_definitions = Hash.new
619
634
 
620
635
  if Autoproj.has_config_key?('manifest_source')
621
636
  @vcs = Autoproj.normalize_vcs_definition(Autoproj.user_config('manifest_source'))
622
637
  end
638
+ if data['constants']
639
+ @constant_definitions = Autoproj.resolve_constant_definitions(data['constants'])
640
+ else
641
+ @constant_definitions = Hash.new
642
+ end
623
643
  end
624
644
 
625
645
  # True if the given package should not be built, with the packages that
@@ -741,6 +761,7 @@ module Autoproj
741
761
  # either vcs_type:url or just url. In the latter case, we expect
742
762
  # 'url' to be a path to a local directory
743
763
  vcs_def = begin
764
+ spec = Autoproj.expand(spec, constant_definitions)
744
765
  Autoproj.normalize_vcs_definition(spec)
745
766
  rescue ConfigError => e
746
767
  raise ConfigError, "in #{file}: #{e.message}"
@@ -901,8 +922,9 @@ module Autoproj
901
922
  FileUtils.rm_rf remotes_symlinks_dir
902
923
  FileUtils.mkdir remotes_symlinks_dir
903
924
  # Create symbolic links from .remotes/weird_url to
904
- # autoproj/remotes/name
925
+ # autoproj/remotes/name. Explicitely load the source name first
905
926
  each_remote_source(false) do |source|
927
+ source.load_name
906
928
  FileUtils.ln_sf source.raw_local_dir, File.join(remotes_symlinks_dir, source.name)
907
929
  end
908
930
  end
@@ -326,6 +326,7 @@ module Autoproj
326
326
  end
327
327
 
328
328
  if !gems.empty?
329
+ Autobuild.progress "looking for RubyGems updates"
329
330
  # Don't install gems that are already there ...
330
331
  gems.delete_if do |name|
331
332
  version_requirements = Gem::Requirement.default
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.5.6"
2
+ VERSION = "1.5.7"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 5
8
- - 6
9
- version: 1.5.6
8
+ - 7
9
+ version: 1.5.7
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-16 00:00:00 +02:00
17
+ date: 2010-07-08 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency