Module: OS::Linux::SystemConfig::ClassMethods Private

Includes:
SystemCommand::Mixin
Defined in:
extend/os/linux/system_config.rb

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Constant Summary collapse

HOST_RUBY_PATH =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

"/usr/bin/ruby"

Instance Method Summary collapse

Methods included from SystemCommand::Mixin

#system_command, #system_command!

Instance Method Details

#dump_verbose_config(out = $stdout) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.

Parameters:

  • out (File, StringIO, IO) (defaults to: $stdout)


59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'extend/os/linux/system_config.rb', line 59

def dump_verbose_config(out = $stdout)
  kernel = Utils.safe_popen_read("uname", "-mors").chomp
  super
  out.puts "Kernel: #{kernel}"
  out.puts "OS: #{OS::Linux.os_version}"
  out.puts "WSL: #{OS::Linux.wsl_version}" if OS::Linux.wsl?
  out.puts "Host glibc: #{host_glibc_version}"
  out.puts "Host libstdc++: #{host_libstdcxx_version}"
  out.puts "#{::DevelopmentTools.host_gcc_path}: #{host_gcc_version}"
  out.puts "/usr/bin/ruby: #{host_ruby_version}" if RUBY_PATH != HOST_RUBY_PATH
  ["glibc", ::CompilerSelector.preferred_gcc, OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA, "xorg"].each do |f|
    out.puts "#{f}: #{formula_linked_version(f)}"
  end
end

#formula_linked_version(formula) ⇒ String, PkgVersion

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

Returns:



42
43
44
45
46
47
48
# File 'extend/os/linux/system_config.rb', line 42

def formula_linked_version(formula)
  return "N/A" if Homebrew::EnvConfig.no_install_from_api? && !CoreTap.instance.installed?

  Formulary.factory(formula).any_installed_version || "N/A"
rescue FormulaUnavailableError
  "N/A"
end

#host_gcc_versionString

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



34
35
36
37
38
39
# File 'extend/os/linux/system_config.rb', line 34

def host_gcc_version
  gcc = ::DevelopmentTools.host_gcc_path
  return "N/A" unless gcc.executable?

  Utils.popen_read(gcc, "--version")[/ (\d+\.\d+\.\d+)/, 1] || "N/A"
end

#host_glibc_versionString, Version

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



18
19
20
21
22
23
# File 'extend/os/linux/system_config.rb', line 18

def host_glibc_version
  version = OS::Linux::Glibc.system_version
  return "N/A" if version.null?

  version
end

#host_libstdcxx_versionString, Version

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



26
27
28
29
30
31
# File 'extend/os/linux/system_config.rb', line 26

def host_libstdcxx_version
  version = OS::Linux::Libstdcxx.system_version
  return "N/A" if version.null?

  version
end

#host_ruby_versionString

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



51
52
53
54
55
56
# File 'extend/os/linux/system_config.rb', line 51

def host_ruby_version
  out, _, status = system_command(HOST_RUBY_PATH, args: ["-e", "puts RUBY_VERSION"], print_stderr: false).to_a
  return "N/A" unless status.success?

  out
end