2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-02-20 11:13:13 -08:00
|
|
|
module OS
|
2019-09-13 16:48:12 +01:00
|
|
|
module Linux
|
|
|
|
module_function
|
|
|
|
|
|
|
|
def os_version
|
|
|
|
if which("lsb_release")
|
|
|
|
description = Utils.popen_read("lsb_release -d")
|
|
|
|
.chomp
|
|
|
|
.sub("Description:\t", "")
|
|
|
|
codename = Utils.popen_read("lsb_release -c")
|
|
|
|
.chomp
|
|
|
|
.sub("Codename:\t", "")
|
|
|
|
"#{description} (#{codename})"
|
|
|
|
elsif (redhat_release = Pathname.new("/etc/redhat-release")).readable?
|
|
|
|
redhat_release.read.chomp
|
|
|
|
else
|
|
|
|
"Unknown"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-20 11:13:13 -08:00
|
|
|
# Define OS::Mac on Linux for formula API compatibility.
|
|
|
|
module Mac
|
|
|
|
module_function
|
|
|
|
|
2019-04-19 21:46:20 +09:00
|
|
|
# rubocop:disable Naming/ConstantName
|
|
|
|
# rubocop:disable Style/MutableConstant
|
2020-06-22 16:19:11 +05:30
|
|
|
::MacOS = OS::Mac
|
2019-04-19 21:46:20 +09:00
|
|
|
# rubocop:enable Naming/ConstantName
|
|
|
|
# rubocop:enable Style/MutableConstant
|
2018-02-20 11:13:13 -08:00
|
|
|
|
2018-08-13 23:38:48 -07:00
|
|
|
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
|
|
|
|
2018-02-20 11:13:13 -08:00
|
|
|
def version
|
|
|
|
Version::NULL
|
|
|
|
end
|
|
|
|
|
|
|
|
def full_version
|
|
|
|
Version::NULL
|
|
|
|
end
|
|
|
|
|
2019-03-26 17:14:12 -04:00
|
|
|
def languages
|
2020-05-23 19:39:11 +01:00
|
|
|
@languages ||= [*ENV["LANG"]&.slice(/[a-z]+/)].uniq
|
2019-03-26 17:14:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def language
|
|
|
|
languages.first
|
|
|
|
end
|
|
|
|
|
2020-04-07 16:43:59 +01:00
|
|
|
def sdk_root_needed?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2020-03-10 14:59:22 +01:00
|
|
|
def sdk_path_if_needed(_v = nil)
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
2018-02-20 11:13:13 -08:00
|
|
|
module Xcode
|
|
|
|
module_function
|
|
|
|
|
|
|
|
def version
|
|
|
|
Version::NULL
|
|
|
|
end
|
|
|
|
end
|
2020-04-30 16:07:55 +01:00
|
|
|
|
|
|
|
module CLT
|
|
|
|
module_function
|
|
|
|
|
|
|
|
def version
|
|
|
|
Version::NULL
|
|
|
|
end
|
|
|
|
end
|
2018-02-20 11:13:13 -08:00
|
|
|
end
|
|
|
|
end
|