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) ⇒ Object

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.



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'extend/os/linux/system_config.rb', line 45

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 "#{::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) ⇒ Object

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.



30
31
32
33
34
35
36
# File 'extend/os/linux/system_config.rb', line 30

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_versionObject

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.



23
24
25
26
27
28
# File 'extend/os/linux/system_config.rb', line 23

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

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

#host_glibc_versionObject

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.



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

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

  version
end

#host_ruby_versionObject

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.



38
39
40
41
42
43
# File 'extend/os/linux/system_config.rb', line 38

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

  out
end