config: Print host glibc version [Linux]
This commit is contained in:
parent
9cabda83e4
commit
0575d7b610
@ -1,4 +1,5 @@
|
|||||||
require "formula"
|
require "formula"
|
||||||
|
require "os/linux/glibc"
|
||||||
|
|
||||||
class SystemConfig
|
class SystemConfig
|
||||||
class << self
|
class << self
|
||||||
@ -14,6 +15,12 @@ class SystemConfig
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def host_glibc_version
|
||||||
|
version = OS::Linux::Glibc.system_version
|
||||||
|
return "N/A" if version.null?
|
||||||
|
version
|
||||||
|
end
|
||||||
|
|
||||||
def host_gcc_version
|
def host_gcc_version
|
||||||
gcc = Pathname.new "/usr/bin/gcc"
|
gcc = Pathname.new "/usr/bin/gcc"
|
||||||
return "N/A" unless gcc.executable?
|
return "N/A" unless gcc.executable?
|
||||||
@ -31,6 +38,7 @@ class SystemConfig
|
|||||||
dump_generic_verbose_config(out)
|
dump_generic_verbose_config(out)
|
||||||
out.puts "Kernel: #{`uname -mors`.chomp}"
|
out.puts "Kernel: #{`uname -mors`.chomp}"
|
||||||
out.puts "OS: #{host_os_version}"
|
out.puts "OS: #{host_os_version}"
|
||||||
|
out.puts "Host glibc: #{host_glibc_version}"
|
||||||
out.puts "/usr/bin/gcc: #{host_gcc_version}"
|
out.puts "/usr/bin/gcc: #{host_gcc_version}"
|
||||||
["glibc", "gcc", "xorg"].each do |f|
|
["glibc", "gcc", "xorg"].each do |f|
|
||||||
out.puts "#{f}: #{formula_linked_version f}"
|
out.puts "#{f}: #{formula_linked_version f}"
|
||||||
|
|||||||
14
Library/Homebrew/os/linux/glibc.rb
Normal file
14
Library/Homebrew/os/linux/glibc.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
module OS
|
||||||
|
module Linux
|
||||||
|
module Glibc
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def system_version
|
||||||
|
return @system_version if @system_version
|
||||||
|
version = Utils.popen_read("/usr/bin/ldd", "--version")[/ (\d+\.\d+)/, 1]
|
||||||
|
return Version::NULL unless version
|
||||||
|
@system_version = Version.new version
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user