blob: 4f56addb597220458064d95ef4c3073539cafaf4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
require "hardware"
require "software_spec"
require "rexml/document"
require "tap"
require "development_tools"
class SystemConfig
class << self
def llvm
@llvm ||= DevelopmentTools.llvm_build_version if DevelopmentTools.installed?
end
def gcc_42
@gcc_42 ||= DevelopmentTools.gcc_42_build_version if DevelopmentTools.installed?
end
def gcc_40
@gcc_40 ||= DevelopmentTools.gcc_40_build_version if DevelopmentTools.installed?
end
def clang
@clang ||= DevelopmentTools.clang_version if DevelopmentTools.installed?
end
def clang_build
@clang_build ||= DevelopmentTools.clang_build_version if DevelopmentTools.installed?
end
def head
Homebrew.git_head || "(none)"
end
def last_commit
Homebrew.git_last_commit || "never"
end
def origin
Homebrew.git_origin || "(none)"
end
def core_tap_head
CoreTap.instance.git_head || "(none)"
end
def core_tap_last_commit
CoreTap.instance.git_last_commit || "never"
end
def core_tap_origin
CoreTap.instance.remote || "(none)"
end
def describe_path(path)
return "N/A" if path.nil?
realpath = path.realpath
if realpath == path
path
else
"#{path} => #{realpath}"
end
end
def describe_perl
describe_path(which "perl")
end
def describe_python
python = which "python"
return "N/A" if python.nil?
python_binary = Utils.popen_read python, "-c", "import sys; sys.stdout.write(sys.executable)"
python_binary = Pathname.new(python_binary).realpath
if python == python_binary
python
else
"#{python} => #{python_binary}"
end
end
def describe_ruby
ruby = which "ruby"
return "N/A" if ruby.nil?
ruby_binary = Utils.popen_read ruby, "-rrbconfig", "-e", \
'include RbConfig;print"#{CONFIG["bindir"]}/#{CONFIG["ruby_install_name"]}#{CONFIG["EXEEXT"]}"'
ruby_binary = Pathname.new(ruby_binary).realpath
if ruby == ruby_binary
ruby
else
"#{ruby} => #{ruby_binary}"
end
end
def hardware
return if Hardware::CPU.type == :dunno
"CPU: #{Hardware.cores_as_words}-core #{Hardware::CPU.bits}-bit #{Hardware::CPU.family}"
end
def kernel
`uname -m`.chomp
end
def describe_java
# java_home doesn't exist on all OS Xs; it might be missing on older versions.
return "N/A" unless File.executable? "/usr/libexec/java_home"
java_xml = Utils.popen_read("/usr/libexec/java_home", "--xml", "--failfast")
return "N/A" unless $?.success?
javas = []
REXML::XPath.each(REXML::Document.new(java_xml), "//key[text()='JVMVersion']/following-sibling::string") do |item|
javas << item.text
end
javas.uniq.join(", ")
end
def dump_verbose_config(f = $stdout)
f.puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}"
f.puts "ORIGIN: #{origin}"
f.puts "HEAD: #{head}"
f.puts "Last commit: #{last_commit}"
if CoreTap.instance.installed?
f.puts "Core tap ORIGIN: #{core_tap_origin}"
f.puts "Core tap HEAD: #{core_tap_head}"
f.puts "Core tap last commit: #{core_tap_last_commit}"
else
f.puts "Core tap: N/A"
end
f.puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}"
f.puts "HOMEBREW_REPOSITORY: #{HOMEBREW_REPOSITORY}"
f.puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}"
f.puts "HOMEBREW_BOTTLE_DOMAIN: #{BottleSpecification::DEFAULT_DOMAIN}"
f.puts hardware if hardware
f.puts "GCC-4.0: build #{gcc_40}" if gcc_40
f.puts "GCC-4.2: build #{gcc_42}" if gcc_42
f.puts "LLVM-GCC: build #{llvm}" if llvm
f.puts "Clang: #{clang ? "#{clang} build #{clang_build}" : "N/A"}"
f.puts "Perl: #{describe_perl}"
f.puts "Python: #{describe_python}"
f.puts "Ruby: #{describe_ruby}"
f.puts "Java: #{describe_java}"
end
alias_method :dump_generic_verbose_config, :dump_verbose_config
end
end
require "extend/os/system_config"
|