autoproj 1.8.5 → 1.9.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -41,6 +41,11 @@ namespace 'dist' do
41
41
  end
42
42
  end
43
43
  osdeps_defaults = YAML.dump(osdeps)
44
+ # Since we are using gsub to replace the content in the bootstrap file,
45
+ # we have to quote all \
46
+ [osdeps_code, options_code, system_code, osdeps_defaults].each do |text|
47
+ text.gsub! /\\/, '\\\\\\\\'
48
+ end
44
49
 
45
50
  bootstrap_code = File.read(File.join(Dir.pwd, 'bin', 'autoproj_bootstrap.in')).
46
51
  gsub('OSDEPS_CODE', osdeps_code).
data/bin/autoproj CHANGED
@@ -74,8 +74,8 @@ report do
74
74
 
75
75
 
76
76
  #{color('autoproj bootstrap failed', :red, :bold)}
77
- To retry, first source the env.sh script with
78
- source #{Dir.pwd}/env.sh
77
+ To retry, first source the #{Autoproj::ENV_FILENAME} script with
78
+ source #{Dir.pwd}/#{Autoproj::ENV_FILENAME}
79
79
  and then re-run autoproj bootstrap with
80
80
  autoproj bootstrap <vcs_type> <vcs_url> <vcs_options>
81
81
 
@@ -99,11 +99,24 @@ EOTEXT
99
99
  end
100
100
  end
101
101
 
102
+ needs_update_config = false
103
+ selected_packages.delete_if do |name|
104
+ if name =~ /^#{Regexp.quote(Autoproj.config_dir + File::SEPARATOR)}/ ||
105
+ name =~ /^#{Regexp.quote(Autoproj.remotes_dir + File::SEPARATOR)}/
106
+ needs_update_config = true
107
+ end
108
+ end
109
+
102
110
  Dir.chdir(root_dir)
103
111
 
104
112
  # Basic initialization
105
113
  Autoproj::CmdLine.initialize
106
- if selected_packages.empty?
114
+ if needs_update_config
115
+ Autoproj::CmdLine.update_configuration
116
+ if selected_packages.empty?
117
+ exit 0
118
+ end
119
+ elsif selected_packages.empty?
107
120
  Autoproj::CmdLine.update_myself
108
121
  Autoproj::CmdLine.update_configuration
109
122
  else
@@ -143,6 +156,7 @@ EOTEXT
143
156
  Autoproj::CmdLine.finalize_package_setup
144
157
  # Finally, filter out exclusions
145
158
  resolved_selected_packages = Autoproj::CmdLine.resolve_user_selection(selected_packages)
159
+ Autoproj::CmdLine.validate_user_selection(selected_packages, resolved_selected_packages)
146
160
 
147
161
  if !selected_packages.empty?
148
162
  command_line_selection = resolved_selected_packages.dup
@@ -165,11 +179,11 @@ EOTEXT
165
179
 
166
180
  #{color('To further use autoproj and the installed software', :bold)}, you
167
181
  must add the following line at the bottom of your .bashrc:
168
- source #{Dir.pwd}/env.sh
182
+ source #{Dir.pwd}/#{Autoproj::ENV_FILENAME}
169
183
 
170
184
  WARNING: autoproj will not work until your restart all
171
185
  your consoles, or run the following in them:
172
- $ source #{Dir.pwd}/env.sh
186
+ $ source #{Dir.pwd}/#{Autoproj::ENV_FILENAME}
173
187
 
174
188
  #{color('To import and build the packages', :bold)}, you can now run
175
189
  autoproj update
@@ -264,7 +278,7 @@ EOTEXT
264
278
 
265
279
  if Autoproj::CmdLine.update_envsh?
266
280
  Autoproj.export_env_sh
267
- Autoproj.message "autoproj: updated #{Autoproj.root_dir}/env.sh", :green
281
+ Autoproj.message "autoproj: updated #{Autoproj.root_dir}/#{Autoproj::ENV_FILENAME}", :green
268
282
  end
269
283
 
270
284
  if Autoproj::CmdLine.show_statistics?
@@ -12,7 +12,8 @@ if !(new_set_path = File.expand_path(selection.shift, pwd))
12
12
  exit 1
13
13
  end
14
14
  new_set_name = File.basename(new_set_path)
15
- selection = Autoproj::CmdLine.resolve_user_selection(selection)
15
+ selection = Autoproj::CmdLine.resolve_user_selection(user_selection)
16
+ Autoproj::CmdLine.validate_user_selection(user_selection, selection)
16
17
 
17
18
  # Must re-load the package manifests, as the user selection might have triggered
18
19
  # some auto-add
data/bin/autoproj-inspect CHANGED
@@ -10,16 +10,17 @@ require 'pp'
10
10
  default_packages = Autoproj.manifest.default_packages
11
11
  revdeps = Autoproj.manifest.compute_revdeps
12
12
 
13
- selected_packages = ARGV.map do |arg|
13
+ user_selection = ARGV.map do |arg|
14
14
  if File.directory?(arg)
15
15
  File.expand_path(arg)
16
16
  else arg
17
17
  end
18
18
  end
19
- selected_packages = Autoproj::CmdLine.resolve_user_selection(selected_packages)
19
+ resolved_selection = Autoproj::CmdLine.resolve_user_selection(user_selection, :filter => false)
20
+ packages = resolved_selection.selection.keys
20
21
 
21
- selected_packages.selection.each_key do |name|
22
- result = Autoproj.manifest.resolve_package_name(name)
22
+ packages.each do |name|
23
+ result = Autoproj.manifest.resolve_package_name(name, :filter => false)
23
24
  packages, osdeps = result.partition { |type, name| type == :package }
24
25
  packages = packages.map(&:last)
25
26
  osdeps = osdeps.map(&:last)
@@ -28,15 +29,22 @@ selected_packages.selection.each_key do |name|
28
29
  puts "source package #{pkg_name}"
29
30
  if default_packages.include?(pkg_name)
30
31
  selection = default_packages.selection[pkg_name]
31
- selection.delete(pkg_name)
32
- if selection.empty?
32
+ if selection.include?(pkg_name) && selection.size == 1
33
33
  puts " is directly selected by the manifest"
34
34
  else
35
+ selection = selection.dup
36
+ selection.delete(pkg_name)
35
37
  puts " is directly selected by the manifest via #{selection.to_a.join(", ")}"
36
38
  end
37
39
  else
38
40
  puts " is not directly selected by the manifest"
39
41
  end
42
+ if Autoproj.manifest.ignored?(pkg_name)
43
+ puts " is ignored"
44
+ end
45
+ if Autoproj.manifest.excluded?(pkg_name)
46
+ puts " is excluded: #{Autoproj.manifest.exclusion_reason(pkg_name)}"
47
+ end
40
48
 
41
49
  all_reverse_dependencies = Set.new
42
50
  pkg_revdeps = revdeps[pkg_name].dup.to_a
@@ -46,6 +54,11 @@ selected_packages.selection.each_key do |name|
46
54
  all_reverse_dependencies << parent_name
47
55
  pkg_revdeps.concat(revdeps[parent_name].to_a)
48
56
  end
57
+ if pkg_revdeps.empty?
58
+ puts " no reverse dependencies"
59
+ else
60
+ puts " reverse dependencies: #{pkg_revdeps.map(&:name).sort.join(", ")}"
61
+ end
49
62
 
50
63
  selections = Set.new
51
64
  all_reverse_dependencies = all_reverse_dependencies.to_a.sort
@@ -57,6 +70,7 @@ selected_packages.selection.each_key do |name|
57
70
  if !selections.empty?
58
71
  puts " selected by way of #{selections.to_a.join(", ")}"
59
72
  end
73
+ puts " directly depends on: #{Autobuild::Package[pkg_name].dependencies.sort.join(", ")}"
60
74
  end
61
75
 
62
76
  osdeps.each do |pkg_name|
@@ -128,12 +128,17 @@ module Autoproj
128
128
  # Dummy package manager used for unknown OSes. It simply displays a
129
129
  # message to the user when packages are needed
130
130
  class UnknownOSManager < Manager
131
+ def initialize
132
+ super(['unknown'])
133
+ @installed_osdeps = Set.new
134
+ end
135
+
131
136
  def osdeps_interaction_unknown_os(osdeps)
132
137
  puts <<-EOMSG
133
- #{Autoproj.color("The build process requires some other software packages to be installed on our operating system", :bold)}
134
- #{Autoproj.color("If they are already installed, simply ignore this message", :red)}
138
+ #{Autoproj.color("The build process requires some other software packages to be installed on our operating system", :bold)}
139
+ #{Autoproj.color("If they are already installed, simply ignore this message", :red)}
135
140
 
136
- #{osdeps.join("\n ")}
141
+ #{osdeps.to_a.sort.join("\n ")}
137
142
 
138
143
  EOMSG
139
144
  print Autoproj.color("Press ENTER to continue", :bold)
@@ -143,12 +148,17 @@ module Autoproj
143
148
  nil
144
149
  end
145
150
 
146
-
147
151
  def install(osdeps)
148
152
  if silent?
149
153
  return false
150
154
  else
151
- return osdeps_interaction_unknown_os(osdeps)
155
+ osdeps = osdeps.to_set
156
+ osdeps -= @installed_osdeps
157
+ if !osdeps.empty?
158
+ result = osdeps_interaction_unknown_os(osdeps)
159
+ end
160
+ @installed_osdeps |= osdeps
161
+ return result
152
162
  end
153
163
  end
154
164
  end
@@ -266,6 +276,16 @@ fi
266
276
  end
267
277
  end
268
278
 
279
+ # Package manager interface for systems that use port (i.e. MacPorts/Darwin) as
280
+ # their package manager
281
+ class PortManager < ShellScriptManager
282
+ def initialize
283
+ super(['port'], true,
284
+ "port '%s'",
285
+ "port '%s'")
286
+ end
287
+ end
288
+
269
289
  # Package manager interface for systems that use pacman (i.e. arch) as
270
290
  # their package manager
271
291
  class PacmanManager < ShellScriptManager
@@ -629,12 +649,14 @@ fi
629
649
  PackageManagers::GemManager,
630
650
  PackageManagers::EmergeManager,
631
651
  PackageManagers::PacmanManager,
632
- PackageManagers::YumManager]
652
+ PackageManagers::YumManager,
653
+ PackageManagers::PortManager]
633
654
  OS_PACKAGE_HANDLERS = {
634
655
  'debian' => 'apt-dpkg',
635
656
  'gentoo' => 'emerge',
636
657
  'arch' => 'pacman',
637
- 'fedora' => 'yum'
658
+ 'fedora' => 'yum',
659
+ 'darwin' => 'port'
638
660
  }
639
661
 
640
662
  # The information contained in the OSdeps files, as a hash
@@ -852,6 +874,11 @@ fi
852
874
  [['gentoo'], [version]]
853
875
  elsif File.exists?('/etc/arch-release')
854
876
  [['arch'], []]
877
+ elsif Autobuild.macos?
878
+ version=`sw_vers | head -2 | tail -1`.split(":")[1]
879
+ [['darwin'], [version.strip]]
880
+ elsif Autobuild.windows?
881
+ [['windows'], []]
855
882
  end
856
883
  end
857
884
 
@@ -873,8 +900,14 @@ fi
873
900
  end
874
901
 
875
902
  def self.os_from_lsb
876
- has_lsb_release = `which lsb_release`
877
- return unless $?.success?
903
+ has_lsb_release = nil
904
+ begin
905
+ has_lsb_release = `which lsb_release`
906
+ return unless $?.success?
907
+ rescue Exception => e
908
+ #seems which is not installes (e.g. on windows)
909
+ return
910
+ end
878
911
 
879
912
  distributor = `lsb_release -i -s`
880
913
  distributor = distributor.strip.downcase
@@ -940,6 +973,14 @@ fi
940
973
  end
941
974
  end
942
975
 
976
+ # Recursive resolutions
977
+ found, pkg = partition_osdep_entry(name, dep_def, ['osdep'], [], os_names, os_versions)
978
+ if found
979
+ pkg.each do |pkg_name|
980
+ result.concat(resolve_package(pkg_name))
981
+ end
982
+ end
983
+
943
984
  result.map do |handler, status, entries|
944
985
  if handler.respond_to?(:parse_package_entry)
945
986
  [handler, status, entries.map { |s| handler.parse_package_entry(s) }]
@@ -1108,19 +1149,24 @@ fi
1108
1149
  result = resolve_package(name)
1109
1150
  if !result
1110
1151
  raise MissingOSDep.new, "there is no osdeps definition for #{name}"
1111
- elsif result.empty?
1112
- os_names, os_versions = OSDependencies.operating_system
1113
- raise MissingOSDep.new, "there is an osdeps definition for #{name}, but not for this operating system and version (resp. #{os_names.join(", ")} and #{os_versions.join(", ")})"
1114
- else
1115
- result.each do |handler, status, packages|
1116
- if status == FOUND_NONEXISTENT
1117
- raise MissingOSDep.new, "there is an osdep definition for #{name}, and it explicitely states that this package does not exist on your OS"
1118
- end
1119
- if entry = all_packages.find { |h, _| h == handler }
1120
- entry[1].concat(packages)
1121
- else
1122
- all_packages << [handler, packages]
1123
- end
1152
+ end
1153
+
1154
+ if result.empty?
1155
+ if OSDependencies.supported_operating_system?
1156
+ os_names, os_versions = OSDependencies.operating_system
1157
+ raise MissingOSDep.new, "there is an osdeps definition for #{name}, but not for this operating system and version (resp. #{os_names.join(", ")} and #{os_versions.join(", ")})"
1158
+ end
1159
+ result = [[os_package_handler, FOUND_PACKAGES, [name]]]
1160
+ end
1161
+
1162
+ result.each do |handler, status, packages|
1163
+ if status == FOUND_NONEXISTENT
1164
+ raise MissingOSDep.new, "there is an osdep definition for #{name}, and it explicitely states that this package does not exist on your OS"
1165
+ end
1166
+ if entry = all_packages.find { |h, _| h == handler }
1167
+ entry[1].concat(packages)
1168
+ else
1169
+ all_packages << [handler, packages]
1124
1170
  end
1125
1171
  end
1126
1172
  end
@@ -1178,8 +1224,9 @@ fi
1178
1224
  if resolved.empty?
1179
1225
  if !OSDependencies.operating_system
1180
1226
  return UNKNOWN_OS
1181
- else
1182
- return WRONG_OS
1227
+ elsif !OSDependencies.supported_operating_system?
1228
+ return AVAILABLE
1229
+ else return WRONG_OS
1183
1230
  end
1184
1231
  end
1185
1232
 
@@ -1291,7 +1338,7 @@ So, what do you want ? (all, ruby, os or none)
1291
1338
  end
1292
1339
 
1293
1340
  def self.osdeps_mode_string_to_value(string)
1294
- string = string.downcase
1341
+ string = string.to_s.downcase
1295
1342
  case string
1296
1343
  when 'all' then HANDLE_ALL
1297
1344
  when 'ruby' then HANDLE_RUBY
@@ -1377,7 +1424,14 @@ So, what do you want ? (all, ruby, os or none)
1377
1424
 
1378
1425
  # Requests the installation of the given set of packages
1379
1426
  def install(packages, package_osdeps = Hash.new)
1427
+ #not sure here, simply show that it is installed even we dont install anything,
1428
+ #because this functions seems to called sometimes even --no-osdeps is given or the installs_os_packages? return false
1429
+ #it seems its not checked everywhere, so add this sainty check here
1430
+ return true if not installs_os_packages?
1431
+
1432
+
1380
1433
  os_package_handler.enabled = installs_os_packages?
1434
+ os_package_handler.silent = self.silent?
1381
1435
  package_handlers['gem'].enabled = installs_ruby_packages?
1382
1436
  package_handlers.each_value do |v|
1383
1437
  v.silent = self.silent?
@@ -1613,6 +1667,16 @@ end
1613
1667
  module Autoproj
1614
1668
  class UserError < RuntimeError; end
1615
1669
 
1670
+ # OS-independent creation of symbolic links. Note that on windows, it only
1671
+ # works for directories
1672
+ def create_symlink(from, to)
1673
+ if Autobuild.windows?
1674
+ Dir.create_junction(to, from)
1675
+ else
1676
+ FileUtils.ln_sf from, to
1677
+ end
1678
+ end
1679
+
1616
1680
  # Returns true if +path+ is part of an autoproj installation
1617
1681
  def self.in_autoproj_installation?(path)
1618
1682
  root_dir(File.expand_path(path))
@@ -1630,12 +1694,22 @@ module Autoproj
1630
1694
  return @root_dir
1631
1695
  end
1632
1696
 
1633
- while dir != "/" && !File.directory?(File.join(dir, "autoproj"))
1697
+ root_dir_rx =
1698
+ if Autobuild.windows? then /^[a-zA-Z]:\\\\$/
1699
+ else /^\/$/
1700
+ end
1701
+
1702
+ while root_dir_rx !~ dir && !File.directory?(File.join(dir, "autoproj"))
1634
1703
  dir = File.dirname(dir)
1635
1704
  end
1636
- if dir == "/"
1705
+ if root_dir_rx =~ dir
1637
1706
  raise UserError, "not in a Autoproj installation"
1638
1707
  end
1708
+
1709
+ #Preventing backslashed in path, that might be confusing on some path compares
1710
+ if Autobuild.windows?
1711
+ dir = dir.gsub(/\\/,'/')
1712
+ end
1639
1713
  dir
1640
1714
  end
1641
1715
 
@@ -1705,12 +1779,16 @@ module Autoproj
1705
1779
  ENV['AUTOPROJ_GEM_HOME'] || File.join(root_dir, ".gems")
1706
1780
  end
1707
1781
 
1782
+ def self.env_inherit(*names)
1783
+ Autobuild.env_inherit(*names)
1784
+ end
1785
+
1708
1786
  # Find the given program in PATH. It raises ArgumentError if the program
1709
1787
  # can't be found
1710
1788
  def self.find_in_path(name)
1711
1789
  result = ENV['PATH'].split(':').find { |dir| File.file?(File.join(dir, name)) }
1712
1790
  if !result
1713
- raise ArgumentError, "#{name} can not be found in PATH"
1791
+ raise ArgumentError, "#{name} can not be found in PATH (#{ENV['PATH']})"
1714
1792
  end
1715
1793
  File.join(result, name)
1716
1794
  end
@@ -1720,13 +1798,10 @@ module Autoproj
1720
1798
  # Use this in autoproj/init.rb to make sure that the environment will not
1721
1799
  # get polluted during the build.
1722
1800
  def self.set_initial_env
1801
+ Autobuild.env_inherit = false
1723
1802
  Autoproj.env_set 'RUBYOPT', "-rubygems"
1724
- Autoproj.env_set 'GEM_HOME', Autoproj.gem_home
1725
- Autoproj.env_add_path 'GEM_PATH', Autoproj.gem_home
1726
- Autoproj.env_set_path 'PATH', "#{Autoproj.gem_home}/bin", "/usr/local/bin", "/usr/bin", "/bin"
1727
- Autoproj.env_set 'PKG_CONFIG_PATH'
1728
- Autoproj.env_set 'RUBYLIB'
1729
- Autoproj.env_set 'LD_LIBRARY_PATH'
1803
+ Autobuild.env_push_path 'GEM_PATH', Autoproj.gem_home
1804
+ Autobuild.env_push_path 'PATH', "#{Autoproj.gem_home}/bin", "/usr/local/bin", "/usr/bin", "/bin"
1730
1805
  end
1731
1806
 
1732
1807
  class << self
@@ -1743,10 +1818,10 @@ module Autoproj
1743
1818
  end
1744
1819
 
1745
1820
  filename = if subdir
1746
- File.join(Autoproj.root_dir, subdir, "env.sh")
1747
- else
1748
- File.join(Autoproj.root_dir, "env.sh")
1749
- end
1821
+ File.join(Autoproj.root_dir, subdir, ENV_FILENAME)
1822
+ else
1823
+ File.join(Autoproj.root_dir, ENV_FILENAME)
1824
+ end
1750
1825
 
1751
1826
  shell_dir = File.expand_path(File.join("..", "..", "shell"), File.dirname(__FILE__))
1752
1827
  if Autoproj.shell_helpers? && shell = ENV['SHELL']
@@ -1839,7 +1914,10 @@ ruby18:
1839
1914
  '15,16':
1840
1915
  - ruby
1841
1916
  - rubygems
1842
- default: nonexistent
1917
+ darwin:
1918
+ - ruby
1919
+ - rb-rake
1920
+ default: nonexistent
1843
1921
  ruby19:
1844
1922
  debian:
1845
1923
  - ruby1.9.1
@@ -1864,12 +1942,16 @@ ruby19:
1864
1942
  '17':
1865
1943
  - ruby
1866
1944
  - rubygems
1867
- default: nonexistent
1945
+ darwin:
1946
+ - ruby19
1947
+ - rake
1948
+ default: nonexistent
1868
1949
  build-essential:
1869
1950
  debian,ubuntu: build-essential
1870
1951
  gentoo: ignore
1871
1952
  arch: ignore
1872
1953
  fedora: ignore
1954
+ darwin: ignore
1873
1955
  autobuild: gem
1874
1956
  autoproj: gem
1875
1957
  git:
@@ -1880,16 +1962,19 @@ git:
1880
1962
  gentoo: dev-vcs/git
1881
1963
  arch: git
1882
1964
  fedora: git
1965
+ darwin: git-core
1883
1966
  svn:
1884
1967
  debian,ubuntu: subversion
1885
1968
  gentoo: dev-util/subversion
1886
1969
  arch: subversion
1887
1970
  fedora: subversion
1971
+ darwin: subversion
1888
1972
  cmake:
1889
1973
  debian,ubuntu: cmake
1890
1974
  gentoo: dev-util/cmake
1891
1975
  arch: cmake
1892
1976
  fedora: cmake
1977
+ darwin: cmake
1893
1978
  autotools:
1894
1979
  debian,ubuntu:
1895
1980
  - automake1.9
@@ -1901,11 +1986,15 @@ autotools:
1901
1986
  fedora:
1902
1987
  - automake
1903
1988
  - autoconf
1989
+ darwin:
1990
+ - automake
1991
+ - autoconf
1904
1992
  lsb_release:
1905
1993
  debian,ubuntu: lsb-release
1906
1994
  gentoo: sys-apps/lsb-release
1907
1995
  arch: ignore
1908
1996
  fedora: redhat-lsb
1997
+ darwin: ignore
1909
1998
  archive:
1910
1999
  debian,ubuntu:
1911
2000
  - tar
@@ -1919,9 +2008,13 @@ archive:
1919
2008
  fedora:
1920
2009
  - tar
1921
2010
  - unzip
2011
+ darwin:
2012
+ - gnutar
2013
+ - unzip
1922
2014
  cvs:
1923
2015
  debian,ubuntu: cvs
1924
2016
  fedora: cvs
2017
+ darwin: cvs
1925
2018
 
1926
2019
  EODEFS
1927
2020
 
@@ -1970,6 +2063,7 @@ end
1970
2063
  File.open('env.sh', 'w') do |io|
1971
2064
  io.write <<-EOSHELL
1972
2065
  export RUBYOPT=-rubygems
2066
+ export GEM_PATH=#{needed_gem_home}:$GEM_PATH
1973
2067
  export GEM_HOME=#{needed_gem_home}
1974
2068
  export PATH=$GEM_HOME/bin:$PATH
1975
2069
  EOSHELL