autoproj 1.7.10 → 1.7.11.rc1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,41 @@
1
+ = Version 1.7.11
2
+ * loads of fixes related to ignore_packages
3
+ - fix ignored packages being built if a package depends on them
4
+ - allow whole package sets to be ignored
5
+ - make setup_package(package_name) { |pkg| ... } ignore the block if the
6
+ package is ignored
7
+ * really fix ignoring osdeps dependencies completely (thought to be working in
8
+ 1.7.9). The following syntax is now accepted in osdeps files:
9
+
10
+ ruby: ignore
11
+
12
+ * add the 'nonexistent' keyword in osdeps files. In combination with the
13
+ default target, it makes it easier to add new osdeps packages. For instance,
14
+ the following snippet will cause anyone trying to get libnl2-dev to fail on
15
+ older ubuntu versions:
16
+
17
+ libnl2:
18
+ debian: libnl2-dev
19
+ ubuntu:
20
+ '10.04,10.10': nonexistent
21
+ default: libnl2-dev
22
+
23
+ * add more fine-grained control over the osdeps/source packages relationships.
24
+ Until now, we had a fallback mechanism in which nonexistent osdeps would be
25
+ replaced by source packages with the same name.
26
+
27
+ The replacement packages can now be specified (they don't have to have the
28
+ same name) with
29
+
30
+ Autoproj.add_osdeps_overrides 'opencv', :packages => ['external/opencv']
31
+
32
+ Moreover, if one wants to make sure that the source package is taken instead
33
+ of the osdeps one regardless of everything else, he can do
34
+
35
+ Autoproj.add_osdeps_overrides 'opencv', :packages => ['external/opencv'], :force => true
36
+
37
+ * small API addition and fixes
38
+
1
39
  = Version 1.7.10
2
40
  * really fix support of virtual packages on dpkg-based systems (debian, ubuntu)
3
41
  1.7.9 was only supporting packages that were providing only one package
@@ -432,13 +432,11 @@ fi
432
432
  dep_def = definitions[name]
433
433
  if !dep_def
434
434
  return NO_PACKAGE
435
- end
436
-
437
- if dep_def == 'ignore'
435
+ elsif dep_def == 'ignore'
438
436
  return IGNORE
439
- end
440
-
441
- if !os_names
437
+ elsif dep_def == 'nonexistent'
438
+ return WRONG_OS_VERSION
439
+ elsif !os_names
442
440
  return UNKNOWN_OS
443
441
  end
444
442
 
@@ -478,6 +476,10 @@ fi
478
476
  data = version_entry.last
479
477
  end
480
478
 
479
+ if data.respond_to?(:to_str) && data.to_str == 'nonexistent'
480
+ return WRONG_OS_VERSION
481
+ end
482
+
481
483
  if data.respond_to?(:to_ary)
482
484
  # List of packages
483
485
  return [PACKAGES, data]
@@ -602,6 +604,7 @@ fi
602
604
  if pkg_def.respond_to?(:to_str)
603
605
  case(pkg_def.to_str)
604
606
  when "ignore" then
607
+ osdeps << name
605
608
  when "gem" then
606
609
  gems << name
607
610
  else
@@ -98,6 +98,8 @@ module Autobuild
98
98
  def depends_on(name)
99
99
  if Autoproj::CmdLine.ignore_dependencies?
100
100
  return
101
+ elsif Autoproj.manifest.ignored?(name)
102
+ return
101
103
  end
102
104
 
103
105
  @os_packages ||= Set.new
@@ -111,8 +113,22 @@ module Autobuild
111
113
  osdeps_availability = Autoproj.osdeps.availability_of(name)
112
114
  available_as_source = Autobuild::Package[name]
113
115
 
116
+ osdeps_overrides = Autoproj.manifest.osdeps_overrides[name]
117
+ if osdeps_overrides
118
+ source_packages = osdeps_overrides[:packages]
119
+ if source_packages.empty?
120
+ source_packages << name
121
+ end
122
+ force_source_usage = osdeps_overrides[:force]
123
+ available_as_source = true
124
+ end
125
+
114
126
  # Prefer OS packages to source packages
115
- if !explicit_selection
127
+ if force_source_usage && !source_packages.any? { |pkg_name| Autoproj.manifest.excluded?(pkg_name) }
128
+ source_packages.each do |pkg_name|
129
+ __depends_on__(pkg_name)
130
+ end
131
+ elsif !explicit_selection
116
132
  if osdeps_availability == Autoproj::OSDependencies::AVAILABLE
117
133
  @os_packages << name
118
134
  return
@@ -149,10 +165,11 @@ module Autobuild
149
165
  end
150
166
  # Should never reach further than that
151
167
  end
168
+ __depends_on__(name) # to get the error message
169
+ else
170
+ # Normal dependency
171
+ __depends_on__(name)
152
172
  end
153
-
154
-
155
- __depends_on__(name) # to get the error message
156
173
  end
157
174
 
158
175
  def depends_on_os_package(name)
@@ -259,6 +276,10 @@ module Autoproj
259
276
  @file_stack.pop
260
277
  end
261
278
 
279
+ class << self
280
+ attr_reader :loaded_autobuild_files
281
+ end
282
+
262
283
  def self.import_autobuild_file(source, path)
263
284
  return if @loaded_autobuild_files.include?(path)
264
285
 
@@ -302,8 +323,11 @@ def setup_package(package_name, &block)
302
323
  package_definition = Autoproj.manifest.package(package_name)
303
324
  if !package_definition
304
325
  raise ConfigError.new, "#{package_name} is not a known package"
326
+ elsif package_definition.autobuild.kind_of?(Autobuild::DummyPackage)
327
+ # Nothing to do!
328
+ else
329
+ package_definition.add_setup_block(block)
305
330
  end
306
- package_definition.add_setup_block(block)
307
331
  end
308
332
 
309
333
  # Common setup for packages
@@ -319,7 +343,7 @@ def package_common(package_type, spec, &block) # :nodoc:
319
343
  end
320
344
 
321
345
  # Check if this package is ignored
322
- if Autoproj.manifest.ignored?(package_name)
346
+ if Autoproj.manifest.ignored?(package_name) || Autoproj.manifest.ignored?(Autoproj.current_file[0].name)
323
347
  return Autoproj.define(:dummy, spec)
324
348
  end
325
349
 
@@ -41,6 +41,10 @@ module Autoproj
41
41
  Autobuild::Reporting << Autobuild::MailReporter.new(mail_config)
42
42
  end
43
43
 
44
+ # Remove from LOADED_FEATURES everything that is coming from our
45
+ # configuration directory
46
+ Autobuild::Package.clear
47
+ Autoproj.loaded_autobuild_files.clear
44
48
  Autoproj.load_config
45
49
 
46
50
  if Autoproj.has_config_key?('prefix')
@@ -302,6 +306,7 @@ module Autoproj
302
306
  pkg.user_blocks.each do |blk|
303
307
  blk[pkg.autobuild]
304
308
  end
309
+ pkg.setup = true
305
310
  end
306
311
 
307
312
  # Load the package's override files. each_source must not load the
@@ -469,6 +474,7 @@ module Autoproj
469
474
  while sel != '/'
470
475
  if handler = Autoproj.package_handler_for(sel)
471
476
  Autoproj.progress " auto-adding #{sel} using the #{handler.gsub(/_package/, '')} package handler"
477
+ sel = File.expand_path(sel)
472
478
  relative_to_root = Pathname.new(sel).relative_path_from(Pathname.new(Autoproj.root_dir))
473
479
  pkg = Autoproj.in_package_set(manifest.local_package_set, manifest.file) do
474
480
  send(handler, relative_to_root)
@@ -550,7 +556,8 @@ module Autoproj
550
556
  current_packages = current_packages.sort_by(&:name)
551
557
 
552
558
  current_packages.
553
- delete_if { |pkg| all_enabled_packages.include?(pkg.name) }
559
+ delete_if { |pkg| all_enabled_packages.include?(pkg.name) }.
560
+ delete_if { |pkg| Autoproj.manifest.ignored?(pkg.name) }
554
561
  all_enabled_packages |= current_packages.map(&:name).to_set
555
562
 
556
563
  # Recursively check that no package in the selection depend on
@@ -1632,6 +1639,9 @@ export PATH=$GEM_HOME/bin:$PATH
1632
1639
 
1633
1640
  Autoproj::CmdLine.update_os_dependencies = false
1634
1641
  Autoproj::CmdLine.initialize
1642
+ if Autobuild.do_update
1643
+ Autoproj::CmdLine.update_configuration
1644
+ end
1635
1645
  Autoproj::CmdLine.load_configuration
1636
1646
  Autoproj::CmdLine.setup_all_package_directories
1637
1647
  Autoproj::CmdLine.finalize_package_setup
@@ -55,14 +55,26 @@ module Autoproj
55
55
  root_rx = /^(?:http:\/\/git\.|git:\/\/|git@)#{Regexp.quote(base_url)}:?/
56
56
  if importer.kind_of?(Autobuild::Git) && importer.repository =~ root_rx && importer.repository !~ /^http/
57
57
  Autoproj.warn "import from #{importer.repository} failed, falling back to using http for all packages on #{base_url}"
58
+
59
+ base_replace_string = "http://git.#{base_url}"
58
60
  Autobuild::Package.each do |pkg_name, pkg|
59
61
  if pkg.importer.kind_of?(Autobuild::Git) && pkg.importer.repository =~ root_rx
60
- pkg.importer.repository.gsub!(root_rx, "http://git.#{base_url}")
62
+ if pkg.importer.repository =~ /^git@/
63
+ replace_string = "#{base_replace_string}/"
64
+ else
65
+ replace_string = base_replace_string
66
+ end
67
+ pkg.importer.repository.gsub!(root_rx, replace_string)
61
68
  end
62
69
  end
63
70
 
64
71
  http_importer = importer.dup
65
- http_importer.repository = importer.repository.gsub(root_rx, "http://git.#{base_url}")
72
+ if http_importer.repository =~ /^git@/
73
+ replace_string = "#{base_replace_string}/"
74
+ else
75
+ replace_string = base_replace_string
76
+ end
77
+ http_importer.repository = importer.repository.gsub(root_rx, replace_string)
66
78
  http_importer
67
79
  end
68
80
  end
@@ -696,6 +696,8 @@ module Autoproj
696
696
  attr_reader :user_blocks
697
697
  attr_reader :package_set
698
698
  attr_reader :file
699
+ def setup?; !!@setup end
700
+ attr_writer :setup
699
701
 
700
702
  def initialize(autobuild, package_set, file)
701
703
  @autobuild, @package_set, @file =
@@ -705,6 +707,9 @@ module Autoproj
705
707
 
706
708
  def add_setup_block(block)
707
709
  user_blocks << block
710
+ if setup?
711
+ block.call(autobuild)
712
+ end
708
713
  end
709
714
  end
710
715
 
@@ -813,6 +818,7 @@ module Autoproj
813
818
  @constants_definitions = Hash.new
814
819
  @disabled_imports = Set.new
815
820
  @moved_packages = Hash.new
821
+ @osdeps_overrides = Hash.new
816
822
 
817
823
  @constant_definitions = Hash.new
818
824
  if Autoproj.has_config_key?('manifest_source')
@@ -834,12 +840,35 @@ module Autoproj
834
840
  # This is useful if the packages are already installed on this system.
835
841
  def ignored?(package_name)
836
842
  if data['ignore_packages']
837
- data['ignore_packages'].any? { |l| Regexp.new(l) =~ package_name }
843
+ data['ignore_packages'].any? do |l|
844
+ if package_name == l
845
+ true
846
+ elsif source = definition_source(package_name)
847
+ source.name == l
848
+ else
849
+ false
850
+ end
851
+ end
838
852
  else
839
853
  false
840
854
  end
841
855
  end
842
856
 
857
+ # Removes all registered exclusions
858
+ def clear_exclusions
859
+ automatic_exclusions.clear
860
+ if excl = data['exclude_packages']
861
+ excl.clear
862
+ end
863
+ end
864
+
865
+ # Removes all registered ignored packages
866
+ def clear_ignored
867
+ if ignored = data['ignore_packages']
868
+ ignored.clear
869
+ end
870
+ end
871
+
843
872
  # The set of package names that are listed in the excluded_packages
844
873
  # section of the manifest
845
874
  def manifest_exclusions
@@ -1061,10 +1090,14 @@ module Autoproj
1061
1090
  end
1062
1091
 
1063
1092
  def definition_source(package_name)
1064
- @packages[package_name].package_set
1093
+ if pkg_def = @packages[package_name]
1094
+ pkg_def.package_set
1095
+ end
1065
1096
  end
1066
1097
  def definition_file(package_name)
1067
- @packages[package_name].file
1098
+ if pkg_def = @packages[package_name]
1099
+ pkg_def.file
1100
+ end
1068
1101
  end
1069
1102
 
1070
1103
  def package(name)
@@ -1408,7 +1441,9 @@ module Autoproj
1408
1441
  layout_data.each do |value|
1409
1442
  if value.kind_of?(Hash)
1410
1443
  subname, subdef = value.find { true }
1411
- normalized_layout(result, "#{layout_level}#{subname}/", subdef)
1444
+ if subdef
1445
+ normalized_layout(result, "#{layout_level}#{subname}/", subdef)
1446
+ end
1412
1447
  else
1413
1448
  result[value] = layout_level
1414
1449
  end
@@ -1526,6 +1561,31 @@ module Autoproj
1526
1561
  Autoproj.osdeps.install(required_os_packages, package_os_deps)
1527
1562
  end
1528
1563
 
1564
+ # The set of overrides added with #add_osdeps_overrides
1565
+ attr_reader :osdeps_overrides
1566
+
1567
+ # Declares that autoproj should use normal package(s) to provide the
1568
+ # +osdeps_name+ OS package in cases +osdeps_name+ does not exist.
1569
+ #
1570
+ # The full syntax is
1571
+ #
1572
+ # Autoproj.add_osdeps_overrides 'opencv', :package => 'external/opencv'
1573
+ #
1574
+ # If more than one packages should be built, use the :packages option
1575
+ # with an array:
1576
+ #
1577
+ # Autoproj.add_osdeps_overrides 'opencv', :packages => ['external/opencv', 'external/test']
1578
+ #
1579
+ # The :force option allows to force the usage of the source package(s),
1580
+ # regardless of the availability of the osdeps package.
1581
+ def add_osdeps_overrides(osdeps_name, options)
1582
+ options = Kernel.validate_options options, :package => nil, :packages => [], :force => false
1583
+ if pkg = options.delete(:package)
1584
+ options[:packages] << pkg
1585
+ end
1586
+ @osdeps_overrides[osdeps_name.to_s] = options
1587
+ end
1588
+
1529
1589
  # Package selection can be done in three ways:
1530
1590
  # * as a subdirectory in the layout
1531
1591
  # * as a on-disk directory
@@ -1585,7 +1645,29 @@ module Autoproj
1585
1645
  end
1586
1646
 
1587
1647
  # Remove packages that are explicitely excluded and/or ignored
1588
- expanded_packages.delete_if { |pkg_name| excluded?(pkg_name) || ignored?(pkg_name) }
1648
+ #
1649
+ # Raise an error if an explicit selection expands only to an
1650
+ # excluded package, and display a warning for ignored packages
1651
+ matches.each do |sel, expansion|
1652
+ next if expansion.empty?
1653
+ excluded, other = expansion.partition { |pkg_name| excluded?(pkg_name) }
1654
+ ignored, ok = other.partition { |pkg_name| ignored?(pkg_name) }
1655
+
1656
+ if ok.empty? && ignored.empty?
1657
+ packages = excluded.map do |pkg_name|
1658
+ [pkg_name, Autoproj.manifest.exclusion_reason(pkg_name)]
1659
+ end
1660
+ raise ConfigError.new, "selection #{sel} expands to #{packages.map(&:first).join(", ")} which are excluded from the build:\n #{packages.map { |name, reason| "#{name}: #{reason}" }.join("\n ")}"
1661
+ elsif !ignored.empty?
1662
+ ignored.each do |pkg_name|
1663
+ Autoproj.warn "#{pkg_name} was selected for #{sel}, but is explicitely ignored in the manifest"
1664
+ end
1665
+ end
1666
+ end
1667
+
1668
+ expanded_packages.delete_if do |pkg_name|
1669
+ excluded?(pkg_name) || ignored?(pkg_name)
1670
+ end
1589
1671
  return expanded_packages.to_set, (selection - matches.keys)
1590
1672
  end
1591
1673
 
@@ -1719,5 +1801,8 @@ module Autoproj
1719
1801
  end
1720
1802
  end
1721
1803
  end
1804
+ def self.add_osdeps_overrides(*args, &block)
1805
+ manifest.add_osdeps_overrides(*args, &block)
1806
+ end
1722
1807
  end
1723
1808
 
@@ -333,13 +333,11 @@ fi
333
333
  dep_def = definitions[name]
334
334
  if !dep_def
335
335
  return NO_PACKAGE
336
- end
337
-
338
- if dep_def == 'ignore'
336
+ elsif dep_def == 'ignore'
339
337
  return IGNORE
340
- end
341
-
342
- if !os_names
338
+ elsif dep_def == 'nonexistent'
339
+ return WRONG_OS_VERSION
340
+ elsif !os_names
343
341
  return UNKNOWN_OS
344
342
  end
345
343
 
@@ -379,6 +377,10 @@ fi
379
377
  data = version_entry.last
380
378
  end
381
379
 
380
+ if data.respond_to?(:to_str) && data.to_str == 'nonexistent'
381
+ return WRONG_OS_VERSION
382
+ end
383
+
382
384
  if data.respond_to?(:to_ary)
383
385
  # List of packages
384
386
  return [PACKAGES, data]
@@ -503,6 +505,7 @@ fi
503
505
  if pkg_def.respond_to?(:to_str)
504
506
  case(pkg_def.to_str)
505
507
  when "ignore" then
508
+ osdeps << name
506
509
  when "gem" then
507
510
  gems << name
508
511
  else
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.7.10"
2
+ VERSION = "1.7.11.rc1"
3
3
  end
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease:
4
+ hash: 15424031
5
+ prerelease: 7
6
6
  segments:
7
7
  - 1
8
8
  - 7
9
- - 10
10
- version: 1.7.10
9
+ - 11
10
+ - rc
11
+ - 1
12
+ version: 1.7.11.rc1
11
13
  platform: ruby
12
14
  authors:
13
15
  - Sylvain Joyeux
@@ -15,7 +17,7 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2011-05-05 00:00:00 Z
20
+ date: 2011-05-17 00:00:00 Z
19
21
  dependencies:
20
22
  - !ruby/object:Gem::Dependency
21
23
  name: autobuild
@@ -242,12 +244,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
242
244
  required_rubygems_version: !ruby/object:Gem::Requirement
243
245
  none: false
244
246
  requirements:
245
- - - ">="
247
+ - - ">"
246
248
  - !ruby/object:Gem::Version
247
- hash: 3
249
+ hash: 25
248
250
  segments:
249
- - 0
250
- version: "0"
251
+ - 1
252
+ - 3
253
+ - 1
254
+ version: 1.3.1
251
255
  requirements: []
252
256
 
253
257
  rubyforge_project: autobuild