autoproj 1.9.3.rc1 → 1.9.3.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -130,12 +130,10 @@ EOTEXT
130
130
  #
131
131
  # First do the resolution to get auto-add, finalize the package
132
132
  # configuration, and then re-resolve
133
- Autoproj.silent do
134
- begin
135
- Autoproj::CmdLine.resolve_user_selection(selected_packages)
136
- rescue Autoproj::Manifest::ExcludedSelection => e
137
- raise e, "#{e.selection}, which is selected on the command line, cannot be built: #{e.message}"
138
- end
133
+ begin
134
+ Autoproj::CmdLine.resolve_user_selection(selected_packages)
135
+ rescue Autoproj::Manifest::ExcludedSelection => e
136
+ raise e, "#{e.selection}, which is selected on the command line, cannot be built: #{e.message}"
139
137
  end
140
138
  # Now load the rest of the configuration
141
139
  Autoproj::CmdLine.finalize_package_setup
@@ -144,7 +142,7 @@ EOTEXT
144
142
  begin
145
143
  Autoproj::CmdLine.resolve_user_selection(selected_packages)
146
144
  rescue Autoproj::Manifest::ExcludedSelection => e
147
- raise e, "#{e.sel}, which is selected on the command line, cannot be built: #{e.message}"
145
+ raise e, "#{e.selection}, which is selected on the command line, cannot be built: #{e.message}"
148
146
  end
149
147
  Autoproj::CmdLine.validate_user_selection(selected_packages, resolved_selected_packages)
150
148
 
@@ -299,8 +299,8 @@ fi
299
299
  class PortManager < ShellScriptManager
300
300
  def initialize
301
301
  super(['port'], true,
302
- "port '%s'",
303
- "port '%s'")
302
+ "port install '%s'",
303
+ "port install '%s'")
304
304
  end
305
305
  end
306
306
 
@@ -521,13 +521,7 @@ fi
521
521
  if !installed.empty? && Autobuild.do_update
522
522
  # Look if we can update the package ...
523
523
  dep = Gem::Dependency.new(name, version_requirements)
524
- available =
525
- if gem_fetcher.respond_to?(:find_matching)
526
- gem_fetcher.find_matching(dep, true, true, GemManager.with_prerelease)
527
- else
528
- dep.prerelease = GemManager.with_prerelease
529
- gem_fetcher.search_for_dependency(dep).first
530
- end
524
+ available = gem_fetcher.find_matching(dep, true, true, GemManager.with_prerelease)
531
525
  installed_version = installed.map(&:version).max
532
526
  available_version = available.map { |(name, v), source| v }.max
533
527
  if !available_version
@@ -1706,6 +1700,14 @@ module Autoproj
1706
1700
  false
1707
1701
  end
1708
1702
 
1703
+ # Forcefully sets the root directory
1704
+ #
1705
+ # This is mostly useful during bootstrapping (i.e. when the search would
1706
+ # fail)
1707
+ def self.root_dir=(dir)
1708
+ @root_dir = dir
1709
+ end
1710
+
1709
1711
  # Returns the root directory of the current autoproj installation.
1710
1712
  #
1711
1713
  # If the current directory is not in an autoproj installation,
@@ -37,8 +37,8 @@ module Autoproj
37
37
  end
38
38
 
39
39
  # Displays a warning message
40
- def self.warn(message)
41
- Autobuild.warn(message)
40
+ def self.warn(message, *style)
41
+ Autobuild.warn(message, *style)
42
42
  end
43
43
 
44
44
  module CmdLine
@@ -153,6 +153,13 @@ module Autoproj
153
153
  Autoproj.load_if_present(local_source, home_dir, ".autoprojrc")
154
154
  end
155
155
 
156
+ if Autoproj.has_config_key?('reused_autoproj_installations')
157
+ reused = Autoproj.user_config('reused_autoproj_installations')
158
+ reused.each do |path|
159
+ Autoproj.manifest.reuse(path)
160
+ end
161
+ end
162
+
156
163
  # We load the local init.rb first so that the manifest loading
157
164
  # process can use options defined there for the autoproj version
158
165
  # control information (for instance)
@@ -782,6 +789,17 @@ module Autoproj
782
789
  end
783
790
  end
784
791
 
792
+ selection.exclusions.each do |sel, pkg_names|
793
+ pkg_names.sort.each do |pkg_name|
794
+ Autoproj.warn "#{pkg_name}, which was selected for #{sel}, cannot be built: #{Autoproj.manifest.exclusion_reason(pkg_name)}", :bold
795
+ end
796
+ end
797
+ selection.ignores.each do |sel, pkg_names|
798
+ pkg_names.sort.each do |pkg_name|
799
+ Autoproj.warn "#{pkg_name}, which was selected for #{sel}, is ignored", :orange
800
+ end
801
+ end
802
+
785
803
  return all_enabled_packages
786
804
  end
787
805
 
@@ -1516,29 +1534,50 @@ where 'mode' is one of:
1516
1534
  end
1517
1535
  end
1518
1536
 
1537
+ Autoproj.root_dir = Dir.pwd
1519
1538
  Autobuild.logdir = File.join(Autoproj.prefix, 'log')
1520
1539
 
1521
1540
  # Check if GEM_HOME is set. If it is the case, assume that we are
1522
- # bootstrapping from another installation directory and start by
1523
- # copying the .gems directory
1541
+ # bootstrapping from another autoproj directory. We start by
1542
+ # forcefully installing autoproj/autobuild so that the installation
1543
+ # is self-contained.
1524
1544
  #
1525
1545
  # We don't use Autoproj.gem_home there as we might not be in an
1526
1546
  # autoproj directory at all
1527
1547
  gem_home = ENV['AUTOPROJ_GEM_HOME'] || File.join(Dir.pwd, ".gems")
1528
- if ENV['GEM_HOME'] && Autoproj.in_autoproj_installation?(ENV['GEM_HOME']) &&
1529
- ENV['GEM_HOME'] != gem_home
1530
- if !File.exists?(gem_home)
1531
- Autoproj.message "autoproj: reusing bootstrap from #{File.dirname(ENV['GEM_HOME'])}"
1532
- FileUtils.cp_r ENV['GEM_HOME'], gem_home
1548
+ if ENV['GEM_HOME'] && Autoproj.in_autoproj_installation?(ENV['GEM_HOME']) && ENV['GEM_HOME'] != gem_home
1549
+ Autoproj::OSDependencies.define_osdeps_mode_option
1550
+ osdeps = Autoproj::OSDependencies.load_default
1551
+ if osdeps_forced_mode
1552
+ osdeps.osdeps_mode = osdeps_forced_mode
1533
1553
  end
1534
- ENV['GEM_HOME'] = gem_home
1554
+ osdeps.osdeps_mode
1535
1555
 
1556
+ Autoproj.message "autoproj: bootstrapping using another installation's autoproj gem"
1557
+ ENV['GEM_HOME'] = gem_home
1558
+ ENV.delete('GEM_PATH')
1559
+ Autoproj.message "installing autoproj in #{ENV['GEM_HOME']} and restarting"
1560
+ osdeps.install ['autoproj']
1536
1561
  Autoproj.message "restarting bootstrapping from #{Dir.pwd}"
1537
1562
 
1538
1563
  require 'rbconfig'
1539
1564
  ruby = RbConfig::CONFIG['RUBY_INSTALL_NAME']
1540
- exec ruby, $0, *ARGV
1565
+ ENV['AUTOPROJ_OSDEPS_MODE'] = osdeps.osdeps_mode
1566
+ exec ruby, $0, 'bootstrap', *ARGV
1567
+ end
1568
+
1569
+ reuse = []
1570
+ parser = OptionParser.new do |opt|
1571
+ opt.on '--reuse DIR', 'reuse the given autoproj installation (can be given multiple times)' do |path|
1572
+ path = File.expand_path(path)
1573
+ if !File.directory?(path) || !File.directory?(File.join(path, 'autoproj'))
1574
+ raise ConfigError.new, "#{path} does not look like an autoproj installation"
1575
+ end
1576
+ reuse << path
1577
+ end
1541
1578
  end
1579
+ args = parser.parse(args)
1580
+ Autoproj.change_option 'reused_autoproj_installations', reuse, true
1542
1581
 
1543
1582
  # If we are not getting the installation setup from a VCS, copy the template
1544
1583
  # files
@@ -1547,6 +1586,16 @@ where 'mode' is one of:
1547
1586
  FileUtils.cp_r File.join(sample_dir, "autoproj"), "autoproj"
1548
1587
  end
1549
1588
 
1589
+ handle_ruby_version
1590
+
1591
+ Autobuild.env_set 'RUBYOPT', '-rubygems'
1592
+ Autobuild.env_set 'GEM_HOME', Autoproj.gem_home
1593
+ Autobuild.env_add_path 'PATH', File.join(Autoproj.gem_home, 'bin')
1594
+ Autobuild.env_inherit 'PATH'
1595
+ Autobuild.env_add_path 'GEM_PATH', Autoproj.gem_home
1596
+ Autobuild.env_inherit 'GEM_PATH'
1597
+ Autoproj.export_env_sh
1598
+
1550
1599
  if args.size == 1 # the user asks us to download a manifest
1551
1600
  manifest_url = args.first
1552
1601
  Autoproj.message("autoproj: downloading manifest file #{manifest_url}", :bold)
@@ -1555,7 +1604,7 @@ where 'mode' is one of:
1555
1604
  rescue
1556
1605
  # Delete the autoproj directory
1557
1606
  FileUtils.rm_rf 'autoproj'
1558
- raise ConfigError.new, "cannot read #{manifest_url}, did you mean 'autoproj bootstrap VCSTYPE #{manifest_url}' ?"
1607
+ raise ConfigError.new, "cannot read file / URL #{manifest_url}, did you mean 'autoproj bootstrap VCSTYPE #{manifest_url}' ?"
1559
1608
  end
1560
1609
 
1561
1610
  File.open(File.join(Autoproj.config_dir, "manifest"), "w") do |io|
@@ -1567,17 +1616,7 @@ where 'mode' is one of:
1567
1616
  url = VCSDefinition.to_absolute_url(url, Dir.pwd)
1568
1617
  do_switch_config(false, type, url, *options)
1569
1618
  end
1570
-
1571
- handle_ruby_version
1572
1619
  Autoproj.save_config
1573
-
1574
- Autobuild.env_set 'RUBYOPT', '-rubygems'
1575
- Autobuild.env_set 'GEM_HOME', Autoproj.gem_home
1576
- Autobuild.env_add_path 'PATH', File.join(Autoproj.gem_home, 'bin')
1577
- Autobuild.env_inherit 'PATH'
1578
- Autobuild.env_add_path 'GEM_PATH', Autoproj.gem_home
1579
- Autobuild.env_inherit 'GEM_PATH'
1580
- Autoproj.export_env_sh
1581
1620
  end
1582
1621
 
1583
1622
  def self.missing_dependencies(pkg)
@@ -1904,7 +1943,7 @@ where 'mode' is one of:
1904
1943
  STDERR.puts
1905
1944
  STDERR.puts color(e.message, :red, :bold)
1906
1945
  if Autoproj.in_autoproj_installation?(Dir.pwd)
1907
- root_dir = /^#{Regexp.quote(Autoproj.root_dir)}(?!\/\.gems)/
1946
+ root_dir = /#{Regexp.quote(Autoproj.root_dir)}(?!\/\.gems)/
1908
1947
  e.backtrace.find_all { |path| path =~ root_dir }.
1909
1948
  each do |path|
1910
1949
  STDERR.puts color(" in #{path}", :red, :bold)
@@ -944,10 +944,19 @@ module Autoproj
944
944
  attr_reader :name
945
945
  # The packages listed in this metapackage
946
946
  attr_reader :packages
947
+ # The normal dependency handling behaviour is to generate an error if a
948
+ # metapackage is selected for the build but some of its dependencies
949
+ # cannot be built. This modifies the behaviour to simply ignore the
950
+ # problematic packages.
951
+ attr_writer :weak_dependencies
952
+ def weak_dependencies?
953
+ !!@weak_dependencies
954
+ end
947
955
 
948
956
  def initialize(name)
949
957
  @name = name
950
958
  @packages = []
959
+ @weak_dependencies = false
951
960
  end
952
961
  # Adds a package to this metapackage
953
962
  def add(pkg)
@@ -1829,7 +1838,12 @@ module Autoproj
1829
1838
  Autoproj.in_file(self.file) do
1830
1839
  normalized_layout.each_key do |pkg_or_set|
1831
1840
  begin
1832
- result.select(pkg_or_set, resolve_package_set(pkg_or_set))
1841
+ weak = if meta = metapackages[pkg_or_set]
1842
+ meta.weak_dependencies?
1843
+ end
1844
+
1845
+
1846
+ result.select(pkg_or_set, resolve_package_set(pkg_or_set), weak)
1833
1847
  rescue UnknownPackage => e
1834
1848
  raise e, "#{e.name}, which is selected in the layout, is unknown: #{e.message}", e.backtrace
1835
1849
  end
@@ -1840,7 +1854,7 @@ module Autoproj
1840
1854
  result.filter_excluded_and_ignored_packages(self)
1841
1855
  rescue ExcludedSelection => e
1842
1856
  if validate
1843
- raise e, "#{e.sel}, which is selected in the layout, cannot be built: #{e.message}", e.backtrace
1857
+ raise
1844
1858
  end
1845
1859
  end
1846
1860
  result
@@ -1987,8 +2001,12 @@ module Autoproj
1987
2001
 
1988
2002
  manifest =
1989
2003
  if !manifest_path
1990
- Autoproj.warn "#{package.name} from #{package_set.name} does not have a manifest"
1991
- PackageManifest.new(package)
2004
+ if !pkg.autobuild.description
2005
+ Autoproj.warn "#{package.name} from #{package_set.name} does not have a manifest"
2006
+ PackageManifest.new(package)
2007
+ else
2008
+ pkg.autobuild.description
2009
+ end
1992
2010
  else
1993
2011
  PackageManifest.load(package, manifest_path)
1994
2012
  end
@@ -2129,6 +2147,28 @@ module Autoproj
2129
2147
  # set of user-provided strings that caused that package to be
2130
2148
  # selected
2131
2149
  attr_reader :selection
2150
+ # A flag that tells #filter_excluded_and_ignored_packages whether
2151
+ # the a given package selection is weak or not.
2152
+ #
2153
+ # If true, a selection that have some excluded packages will not
2154
+ # generate an error. Otherwise (the default), an error is generated
2155
+ attr_reader :weak_dependencies
2156
+ # After a call to #filter_excluded_and_ignored_packages, this
2157
+ # contains the set of package exclusions that have been ignored
2158
+ # because the corresponding metapackage has a weak dependency policy
2159
+ attr_reader :exclusions
2160
+ # After a call to #filter_excluded_and_ignored_packages, this
2161
+ # contains the set of package ignores that have been ignored because
2162
+ # the corresponding metapackage has a weak dependency policy
2163
+ attr_reader :ignores
2164
+
2165
+ def initialize
2166
+ @selection = Hash.new { |h, k| h[k] = Set.new }
2167
+ @matches = Hash.new { |h, k| h[k] = Set.new }
2168
+ @weak_dependencies = Hash.new
2169
+ @ignores = Hash.new { |h, k| h[k] = Set.new }
2170
+ @exclusions = Hash.new { |h, k| h[k] = Set.new }
2171
+ end
2132
2172
 
2133
2173
  # The set of packages that have been selected
2134
2174
  def packages
@@ -2143,25 +2183,17 @@ module Autoproj
2143
2183
  selection.empty?
2144
2184
  end
2145
2185
 
2146
- def initialize
2147
- @selection = Hash.new { |h, k| h[k] = Set.new }
2148
- @matches = Hash.new { |h, k| h[k] = Set.new }
2149
- end
2150
-
2151
2186
  def each(&block)
2152
2187
  selection.each_key(&block)
2153
2188
  end
2154
2189
 
2155
- def select(sel, packages)
2156
- if !packages.respond_to?(:each)
2157
- matches[sel] << packages
2158
- selection[packages] << sel
2159
- else
2160
- matches[sel] |= packages.to_set
2161
- packages.each do |pkg_name|
2162
- selection[pkg_name] << sel
2163
- end
2190
+ def select(sel, packages, weak = false)
2191
+ packages = Array(packages)
2192
+ matches[sel] |= packages.to_set.dup
2193
+ packages.each do |pkg_name|
2194
+ selection[pkg_name] << sel
2164
2195
  end
2196
+ weak_dependencies[sel] = weak
2165
2197
  end
2166
2198
 
2167
2199
  def initialize_copy(old)
@@ -2186,7 +2218,7 @@ module Autoproj
2186
2218
  excluded, other = expansion.partition { |pkg_name| manifest.excluded?(pkg_name) }
2187
2219
  ignored, ok = other.partition { |pkg_name| manifest.ignored?(pkg_name) }
2188
2220
 
2189
- if ok.empty? && ignored.empty?
2221
+ if !excluded.empty? && (!weak_dependencies[sel] || (ok.empty? && ignored.empty?))
2190
2222
  exclusions = excluded.map do |pkg_name|
2191
2223
  [pkg_name, manifest.exclusion_reason(pkg_name)]
2192
2224
  end
@@ -2194,16 +2226,19 @@ module Autoproj
2194
2226
  reason = exclusions[0][1]
2195
2227
  if sel == exclusions[0][0]
2196
2228
  raise ExcludedSelection.new(sel), "it is excluded from the build: #{reason}"
2197
- else
2229
+ elsif weak_dependencies[sel]
2198
2230
  raise ExcludedSelection.new(sel), "it expands to #{exclusions.map(&:first).join(", ")}, which is excluded from the build: #{reason}"
2231
+ else
2232
+ raise ExcludedSelection.new(sel), "it requires #{exclusions.map(&:first).join(", ")}, which is excluded from the build: #{reason}"
2199
2233
  end
2200
- else
2234
+ elsif weak_dependencies[sel]
2201
2235
  raise ExcludedSelection.new(sel), "it expands to #{exclusions.map(&:first).join(", ")}, and all these packages are excluded from the build:\n #{exclusions.map { |name, reason| "#{name}: #{reason}" }.join("\n ")}"
2236
+ else
2237
+ raise ExcludedSelection.new(sel), "it requires #{exclusions.map(&:first).join(", ")}, and all these packages are excluded from the build:\n #{exclusions.map { |name, reason| "#{name}: #{reason}" }.join("\n ")}"
2202
2238
  end
2203
- elsif !ignored.empty?
2204
- ignored.each do |pkg_name|
2205
- Autoproj.warn "#{pkg_name} was selected for #{sel}, but is explicitely ignored in the manifest"
2206
- end
2239
+ else
2240
+ self.exclusions[sel] |= excluded.to_set.dup
2241
+ self.ignores[sel] |= ignored.to_set.dup
2207
2242
  end
2208
2243
 
2209
2244
  excluded = excluded.to_set
@@ -2256,7 +2291,7 @@ module Autoproj
2256
2291
  if pkg.name =~ match_pkg_name
2257
2292
  packages = resolve_package_set(pkg.name).to_set
2258
2293
  packages = (packages & all_layout_packages)
2259
- result.select(sel, packages)
2294
+ result.select(sel, packages, pkg.weak_dependencies?)
2260
2295
  end
2261
2296
  end
2262
2297
  end
@@ -2339,10 +2374,13 @@ module Autoproj
2339
2374
  end
2340
2375
 
2341
2376
  manifest = InstallationManifest.new(dir)
2342
- manifest.load(File.join(dir, ".autoproj-installation-manifest"))
2377
+ manifest_file = File.join(dir, ".autoproj-installation-manifest")
2378
+ if !File.file?(manifest_file)
2379
+ raise ConfigError.new, "while setting up reuse of #{dir}, the .autoproj-installation-manifest file does not exist. You should probably rerun autoproj envsh in that folder first"
2380
+ end
2381
+ manifest.load(manifest_file)
2343
2382
  @reused_installations << manifest
2344
2383
  manifest.each do |pkg|
2345
- puts pkg.name
2346
2384
  ignore_package pkg.name
2347
2385
  end
2348
2386
  end
@@ -182,8 +182,8 @@ fi
182
182
  class PortManager < ShellScriptManager
183
183
  def initialize
184
184
  super(['port'], true,
185
- "port '%s'",
186
- "port '%s'")
185
+ "port install '%s'",
186
+ "port install '%s'")
187
187
  end
188
188
  end
189
189
 
@@ -404,13 +404,7 @@ fi
404
404
  if !installed.empty? && Autobuild.do_update
405
405
  # Look if we can update the package ...
406
406
  dep = Gem::Dependency.new(name, version_requirements)
407
- available =
408
- if gem_fetcher.respond_to?(:find_matching)
409
- gem_fetcher.find_matching(dep, true, true, GemManager.with_prerelease)
410
- else
411
- dep.prerelease = GemManager.with_prerelease
412
- gem_fetcher.search_for_dependency(dep).first
413
- end
407
+ available = gem_fetcher.find_matching(dep, true, true, GemManager.with_prerelease)
414
408
  installed_version = installed.map(&:version).max
415
409
  available_version = available.map { |(name, v), source| v }.max
416
410
  if !available_version
@@ -19,6 +19,14 @@ module Autoproj
19
19
  false
20
20
  end
21
21
 
22
+ # Forcefully sets the root directory
23
+ #
24
+ # This is mostly useful during bootstrapping (i.e. when the search would
25
+ # fail)
26
+ def self.root_dir=(dir)
27
+ @root_dir = dir
28
+ end
29
+
22
30
  # Returns the root directory of the current autoproj installation.
23
31
  #
24
32
  # If the current directory is not in an autoproj installation,
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.9.3.rc1"
2
+ VERSION = "1.9.3.rc2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.3.rc1
4
+ version: 1.9.3.rc2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-19 00:00:00.000000000 Z
12
+ date: 2013-03-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: autobuild