autoproj 1.9.7.rc10 → 1.9.7.rc11
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/autoproj_bootstrap +104 -121
- data/bin/autoproj_bootstrap.in +4 -5
- data/lib/autoproj/default.osdeps +8 -30
- data/lib/autoproj/osdeps.rb +89 -88
- data/lib/autoproj/version.rb +1 -1
- metadata +1 -1
data/bin/autoproj_bootstrap
CHANGED
@@ -1013,6 +1013,68 @@ fi
|
|
1013
1013
|
@operating_system = values
|
1014
1014
|
end
|
1015
1015
|
|
1016
|
+
def self.guess_operating_system
|
1017
|
+
if File.exists?('/etc/debian_version')
|
1018
|
+
versions = [File.read('/etc/debian_version').strip]
|
1019
|
+
if versions.first =~ /sid/
|
1020
|
+
versions = ["unstable", "sid"]
|
1021
|
+
end
|
1022
|
+
[['debian'], versions]
|
1023
|
+
elsif File.exists?('/etc/redhat-release')
|
1024
|
+
release_string = File.read('/etc/redhat-release').strip
|
1025
|
+
release_string =~ /(.*) release ([\d.]+)/
|
1026
|
+
name = $1.downcase
|
1027
|
+
version = $2
|
1028
|
+
if name =~ /Red Hat Entreprise/
|
1029
|
+
name = 'rhel'
|
1030
|
+
end
|
1031
|
+
[[name], [version]]
|
1032
|
+
elsif File.exists?('/etc/gentoo-release')
|
1033
|
+
release_string = File.read('/etc/gentoo-release').strip
|
1034
|
+
release_string =~ /^.*([^\s]+)$/
|
1035
|
+
version = $1
|
1036
|
+
[['gentoo'], [version]]
|
1037
|
+
elsif File.exists?('/etc/arch-release')
|
1038
|
+
[['arch'], []]
|
1039
|
+
elsif Autobuild.macos?
|
1040
|
+
version=`sw_vers | head -2 | tail -1`.split(":")[1]
|
1041
|
+
[['darwin'], [version.strip]]
|
1042
|
+
elsif Autobuild.windows?
|
1043
|
+
[['windows'], []]
|
1044
|
+
elsif File.exists?('/etc/SuSE-release')
|
1045
|
+
version = File.read('/etc/SuSE-release').strip
|
1046
|
+
version =~/.*VERSION\s+=\s+([^\s]+)/
|
1047
|
+
version = $1
|
1048
|
+
[['opensuse'], [version.strip]]
|
1049
|
+
end
|
1050
|
+
end
|
1051
|
+
|
1052
|
+
def self.ensure_derivatives_refer_to_their_parents(names)
|
1053
|
+
names = names.dup
|
1054
|
+
version_files = Hash[
|
1055
|
+
'/etc/debian_version' => 'debian',
|
1056
|
+
'/etc/redhat-release' => 'fedora',
|
1057
|
+
'/etc/gentoo-release' => 'gentoo',
|
1058
|
+
'/etc/arch-release' => 'arch',
|
1059
|
+
'/etc/SuSE-release' => 'opensuse']
|
1060
|
+
version_files.each do |file, name|
|
1061
|
+
if File.exists?(file) && !names.include?(name)
|
1062
|
+
names << name
|
1063
|
+
end
|
1064
|
+
end
|
1065
|
+
names
|
1066
|
+
end
|
1067
|
+
|
1068
|
+
def self.normalize_os_representation(names, versions)
|
1069
|
+
# Normalize the names to lowercase
|
1070
|
+
names = names.map(&:downcase)
|
1071
|
+
versions = versions.map(&:downcase)
|
1072
|
+
if !versions.include?('default')
|
1073
|
+
versions += ['default']
|
1074
|
+
end
|
1075
|
+
return names, versions
|
1076
|
+
end
|
1077
|
+
|
1016
1078
|
# Autodetects the operating system name and version
|
1017
1079
|
#
|
1018
1080
|
# +osname+ is the operating system name, all in lowercase (e.g. ubuntu,
|
@@ -1036,102 +1098,41 @@ fi
|
|
1036
1098
|
|
1037
1099
|
if options[:force]
|
1038
1100
|
@operating_system = nil
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
@operating_system = os
|
1048
|
-
return os
|
1049
|
-
end
|
1101
|
+
elsif !@operating_system.nil? # @operating_system can be set to false to simulate an unknown OS
|
1102
|
+
return @operating_system
|
1103
|
+
elsif user_os = ENV['AUTOPROJ_OS']
|
1104
|
+
@operating_system =
|
1105
|
+
if user_os.empty? then false
|
1106
|
+
else
|
1107
|
+
names, versions = user_os.split(':')
|
1108
|
+
normalize_os_representation(names.split(','), versions.split(','))
|
1050
1109
|
end
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
@operating_system = [names.split(','), versions.split(',')]
|
1060
|
-
end
|
1061
|
-
else
|
1062
|
-
Autobuild.progress :operating_system_autodetection, "autodetecting the operating system"
|
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
|
1110
|
+
return @operating_system
|
1111
|
+
elsif Autoproj.has_config_key?('operating_system')
|
1112
|
+
os = Autoproj.user_config('operating_system')
|
1113
|
+
if os.respond_to?(:to_ary)
|
1114
|
+
if os[0].respond_to?(:to_ary) && os[0].all? { |s| s.respond_to?(:to_str) } &&
|
1115
|
+
os[1].respond_to?(:to_ary) && os[1].all? { |s| s.respond_to?(:to_str) }
|
1116
|
+
@operating_system = os
|
1117
|
+
return os
|
1083
1118
|
end
|
1084
1119
|
end
|
1120
|
+
@operating_system = nil # Invalid OS format in the configuration file
|
1085
1121
|
end
|
1086
1122
|
|
1087
|
-
|
1088
|
-
|
1089
|
-
@operating_system =
|
1090
|
-
if File.exists?('/etc/debian_version')
|
1091
|
-
versions = [File.read('/etc/debian_version').strip]
|
1092
|
-
if versions.first =~ /sid/
|
1093
|
-
versions = ["unstable", "sid"]
|
1094
|
-
end
|
1095
|
-
if lsb_versions
|
1096
|
-
lsb_versions.each { |v| versions << v if !versions.include?(v) }
|
1097
|
-
end
|
1098
|
-
[['debian'], versions]
|
1099
|
-
elsif File.exists?('/etc/fedora-release')
|
1100
|
-
release_string = File.read('/etc/fedora-release').strip
|
1101
|
-
release_string =~ /Fedora release (\d+)/
|
1102
|
-
version = $1
|
1103
|
-
[['fedora'], [version]]
|
1104
|
-
elsif File.exists?('/etc/gentoo-release')
|
1105
|
-
release_string = File.read('/etc/gentoo-release').strip
|
1106
|
-
release_string =~ /^.*([^\s]+)$/
|
1107
|
-
version = $1
|
1108
|
-
[['gentoo'], [version]]
|
1109
|
-
elsif File.exists?('/etc/arch-release')
|
1110
|
-
[['arch'], []]
|
1111
|
-
elsif Autobuild.macos?
|
1112
|
-
version=`sw_vers | head -2 | tail -1`.split(":")[1]
|
1113
|
-
[['darwin'], [version.strip]]
|
1114
|
-
elsif Autobuild.windows?
|
1115
|
-
[['windows'], []]
|
1116
|
-
elsif File.exists?('/etc/SuSE-release')
|
1117
|
-
version = File.read('/etc/SuSE-release').strip
|
1118
|
-
version =~/.*VERSION\s+=\s+([^\s]+)/
|
1119
|
-
version = $1
|
1120
|
-
[['opensuse'], [version.strip]]
|
1121
|
-
end
|
1122
|
-
end
|
1123
|
+
Autobuild.progress :operating_system_autodetection, "autodetecting the operating system"
|
1124
|
+
names, versions = os_from_os_release
|
1123
1125
|
|
1124
|
-
|
1125
|
-
|
1126
|
+
# Don't use the os-release information on Debian, since they
|
1127
|
+
# refuse to put enough information to detect 'unstable'
|
1128
|
+
# reliably. So, we use the heuristic method for it
|
1129
|
+
if !names || names[0] == 'debian'
|
1130
|
+
names, versions = guess_operating_system
|
1126
1131
|
end
|
1132
|
+
return if !names
|
1127
1133
|
|
1128
|
-
|
1129
|
-
names, versions =
|
1130
|
-
names = names.map(&:downcase)
|
1131
|
-
versions = versions.map(&:downcase)
|
1132
|
-
if !versions.include?('default')
|
1133
|
-
versions += ['default']
|
1134
|
-
end
|
1134
|
+
names = ensure_derivatives_refer_to_their_parents(names)
|
1135
|
+
names, versions = normalize_os_representation(names, versions)
|
1135
1136
|
|
1136
1137
|
@operating_system = [names, versions]
|
1137
1138
|
Autoproj.change_option('operating_system', @operating_system, true)
|
@@ -2286,26 +2287,6 @@ end
|
|
2286
2287
|
DEFS = <<EODEFS
|
2287
2288
|
---
|
2288
2289
|
none: ignore
|
2289
|
-
ruby18:
|
2290
|
-
debian,ubuntu:
|
2291
|
-
- ruby1.8-dev
|
2292
|
-
- ruby1.8
|
2293
|
-
- rubygems1.8
|
2294
|
-
- ri1.8
|
2295
|
-
- libopenssl-ruby1.8
|
2296
|
-
- rake
|
2297
|
-
gentoo:
|
2298
|
-
- dev-lang/ruby:1.8
|
2299
|
-
- rake
|
2300
|
-
fedora:
|
2301
|
-
'15,16':
|
2302
|
-
- ruby
|
2303
|
-
- rubygems
|
2304
|
-
darwin:
|
2305
|
-
- ruby
|
2306
|
-
- rb-rake
|
2307
|
-
default: nonexistent
|
2308
|
-
arch: ignore
|
2309
2290
|
ruby19:
|
2310
2291
|
debian:
|
2311
2292
|
- ruby1.9.1
|
@@ -2348,6 +2329,11 @@ ruby20:
|
|
2348
2329
|
- ruby2.0-dev
|
2349
2330
|
- rake
|
2350
2331
|
- rubygems-integration
|
2332
|
+
fedora:
|
2333
|
+
'20':
|
2334
|
+
- ruby
|
2335
|
+
- ruby-devel
|
2336
|
+
- rubygem-rake
|
2351
2337
|
opensuse: ruby20-devel
|
2352
2338
|
arch: ignore
|
2353
2339
|
default: nonexistent
|
@@ -2358,12 +2344,16 @@ ruby21:
|
|
2358
2344
|
- rake
|
2359
2345
|
- rubygems-integration
|
2360
2346
|
arch: ignore
|
2347
|
+
fedora: ruby-devel
|
2361
2348
|
default: nonexistent
|
2362
2349
|
build-essential:
|
2363
2350
|
debian,ubuntu: build-essential
|
2364
2351
|
gentoo: ignore
|
2365
2352
|
arch: base-devel
|
2366
|
-
fedora:
|
2353
|
+
fedora:
|
2354
|
+
- gcc-c++
|
2355
|
+
- make
|
2356
|
+
- glibc-devel
|
2367
2357
|
darwin: ignore
|
2368
2358
|
opensuse:
|
2369
2359
|
- ! '@devel_C_C++'
|
@@ -2420,13 +2410,6 @@ autotools:
|
|
2420
2410
|
opensuse:
|
2421
2411
|
- automake
|
2422
2412
|
- autoconf
|
2423
|
-
lsb_release:
|
2424
|
-
debian,ubuntu: lsb-release
|
2425
|
-
gentoo: sys-apps/lsb-release
|
2426
|
-
arch: lsb-release
|
2427
|
-
fedora: redhat-lsb
|
2428
|
-
darwin: ignore
|
2429
|
-
opensuse: lsb-release
|
2430
2413
|
archive:
|
2431
2414
|
debian,ubuntu:
|
2432
2415
|
- tar
|
@@ -2456,6 +2439,7 @@ pip:
|
|
2456
2439
|
debian,ubuntu: python-pip
|
2457
2440
|
arch: python2-pip
|
2458
2441
|
opensuse: python-pip
|
2442
|
+
fedora: python-pip
|
2459
2443
|
|
2460
2444
|
EODEFS
|
2461
2445
|
|
@@ -2487,16 +2471,15 @@ rescue Autoproj::ConfigError => e
|
|
2487
2471
|
end
|
2488
2472
|
|
2489
2473
|
# Now try to find out the name of the gem binary
|
2490
|
-
PACKAGES =
|
2491
|
-
|
2492
|
-
ENV['RUBYOPT'] = "-rubygems"
|
2493
|
-
require 'rubygems'
|
2474
|
+
PACKAGES = []
|
2494
2475
|
|
2495
2476
|
STDERR.puts "autoproj: installing autoproj and its dependencies (this can take a long time)"
|
2496
2477
|
# First install the dependencies of autoproj, as we don't want them to be
|
2497
2478
|
# affected by the prerelease flag
|
2498
2479
|
begin
|
2499
|
-
|
2480
|
+
if !PACKAGES.empty?
|
2481
|
+
osdeps_management.install(PACKAGES)
|
2482
|
+
end
|
2500
2483
|
rescue Autoproj::ConfigError => e
|
2501
2484
|
STDERR.puts "failed: #{e.message}"
|
2502
2485
|
exit(1)
|
data/bin/autoproj_bootstrap.in
CHANGED
@@ -167,16 +167,15 @@ rescue Autoproj::ConfigError => e
|
|
167
167
|
end
|
168
168
|
|
169
169
|
# Now try to find out the name of the gem binary
|
170
|
-
PACKAGES =
|
171
|
-
|
172
|
-
ENV['RUBYOPT'] = "-rubygems"
|
173
|
-
require 'rubygems'
|
170
|
+
PACKAGES = []
|
174
171
|
|
175
172
|
STDERR.puts "autoproj: installing autoproj and its dependencies (this can take a long time)"
|
176
173
|
# First install the dependencies of autoproj, as we don't want them to be
|
177
174
|
# affected by the prerelease flag
|
178
175
|
begin
|
179
|
-
|
176
|
+
if !PACKAGES.empty?
|
177
|
+
osdeps_management.install(PACKAGES)
|
178
|
+
end
|
180
179
|
rescue Autoproj::ConfigError => e
|
181
180
|
STDERR.puts "failed: #{e.message}"
|
182
181
|
exit(1)
|
data/lib/autoproj/default.osdeps
CHANGED
@@ -1,27 +1,6 @@
|
|
1
1
|
# The following definitions are needed to bootstrap autoproj
|
2
2
|
none: ignore
|
3
3
|
|
4
|
-
ruby18:
|
5
|
-
debian,ubuntu:
|
6
|
-
- ruby1.8-dev
|
7
|
-
- ruby1.8
|
8
|
-
- rubygems1.8
|
9
|
-
- ri1.8
|
10
|
-
- libopenssl-ruby1.8
|
11
|
-
- rake
|
12
|
-
gentoo:
|
13
|
-
- dev-lang/ruby:1.8
|
14
|
-
- rake
|
15
|
-
fedora:
|
16
|
-
"15,16":
|
17
|
-
- ruby
|
18
|
-
- rubygems
|
19
|
-
darwin:
|
20
|
-
- ruby
|
21
|
-
- rb-rake
|
22
|
-
default: nonexistent
|
23
|
-
arch: ignore # on arch, if ruby is installed then so is the supporting stuff
|
24
|
-
|
25
4
|
ruby19:
|
26
5
|
debian:
|
27
6
|
- ruby1.9.1
|
@@ -66,6 +45,11 @@ ruby20:
|
|
66
45
|
- ruby2.0-dev
|
67
46
|
- rake
|
68
47
|
- rubygems-integration
|
48
|
+
fedora:
|
49
|
+
'20':
|
50
|
+
- ruby
|
51
|
+
- ruby-devel
|
52
|
+
- rubygem-rake
|
69
53
|
opensuse: ruby20-devel
|
70
54
|
arch: ignore # on arch, if ruby is installed then so is the supporting stuff
|
71
55
|
default: nonexistent
|
@@ -77,13 +61,14 @@ ruby21:
|
|
77
61
|
- rake
|
78
62
|
- rubygems-integration
|
79
63
|
arch: ignore # on arch, if ruby is installed then so is the supporting stuff
|
64
|
+
fedora: ruby-devel
|
80
65
|
default: nonexistent
|
81
66
|
|
82
67
|
build-essential:
|
83
68
|
debian,ubuntu: build-essential
|
84
69
|
gentoo: ignore
|
85
70
|
arch: base-devel
|
86
|
-
fedora:
|
71
|
+
fedora: ["gcc-c++", make, glibc-devel]
|
87
72
|
darwin: ignore
|
88
73
|
opensuse: ["@devel_C_C++", "gcc-c++"]
|
89
74
|
|
@@ -146,14 +131,6 @@ autotools:
|
|
146
131
|
- automake
|
147
132
|
- autoconf
|
148
133
|
|
149
|
-
lsb_release:
|
150
|
-
debian,ubuntu: lsb-release
|
151
|
-
gentoo: sys-apps/lsb-release
|
152
|
-
arch: lsb-release
|
153
|
-
fedora: redhat-lsb
|
154
|
-
darwin: ignore
|
155
|
-
opensuse: lsb-release
|
156
|
-
|
157
134
|
archive:
|
158
135
|
debian,ubuntu:
|
159
136
|
- tar
|
@@ -185,6 +162,7 @@ pip:
|
|
185
162
|
debian,ubuntu: python-pip
|
186
163
|
arch: python2-pip
|
187
164
|
opensuse: python-pip
|
165
|
+
fedora: python-pip
|
188
166
|
|
189
167
|
# vim: expandtab
|
190
168
|
|
data/lib/autoproj/osdeps.rb
CHANGED
@@ -889,6 +889,68 @@ fi
|
|
889
889
|
@operating_system = values
|
890
890
|
end
|
891
891
|
|
892
|
+
def self.guess_operating_system
|
893
|
+
if File.exists?('/etc/debian_version')
|
894
|
+
versions = [File.read('/etc/debian_version').strip]
|
895
|
+
if versions.first =~ /sid/
|
896
|
+
versions = ["unstable", "sid"]
|
897
|
+
end
|
898
|
+
[['debian'], versions]
|
899
|
+
elsif File.exists?('/etc/redhat-release')
|
900
|
+
release_string = File.read('/etc/redhat-release').strip
|
901
|
+
release_string =~ /(.*) release ([\d.]+)/
|
902
|
+
name = $1.downcase
|
903
|
+
version = $2
|
904
|
+
if name =~ /Red Hat Entreprise/
|
905
|
+
name = 'rhel'
|
906
|
+
end
|
907
|
+
[[name], [version]]
|
908
|
+
elsif File.exists?('/etc/gentoo-release')
|
909
|
+
release_string = File.read('/etc/gentoo-release').strip
|
910
|
+
release_string =~ /^.*([^\s]+)$/
|
911
|
+
version = $1
|
912
|
+
[['gentoo'], [version]]
|
913
|
+
elsif File.exists?('/etc/arch-release')
|
914
|
+
[['arch'], []]
|
915
|
+
elsif Autobuild.macos?
|
916
|
+
version=`sw_vers | head -2 | tail -1`.split(":")[1]
|
917
|
+
[['darwin'], [version.strip]]
|
918
|
+
elsif Autobuild.windows?
|
919
|
+
[['windows'], []]
|
920
|
+
elsif File.exists?('/etc/SuSE-release')
|
921
|
+
version = File.read('/etc/SuSE-release').strip
|
922
|
+
version =~/.*VERSION\s+=\s+([^\s]+)/
|
923
|
+
version = $1
|
924
|
+
[['opensuse'], [version.strip]]
|
925
|
+
end
|
926
|
+
end
|
927
|
+
|
928
|
+
def self.ensure_derivatives_refer_to_their_parents(names)
|
929
|
+
names = names.dup
|
930
|
+
version_files = Hash[
|
931
|
+
'/etc/debian_version' => 'debian',
|
932
|
+
'/etc/redhat-release' => 'fedora',
|
933
|
+
'/etc/gentoo-release' => 'gentoo',
|
934
|
+
'/etc/arch-release' => 'arch',
|
935
|
+
'/etc/SuSE-release' => 'opensuse']
|
936
|
+
version_files.each do |file, name|
|
937
|
+
if File.exists?(file) && !names.include?(name)
|
938
|
+
names << name
|
939
|
+
end
|
940
|
+
end
|
941
|
+
names
|
942
|
+
end
|
943
|
+
|
944
|
+
def self.normalize_os_representation(names, versions)
|
945
|
+
# Normalize the names to lowercase
|
946
|
+
names = names.map(&:downcase)
|
947
|
+
versions = versions.map(&:downcase)
|
948
|
+
if !versions.include?('default')
|
949
|
+
versions += ['default']
|
950
|
+
end
|
951
|
+
return names, versions
|
952
|
+
end
|
953
|
+
|
892
954
|
# Autodetects the operating system name and version
|
893
955
|
#
|
894
956
|
# +osname+ is the operating system name, all in lowercase (e.g. ubuntu,
|
@@ -912,102 +974,41 @@ fi
|
|
912
974
|
|
913
975
|
if options[:force]
|
914
976
|
@operating_system = nil
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
@operating_system = os
|
924
|
-
return os
|
925
|
-
end
|
977
|
+
elsif !@operating_system.nil? # @operating_system can be set to false to simulate an unknown OS
|
978
|
+
return @operating_system
|
979
|
+
elsif user_os = ENV['AUTOPROJ_OS']
|
980
|
+
@operating_system =
|
981
|
+
if user_os.empty? then false
|
982
|
+
else
|
983
|
+
names, versions = user_os.split(':')
|
984
|
+
normalize_os_representation(names.split(','), versions.split(','))
|
926
985
|
end
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
@operating_system = [names.split(','), versions.split(',')]
|
936
|
-
end
|
937
|
-
else
|
938
|
-
Autobuild.progress :operating_system_autodetection, "autodetecting the operating system"
|
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
|
986
|
+
return @operating_system
|
987
|
+
elsif Autoproj.has_config_key?('operating_system')
|
988
|
+
os = Autoproj.user_config('operating_system')
|
989
|
+
if os.respond_to?(:to_ary)
|
990
|
+
if os[0].respond_to?(:to_ary) && os[0].all? { |s| s.respond_to?(:to_str) } &&
|
991
|
+
os[1].respond_to?(:to_ary) && os[1].all? { |s| s.respond_to?(:to_str) }
|
992
|
+
@operating_system = os
|
993
|
+
return os
|
959
994
|
end
|
960
995
|
end
|
996
|
+
@operating_system = nil # Invalid OS format in the configuration file
|
961
997
|
end
|
962
998
|
|
963
|
-
|
964
|
-
|
965
|
-
@operating_system =
|
966
|
-
if File.exists?('/etc/debian_version')
|
967
|
-
versions = [File.read('/etc/debian_version').strip]
|
968
|
-
if versions.first =~ /sid/
|
969
|
-
versions = ["unstable", "sid"]
|
970
|
-
end
|
971
|
-
if lsb_versions
|
972
|
-
lsb_versions.each { |v| versions << v if !versions.include?(v) }
|
973
|
-
end
|
974
|
-
[['debian'], versions]
|
975
|
-
elsif File.exists?('/etc/fedora-release')
|
976
|
-
release_string = File.read('/etc/fedora-release').strip
|
977
|
-
release_string =~ /Fedora release (\d+)/
|
978
|
-
version = $1
|
979
|
-
[['fedora'], [version]]
|
980
|
-
elsif File.exists?('/etc/gentoo-release')
|
981
|
-
release_string = File.read('/etc/gentoo-release').strip
|
982
|
-
release_string =~ /^.*([^\s]+)$/
|
983
|
-
version = $1
|
984
|
-
[['gentoo'], [version]]
|
985
|
-
elsif File.exists?('/etc/arch-release')
|
986
|
-
[['arch'], []]
|
987
|
-
elsif Autobuild.macos?
|
988
|
-
version=`sw_vers | head -2 | tail -1`.split(":")[1]
|
989
|
-
[['darwin'], [version.strip]]
|
990
|
-
elsif Autobuild.windows?
|
991
|
-
[['windows'], []]
|
992
|
-
elsif File.exists?('/etc/SuSE-release')
|
993
|
-
version = File.read('/etc/SuSE-release').strip
|
994
|
-
version =~/.*VERSION\s+=\s+([^\s]+)/
|
995
|
-
version = $1
|
996
|
-
[['opensuse'], [version.strip]]
|
997
|
-
end
|
998
|
-
end
|
999
|
+
Autobuild.progress :operating_system_autodetection, "autodetecting the operating system"
|
1000
|
+
names, versions = os_from_os_release
|
999
1001
|
|
1000
|
-
|
1001
|
-
|
1002
|
+
# Don't use the os-release information on Debian, since they
|
1003
|
+
# refuse to put enough information to detect 'unstable'
|
1004
|
+
# reliably. So, we use the heuristic method for it
|
1005
|
+
if !names || names[0] == 'debian'
|
1006
|
+
names, versions = guess_operating_system
|
1002
1007
|
end
|
1008
|
+
return if !names
|
1003
1009
|
|
1004
|
-
|
1005
|
-
names, versions =
|
1006
|
-
names = names.map(&:downcase)
|
1007
|
-
versions = versions.map(&:downcase)
|
1008
|
-
if !versions.include?('default')
|
1009
|
-
versions += ['default']
|
1010
|
-
end
|
1010
|
+
names = ensure_derivatives_refer_to_their_parents(names)
|
1011
|
+
names, versions = normalize_os_representation(names, versions)
|
1011
1012
|
|
1012
1013
|
@operating_system = [names, versions]
|
1013
1014
|
Autoproj.change_option('operating_system', @operating_system, true)
|
data/lib/autoproj/version.rb
CHANGED