autoproj 1.9.7.rc9 → 1.9.7.rc10

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,7 +58,12 @@ shell/autoproj_zsh
58
58
  test/data/empty_manifest.xml
59
59
  test/data/full_manifest.xml
60
60
  test/data/invalid_manifest.xml
61
- test/data/test_manifest/autoproj/local/local.autobuild
61
+ test/data/os_release.with_complex_version_field
62
+ test/data/os_release.with_duplicate_values
63
+ test/data/os_release.with_missing_optional_fields
64
+ test/data/os_release.with_quoted_and_unquoted_fields
65
+ test/data/test_manifest/autoproj/local_set/local.autobuild
66
+ test/data/test_manifest/autoproj/local_set/source.yml
62
67
  test/data/test_manifest/autoproj/manifest
63
68
  test/package_managers/apt-dpkg-status
64
69
  test/package_managers/apt-dpkg-status.installed-last
@@ -66,7 +71,6 @@ test/package_managers/apt-dpkg-status.noninstalled-last
66
71
  test/package_managers/test_apt_dpkg_manager.rb
67
72
  test/package_managers/test_gem.rb
68
73
  test/package_managers/test_pip.rb
69
- test/test_debian.rb
70
74
  test/test_manifest.rb
71
75
  test/test_os_dependencies.rb
72
76
  test/test_package_manifest.rb
@@ -86,6 +86,14 @@ module Autobuild
86
86
  def self.message(str)
87
87
  STDERR.puts " #{str}"
88
88
  end
89
+ def self.progress(key, str)
90
+ STDERR.puts " #{str}"
91
+ end
92
+ def self.progress_done(key)
93
+ end
94
+ def self.message(str)
95
+ STDERR.puts " #{str}"
96
+ end
89
97
 
90
98
  class << self
91
99
  attr_reader :programs
@@ -471,15 +479,15 @@ fi
471
479
  # of GEM_PATH
472
480
  def self.initialize_environment
473
481
  Autobuild::ORIGINAL_ENV['GEM_PATH'] =
474
- (ENV['GEM_PATH'] || "").split(":").find_all do |p|
482
+ (ENV['GEM_PATH'] || "").split(File::PATH_SEPARATOR).find_all do |p|
475
483
  !Autoproj.in_autoproj_installation?(p)
476
- end.join(":")
484
+ end.join(File::PATH_SEPARATOR)
477
485
  Autobuild.env_inherit 'GEM_PATH'
478
486
  Autobuild.env_init_from_env 'GEM_PATH'
479
487
 
480
- orig_gem_path = Autobuild::ORIGINAL_ENV['GEM_PATH'].split(':')
488
+ orig_gem_path = Autobuild::ORIGINAL_ENV['GEM_PATH'].split(File::PATH_SEPARATOR)
481
489
  Autobuild::SYSTEM_ENV['GEM_PATH'] = Gem.default_path
482
- Autobuild::ORIGINAL_ENV['GEM_PATH'] = orig_gem_path.join(":")
490
+ Autobuild::ORIGINAL_ENV['GEM_PATH'] = orig_gem_path.join(File::PATH_SEPARATOR)
483
491
 
484
492
  Autoproj.manifest.each_reused_autoproj_installation do |p|
485
493
  p_gems = File.join(Autoproj.root_dir, '.gems')
@@ -668,7 +676,7 @@ fi
668
676
 
669
677
  #{cmdlines.map { |c| c.join(" ") }.join("\n ")}
670
678
 
671
- Autoproj expects these Gems to be installed in #{Autoproj.gem_home} This can
679
+ Autoproj expects these Gems to be installed in #{GemManager.gem_home} This can
672
680
  be overridden by setting the AUTOPROJ_GEM_HOME environment variable manually
673
681
 
674
682
  EOMSG
@@ -752,7 +760,7 @@ fi
752
760
 
753
761
  #{cmdlines.map { |c| c.join(" ") }.join("\n ")}
754
762
 
755
- Autoproj expects these Python packages to be installed in #{Autoproj.pip_home} This can
763
+ Autoproj expects these Python packages to be installed in #{PipManager.pip_home} This can
756
764
  be overridden by setting the AUTOPROJ_PYTHONUSERBASE environment variable manually
757
765
 
758
766
  EOMSG
@@ -1052,18 +1060,26 @@ fi
1052
1060
  end
1053
1061
  else
1054
1062
  Autobuild.progress :operating_system_autodetection, "autodetecting the operating system"
1055
- lsb_name, lsb_versions = os_from_lsb
1056
- if lsb_name
1057
- if lsb_name != 'debian' && File.exists?("/etc/debian_version")
1058
- @operating_system = [[lsb_name, "debian"], lsb_versions]
1059
- elsif lsb_name != 'arch' && File.exists?("/etc/arch-release")
1060
- @operating_system = [[lsb_name, "arch"], lsb_versions]
1061
- elsif lsb_name != 'opensuse' && File.exists?("/etc/SuSE-release")
1062
- @operating_system = [[lsb_name, "opensuse"], lsb_versions]
1063
- elsif lsb_name != 'debian'
1064
- # Debian unstable cannot be detected with lsb_release,
1065
- # so debian has its own detection logic
1066
- @operating_system = [[lsb_name], lsb_versions]
1063
+ names, versions = os_from_os_release
1064
+ # Don't use the os-release information on Debian, since they
1065
+ # refuse to put enough information to detect 'unstable'
1066
+ # reliably. So, we use Debian's heuristic detection method below
1067
+ if names && names[0] != 'debian'
1068
+ @operating_system = [names, versions]
1069
+ else
1070
+ lsb_name, lsb_versions = os_from_lsb
1071
+ if lsb_name
1072
+ if lsb_name != 'debian' && File.exists?("/etc/debian_version")
1073
+ @operating_system = [[lsb_name, "debian"], lsb_versions]
1074
+ elsif lsb_name != 'arch' && File.exists?("/etc/arch-release")
1075
+ @operating_system = [[lsb_name, "arch"], lsb_versions]
1076
+ elsif lsb_name != 'opensuse' && File.exists?("/etc/SuSE-release")
1077
+ @operating_system = [[lsb_name, "opensuse"], lsb_versions]
1078
+ elsif lsb_name != 'debian'
1079
+ # Debian unstable cannot be detected with lsb_release,
1080
+ # so debian has its own detection logic
1081
+ @operating_system = [[lsb_name], lsb_versions]
1082
+ end
1067
1083
  end
1068
1084
  end
1069
1085
  end
@@ -1125,13 +1141,28 @@ fi
1125
1141
  Autobuild.progress_done :operating_system_autodetection
1126
1142
  end
1127
1143
 
1144
+ def self.os_from_os_release(filename = '/etc/os-release')
1145
+ return if !File.exists?(filename)
1146
+
1147
+ fields = Hash.new
1148
+ File.readlines(filename).each do |line|
1149
+ if line.strip =~ /^(\w+)=(?:["'])?([^"']+)(?:["'])?$/
1150
+ fields[$1] = $2
1151
+ else Autoproj.warn "error parsing /etc/os-release, line: #{line.inspect}"
1152
+ end
1153
+ end
1154
+
1155
+ names = []
1156
+ versions = []
1157
+ names << fields['ID'] << fields['ID_LIKE']
1158
+ versions << fields['VERSION_ID']
1159
+ version = fields['VERSION'] || ''
1160
+ versions.concat(version.gsub(/[^\w.]/, ' ').split(' '))
1161
+ return names.compact.uniq, versions.compact.uniq
1162
+ end
1163
+
1128
1164
  def self.os_from_lsb
1129
- has_lsb_release = nil
1130
- begin
1131
- has_lsb_release = `which lsb_release`
1132
- return unless $?.success?
1133
- rescue Exception => e
1134
- #seems which is not installes (e.g. on windows)
1165
+ if !Autobuild.find_in_path('lsb_release')
1135
1166
  return
1136
1167
  end
1137
1168
 
@@ -2128,16 +2159,6 @@ module Autoproj
2128
2159
  Autobuild.env_inherit(*names)
2129
2160
  end
2130
2161
 
2131
- # Find the given program in PATH. It raises ArgumentError if the program
2132
- # can't be found
2133
- def self.find_in_path(name)
2134
- result = ENV['PATH'].split(':').find { |dir| File.file?(File.join(dir, name)) }
2135
- if !result
2136
- raise ArgumentError, "#{name} can not be found in PATH (#{ENV['PATH']})"
2137
- end
2138
- File.join(result, name)
2139
- end
2140
-
2141
2162
  # @deprecated use isolate_environment instead
2142
2163
  def self.set_initial_env
2143
2164
  isolate_environment
@@ -2293,12 +2314,21 @@ ruby19:
2293
2314
  - rake
2294
2315
  - rubygems-integration
2295
2316
  ubuntu:
2296
- - ruby1.9.1
2297
- - ruby1.9.1-dev
2298
- - rubygems1.9.1
2299
- - ri1.9.1
2300
- - libopenssl-ruby1.9.1
2301
- - rake
2317
+ '12.04':
2318
+ - ruby1.9.1
2319
+ - ruby1.9.1-dev
2320
+ - rubygems1.9.1
2321
+ - ri1.9.1
2322
+ - libopenssl-ruby1.9.1
2323
+ - rake
2324
+ default:
2325
+ - ruby1.9.1
2326
+ - ruby1.9.1-dev
2327
+ - rubygems1.9.1
2328
+ - ri1.9.1
2329
+ - libopenssl-ruby1.9.1
2330
+ - rake
2331
+ - rubygems-integration
2302
2332
  gentoo:
2303
2333
  - dev-lang/ruby:1.9
2304
2334
  - rake
@@ -86,6 +86,14 @@ module Autobuild
86
86
  def self.message(str)
87
87
  STDERR.puts " #{str}"
88
88
  end
89
+ def self.progress(key, str)
90
+ STDERR.puts " #{str}"
91
+ end
92
+ def self.progress_done(key)
93
+ end
94
+ def self.message(str)
95
+ STDERR.puts " #{str}"
96
+ end
89
97
 
90
98
  class << self
91
99
  attr_reader :programs
@@ -31,12 +31,21 @@ ruby19:
31
31
  - rubygems-integration
32
32
 
33
33
  ubuntu:
34
- - ruby1.9.1
35
- - ruby1.9.1-dev
36
- - rubygems1.9.1
37
- - ri1.9.1
38
- - libopenssl-ruby1.9.1
39
- - rake
34
+ '12.04':
35
+ - ruby1.9.1
36
+ - ruby1.9.1-dev
37
+ - rubygems1.9.1
38
+ - ri1.9.1
39
+ - libopenssl-ruby1.9.1
40
+ - rake
41
+ default:
42
+ - ruby1.9.1
43
+ - ruby1.9.1-dev
44
+ - rubygems1.9.1
45
+ - ri1.9.1
46
+ - libopenssl-ruby1.9.1
47
+ - rake
48
+ - rubygems-integration
40
49
  gentoo:
41
50
  - dev-lang/ruby:1.9
42
51
  - rake
@@ -2,7 +2,7 @@ module Autoproj
2
2
  # Sets an environment variable
3
3
  #
4
4
  # This sets (or resets) the environment variable +name+ to the given value.
5
- # If multiple values are given, they are joined with ':'
5
+ # If multiple values are given, they are joined with File::PATH_SEPARATOR
6
6
  #
7
7
  # The values can contain configuration parameters using the
8
8
  # $CONF_VARIABLE_NAME syntax.
@@ -14,7 +14,7 @@ module Autoproj
14
14
  # Adds new values to a given environment variable
15
15
  #
16
16
  # Adds the given value(s) to the environment variable named +name+. The
17
- # values are added using the ':' marker.
17
+ # values are added using the File::PATH_SEPARATOR marker
18
18
  #
19
19
  # The values can contain configuration parameters using the
20
20
  # $CONF_VARIABLE_NAME syntax.
@@ -27,8 +27,8 @@ module Autoproj
27
27
  # PATH, RUBYLIB, PYTHONPATH)
28
28
  #
29
29
  # This sets (or resets) the environment variable +name+ to the given value.
30
- # If multiple values are given, they are joined with ':'. Unlike env_set,
31
- # duplicate values will be removed.
30
+ # If multiple values are given, they are joined with File::PATH_SEPARATOR.
31
+ # Unlike env_set, duplicate values will be removed.
32
32
  #
33
33
  # The values can contain configuration parameters using the
34
34
  # $CONF_VARIABLE_NAME syntax.
@@ -41,7 +41,8 @@ module Autoproj
41
41
  # variable (such as PATH, RUBYLIB, PYTHONPATH)
42
42
  #
43
43
  # Adds the given value(s) to the environment variable named +name+. The
44
- # values are added using the ':' marker. Unlike env_set, duplicate values
44
+ # values are added using the File::PATH_SEPARATOR marker. Unlike env_set,
45
+ # duplicate values
45
46
  # will be removed.
46
47
  #
47
48
  # The values can contain configuration parameters using the
@@ -355,15 +355,15 @@ fi
355
355
  # of GEM_PATH
356
356
  def self.initialize_environment
357
357
  Autobuild::ORIGINAL_ENV['GEM_PATH'] =
358
- (ENV['GEM_PATH'] || "").split(":").find_all do |p|
358
+ (ENV['GEM_PATH'] || "").split(File::PATH_SEPARATOR).find_all do |p|
359
359
  !Autoproj.in_autoproj_installation?(p)
360
- end.join(":")
360
+ end.join(File::PATH_SEPARATOR)
361
361
  Autobuild.env_inherit 'GEM_PATH'
362
362
  Autobuild.env_init_from_env 'GEM_PATH'
363
363
 
364
- orig_gem_path = Autobuild::ORIGINAL_ENV['GEM_PATH'].split(':')
364
+ orig_gem_path = Autobuild::ORIGINAL_ENV['GEM_PATH'].split(File::PATH_SEPARATOR)
365
365
  Autobuild::SYSTEM_ENV['GEM_PATH'] = Gem.default_path
366
- Autobuild::ORIGINAL_ENV['GEM_PATH'] = orig_gem_path.join(":")
366
+ Autobuild::ORIGINAL_ENV['GEM_PATH'] = orig_gem_path.join(File::PATH_SEPARATOR)
367
367
 
368
368
  Autoproj.manifest.each_reused_autoproj_installation do |p|
369
369
  p_gems = File.join(Autoproj.root_dir, '.gems')
@@ -552,7 +552,7 @@ fi
552
552
 
553
553
  #{cmdlines.map { |c| c.join(" ") }.join("\n ")}
554
554
 
555
- Autoproj expects these Gems to be installed in #{Autoproj.gem_home} This can
555
+ Autoproj expects these Gems to be installed in #{GemManager.gem_home} This can
556
556
  be overridden by setting the AUTOPROJ_GEM_HOME environment variable manually
557
557
 
558
558
  EOMSG
@@ -636,7 +636,7 @@ fi
636
636
 
637
637
  #{cmdlines.map { |c| c.join(" ") }.join("\n ")}
638
638
 
639
- Autoproj expects these Python packages to be installed in #{Autoproj.pip_home} This can
639
+ Autoproj expects these Python packages to be installed in #{PipManager.pip_home} This can
640
640
  be overridden by setting the AUTOPROJ_PYTHONUSERBASE environment variable manually
641
641
 
642
642
  EOMSG
@@ -936,18 +936,26 @@ fi
936
936
  end
937
937
  else
938
938
  Autobuild.progress :operating_system_autodetection, "autodetecting the operating system"
939
- lsb_name, lsb_versions = os_from_lsb
940
- if lsb_name
941
- if lsb_name != 'debian' && File.exists?("/etc/debian_version")
942
- @operating_system = [[lsb_name, "debian"], lsb_versions]
943
- elsif lsb_name != 'arch' && File.exists?("/etc/arch-release")
944
- @operating_system = [[lsb_name, "arch"], lsb_versions]
945
- elsif lsb_name != 'opensuse' && File.exists?("/etc/SuSE-release")
946
- @operating_system = [[lsb_name, "opensuse"], lsb_versions]
947
- elsif lsb_name != 'debian'
948
- # Debian unstable cannot be detected with lsb_release,
949
- # so debian has its own detection logic
950
- @operating_system = [[lsb_name], lsb_versions]
939
+ names, versions = os_from_os_release
940
+ # Don't use the os-release information on Debian, since they
941
+ # refuse to put enough information to detect 'unstable'
942
+ # reliably. So, we use Debian's heuristic detection method below
943
+ if names && names[0] != 'debian'
944
+ @operating_system = [names, versions]
945
+ else
946
+ lsb_name, lsb_versions = os_from_lsb
947
+ if lsb_name
948
+ if lsb_name != 'debian' && File.exists?("/etc/debian_version")
949
+ @operating_system = [[lsb_name, "debian"], lsb_versions]
950
+ elsif lsb_name != 'arch' && File.exists?("/etc/arch-release")
951
+ @operating_system = [[lsb_name, "arch"], lsb_versions]
952
+ elsif lsb_name != 'opensuse' && File.exists?("/etc/SuSE-release")
953
+ @operating_system = [[lsb_name, "opensuse"], lsb_versions]
954
+ elsif lsb_name != 'debian'
955
+ # Debian unstable cannot be detected with lsb_release,
956
+ # so debian has its own detection logic
957
+ @operating_system = [[lsb_name], lsb_versions]
958
+ end
951
959
  end
952
960
  end
953
961
  end
@@ -1009,13 +1017,28 @@ fi
1009
1017
  Autobuild.progress_done :operating_system_autodetection
1010
1018
  end
1011
1019
 
1020
+ def self.os_from_os_release(filename = '/etc/os-release')
1021
+ return if !File.exists?(filename)
1022
+
1023
+ fields = Hash.new
1024
+ File.readlines(filename).each do |line|
1025
+ if line.strip =~ /^(\w+)=(?:["'])?([^"']+)(?:["'])?$/
1026
+ fields[$1] = $2
1027
+ else Autoproj.warn "error parsing /etc/os-release, line: #{line.inspect}"
1028
+ end
1029
+ end
1030
+
1031
+ names = []
1032
+ versions = []
1033
+ names << fields['ID'] << fields['ID_LIKE']
1034
+ versions << fields['VERSION_ID']
1035
+ version = fields['VERSION'] || ''
1036
+ versions.concat(version.gsub(/[^\w.]/, ' ').split(' '))
1037
+ return names.compact.uniq, versions.compact.uniq
1038
+ end
1039
+
1012
1040
  def self.os_from_lsb
1013
- has_lsb_release = nil
1014
- begin
1015
- has_lsb_release = `which lsb_release`
1016
- return unless $?.success?
1017
- rescue Exception => e
1018
- #seems which is not installes (e.g. on windows)
1041
+ if !Autobuild.find_in_path('lsb_release')
1019
1042
  return
1020
1043
  end
1021
1044
 
@@ -236,7 +236,7 @@ module Autoproj
236
236
  definition = @source_definition || raw_description_file
237
237
  @name = definition['name']
238
238
 
239
- if @name !~ /^[\w_\.-]+$/
239
+ if @name !~ /^[\w\.-]+$/
240
240
  raise ConfigError.new(source_file),
241
241
  "in #{source_file}: invalid source name '#{@name}': source names can only contain alphanumeric characters, and .-_"
242
242
  elsif @name == "local"
@@ -373,7 +373,7 @@ module Autoproj
373
373
  end
374
374
 
375
375
  name_match = name
376
- if name_match =~ /[^\w\/_-]/
376
+ if name_match =~ /[^\w\/-]/
377
377
  name_match = Regexp.new("^" + name_match)
378
378
  end
379
379
  if name_match === package_name
@@ -435,7 +435,7 @@ module Autoproj
435
435
  return enum_for(:each_package)
436
436
  end
437
437
 
438
- Autoproj.manifest.packages.each_value do |pkg|
438
+ manifest.packages.each_value do |pkg|
439
439
  if pkg.package_set.name == name
440
440
  yield(pkg.autobuild)
441
441
  end
@@ -121,16 +121,6 @@ module Autoproj
121
121
  Autobuild.env_inherit(*names)
122
122
  end
123
123
 
124
- # Find the given program in PATH. It raises ArgumentError if the program
125
- # can't be found
126
- def self.find_in_path(name)
127
- result = ENV['PATH'].split(':').find { |dir| File.file?(File.join(dir, name)) }
128
- if !result
129
- raise ArgumentError, "#{name} can not be found in PATH (#{ENV['PATH']})"
130
- end
131
- File.join(result, name)
132
- end
133
-
134
124
  # @deprecated use isolate_environment instead
135
125
  def self.set_initial_env
136
126
  isolate_environment
@@ -56,8 +56,6 @@ module Autoproj
56
56
  # - package_name
57
57
  # branch: value
58
58
  def self.vcs_definition_to_hash(spec)
59
- options = Hash.new
60
-
61
59
  plain = Array.new
62
60
  filtered_spec = Hash.new
63
61
  spec.each do |key, value|
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.9.7.rc9"
2
+ VERSION = "1.9.7.rc10"
3
3
  end
@@ -0,0 +1,3 @@
1
+ ID="name"
2
+ VERSION_ID="version_id"
3
+ VERSION="version, codename (codename_bis)"
@@ -0,0 +1,3 @@
1
+ ID="id"
2
+ VERSION="codename (version_id)"
3
+ VERSION_ID=version_id
@@ -0,0 +1,2 @@
1
+ ID='name'
2
+ VERSION_ID='version_id'
@@ -0,0 +1,2 @@
1
+ ID=name
2
+ VERSION_ID="version_id"
@@ -1,6 +1,5 @@
1
- sources:
2
- - ./local
3
- - git:remote1.git
1
+ package_sets:
2
+ - ./local_set
4
3
  - type: git
5
4
  url: remote2.git
6
5
  branch: next
@@ -87,6 +87,11 @@ class TC_OSDependencies_Gem < Test::Unit::TestCase
87
87
  assert_equal [], gem_manager.filter_uptodate_packages([['pkg0', '>= 0.9']])
88
88
  end
89
89
 
90
+ # Helper to have a shortcut for the default install options
91
+ def default_install_options
92
+ Autoproj::PackageManagers::GemManager.default_install_options
93
+ end
94
+
90
95
  def test_install_packages
91
96
  PackageManagers::GemManager.with_prerelease = false
92
97
  PackageManagers::GemManager.with_doc = false
@@ -94,11 +99,11 @@ class TC_OSDependencies_Gem < Test::Unit::TestCase
94
99
 
95
100
  packages = [['pkg0'], ['pkg1', '>= 0.5'], ['pkg2'], ['pkg3', '>= 0.9']]
96
101
  subprocess.should_receive(:run).
97
- with(any, any, 'mygem', 'install', '--no-rdoc', '--no-ri', 'pkg0', 'pkg2').once
102
+ with(any, any, any, any, 'mygem', 'install', *default_install_options, '--no-rdoc', '--no-ri', 'pkg0', 'pkg2').once
98
103
  subprocess.should_receive(:run).
99
- with(any, any, 'mygem', 'install', '--no-rdoc', '--no-ri', 'pkg1', '-v', '>= 0.5').once
104
+ with(any, any, any, any, 'mygem', 'install', *default_install_options, '--no-rdoc', '--no-ri', 'pkg1', '-v', '>= 0.5').once
100
105
  subprocess.should_receive(:run).
101
- with(any, any, 'mygem', 'install', '--no-rdoc', '--no-ri', 'pkg3', '-v', '>= 0.9').once
106
+ with(any, any, any, any, 'mygem', 'install', *default_install_options, '--no-rdoc', '--no-ri', 'pkg3', '-v', '>= 0.9').once
102
107
  gem_manager.install(packages)
103
108
  end
104
109
 
@@ -109,7 +114,7 @@ class TC_OSDependencies_Gem < Test::Unit::TestCase
109
114
 
110
115
  packages = [['pkg0']]
111
116
  subprocess.should_receive(:run).
112
- with(any, any, 'mygem', 'install', 'pkg0').once
117
+ with(any, any, any, any, 'mygem', 'install', *default_install_options, 'pkg0').once
113
118
  gem_manager.install([['pkg0']])
114
119
  end
115
120
 
@@ -119,7 +124,7 @@ class TC_OSDependencies_Gem < Test::Unit::TestCase
119
124
  subprocess = flexmock(Autobuild::Subprocess)
120
125
 
121
126
  subprocess.should_receive(:run).
122
- with(any, any, 'mygem', 'install', '--prerelease', 'pkg0').once
127
+ with(any, any, any, any, 'mygem', 'install', *default_install_options, '--prerelease', 'pkg0').once
123
128
  gem_manager.install([['pkg0']])
124
129
  end
125
130
 
@@ -8,30 +8,22 @@ class TC_Manifest < Test::Unit::TestCase
8
8
  DATA_DIR = File.expand_path('data', File.dirname(__FILE__))
9
9
  include Autoproj
10
10
 
11
- def test_each_sources
11
+ def test_each_package_set
12
12
  Dir.chdir(File.join(DATA_DIR, 'test_manifest', 'autoproj')) do
13
13
  manifest = Manifest.load(File.join(DATA_DIR, 'test_manifest', 'autoproj', 'manifest'))
14
- sources = manifest.each_source.to_set
14
+ sources = manifest.each_package_set(false).to_set
15
15
 
16
16
  test_data = "#{DATA_DIR}/test_manifest"
17
17
  test_data_name = test_data.gsub '/', '_'
18
18
 
19
- expected = [
20
- ["#{test_data_name}_autoproj_local", "local",
21
- "#{test_data}/autoproj/local",
22
- "#{test_data}/autoproj/local",
23
- {}],
24
- ["#{test_data_name}_remote1_git", "git",
25
- "#{test_data}/remote1.git",
26
- "#{test_data}/autoproj/remotes/_home_doudou_src_autoproj_test_data_test_manifest_remote1_git",
27
- {}],
28
- ["#{test_data_name}_remote2_git", "git",
29
- "#{test_data}/remote2.git",
30
- "#{test_data}/autoproj/remotes/_home_doudou_src_autoproj_test_data_test_manifest_remote2_git",
31
- {:branch=>"next"}]
32
- ]
33
-
34
- assert_equal(expected.to_set, sources)
19
+ local_set = sources.find { |pkg_set| pkg_set.name == 'local_set' }
20
+ assert local_set
21
+ assert_equal "#{test_data}/autoproj/local_set", local_set.raw_local_dir
22
+ assert local_set.local?
23
+
24
+ remote_set = sources.find { |pkg_set| pkg_set.name == "git:remote2.git branch=next"}
25
+ assert remote_set, "available package sets: #{sources.map(&:name)}"
26
+ assert_equal "#{test_data}/.remotes/git__home_doudou_dev_rock_master_tools_autoproj_test_data_test_manifest_remote2_git", remote_set.raw_local_dir
35
27
  end
36
28
  end
37
29
 
@@ -516,5 +516,37 @@ class TC_OSDependencies < Test::Unit::TestCase
516
516
  flexmock(OSDependencies).should_receive(:supported_operating_system?).and_return(false)
517
517
  assert_equal [[osdeps.os_package_handler, ['a_package']]], osdeps.resolve_os_dependencies(['a_package'])
518
518
  end
519
+
520
+ DATA_DIR = File.expand_path('data', File.dirname(__FILE__))
521
+ def test_os_from_os_release_returns_nil_if_the_os_release_file_is_not_found
522
+ assert !Autoproj::OSDependencies.os_from_os_release('does_not_exist')
523
+ end
524
+ def test_os_from_os_release_handles_quoted_and_unquoted_fields
525
+ names, versions = Autoproj::OSDependencies.os_from_os_release(
526
+ File.join(DATA_DIR, 'os_release.with_missing_optional_fields'))
527
+ assert_equal ['name'], names
528
+ assert_equal ['version_id'], versions
529
+ end
530
+ def test_os_from_os_release_handles_optional_fields
531
+ names, versions = Autoproj::OSDependencies.os_from_os_release(
532
+ File.join(DATA_DIR, 'os_release.with_missing_optional_fields'))
533
+ assert_equal ['name'], names
534
+ assert_equal ['version_id'], versions
535
+ end
536
+ def test_os_from_os_release_parses_the_version_field
537
+ _, versions = Autoproj::OSDependencies.os_from_os_release(
538
+ File.join(DATA_DIR, 'os_release.with_complex_version_field'))
539
+ assert_equal ['version_id', 'version', 'codename', 'codename_bis'], versions
540
+ end
541
+ def test_os_from_os_release_removes_duplicate_values
542
+ names, versions = Autoproj::OSDependencies.os_from_os_release(
543
+ File.join(DATA_DIR, 'os_release.with_duplicate_values'))
544
+ assert_equal ['id'], names
545
+ assert_equal ['version_id', 'codename'], versions
546
+ end
547
+ def test_os_from_lsb_returns_nil_if_lsb_release_is_not_found_in_path
548
+ flexmock(ENV).should_receive('[]').with('PATH').and_return('')
549
+ assert !Autoproj::OSDependencies.os_from_lsb
550
+ end
519
551
  end
520
552
 
@@ -59,7 +59,7 @@ class TC_PackageManifest < Test::Unit::TestCase
59
59
 
60
60
  def test_failure_on_wrong_document
61
61
  data = File.join(DATA_DIR, 'invalid_manifest.xml')
62
- assert_raises(Autoproj::ConfigError) { Autoproj::PackageManifest.load(pkg, data) }
62
+ assert_raises(Autobuild::PackageException) { Autoproj::PackageManifest.load(pkg, data) }
63
63
  end
64
64
  end
65
65
 
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.7.rc9
4
+ version: 1.9.7.rc10
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: 2014-05-22 00:00:00.000000000 Z
12
+ date: 2014-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: autobuild
@@ -183,7 +183,12 @@ files:
183
183
  - test/data/empty_manifest.xml
184
184
  - test/data/full_manifest.xml
185
185
  - test/data/invalid_manifest.xml
186
- - test/data/test_manifest/autoproj/local/local.autobuild
186
+ - test/data/os_release.with_complex_version_field
187
+ - test/data/os_release.with_duplicate_values
188
+ - test/data/os_release.with_missing_optional_fields
189
+ - test/data/os_release.with_quoted_and_unquoted_fields
190
+ - test/data/test_manifest/autoproj/local_set/local.autobuild
191
+ - test/data/test_manifest/autoproj/local_set/source.yml
187
192
  - test/data/test_manifest/autoproj/manifest
188
193
  - test/package_managers/apt-dpkg-status
189
194
  - test/package_managers/apt-dpkg-status.installed-last
@@ -191,7 +196,6 @@ files:
191
196
  - test/package_managers/test_apt_dpkg_manager.rb
192
197
  - test/package_managers/test_gem.rb
193
198
  - test/package_managers/test_pip.rb
194
- - test/test_debian.rb
195
199
  - test/test_manifest.rb
196
200
  - test/test_os_dependencies.rb
197
201
  - test/test_package_manifest.rb
@@ -225,7 +229,6 @@ specification_version: 3
225
229
  summary: Easy installation and management of sets of software packages
226
230
  test_files:
227
231
  - test/test_os_dependencies.rb
228
- - test/test_debian.rb
229
232
  - test/test_manifest.rb
230
233
  - test/package_managers/test_apt_dpkg_manager.rb
231
234
  - test/package_managers/test_gem.rb
@@ -1,16 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__))
2
- require 'test/unit'
3
- require 'autoproj/system'
4
-
5
- class TC_Debian < Test::Unit::TestCase
6
- def test_debian_detection
7
- assert Autoproj.on_debian?
8
- end
9
-
10
- def test_apt_version
11
- apt_version = Autoproj.apt_version
12
- version_string = apt_version.join(".")
13
- assert `apt-get -v` =~ /#{Regexp.quote(version_string)}/
14
- end
15
- end
16
-