diff options
| author | Shaun Jackman | 2017-12-04 17:46:52 -0800 |
|---|---|---|
| committer | Shaun Jackman | 2017-12-07 10:37:19 -0800 |
| commit | 0575d7b6109b566c0eb324dbad19478eb8506d71 (patch) | |
| tree | 315a2a9d27ace83b2261ecaad8ba0c0f260c4ee9 | |
| parent | 9cabda83e42ee2681d2ac08f9ff33ddc5d4ee540 (diff) | |
| download | brew-0575d7b6109b566c0eb324dbad19478eb8506d71.tar.bz2 | |
config: Print host glibc version [Linux]
| -rw-r--r-- | Library/Homebrew/extend/os/linux/system_config.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/os/linux/glibc.rb | 14 |
2 files changed, 22 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/os/linux/system_config.rb b/Library/Homebrew/extend/os/linux/system_config.rb index edb70058f..cf0176562 100644 --- a/Library/Homebrew/extend/os/linux/system_config.rb +++ b/Library/Homebrew/extend/os/linux/system_config.rb @@ -1,4 +1,5 @@ require "formula" +require "os/linux/glibc" class SystemConfig class << self @@ -14,6 +15,12 @@ class SystemConfig end end + def host_glibc_version + version = OS::Linux::Glibc.system_version + return "N/A" if version.null? + version + end + def host_gcc_version gcc = Pathname.new "/usr/bin/gcc" return "N/A" unless gcc.executable? @@ -31,6 +38,7 @@ class SystemConfig dump_generic_verbose_config(out) out.puts "Kernel: #{`uname -mors`.chomp}" out.puts "OS: #{host_os_version}" + out.puts "Host glibc: #{host_glibc_version}" out.puts "/usr/bin/gcc: #{host_gcc_version}" ["glibc", "gcc", "xorg"].each do |f| out.puts "#{f}: #{formula_linked_version f}" diff --git a/Library/Homebrew/os/linux/glibc.rb b/Library/Homebrew/os/linux/glibc.rb new file mode 100644 index 000000000..710946bbc --- /dev/null +++ b/Library/Homebrew/os/linux/glibc.rb @@ -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 |
