Mike McQuaid cdaeee03c4
GitHub Packages cleanup
- `download_strategy`: only request image index JSON for downloading
  the manifest for the tab
- use a shared `OS` constant for the version of `glibc` we use in CI
- fix `skoepeo` typo
- ensure that blank hash values are deleted (again) rather than just
  `nil` ones
- use a shared `Hardware::CPU` constant for oldest CPU we're
  supporting/using on Intel 64-bit
- re-add comment to `software_spec`
2021-04-05 14:58:17 +01:00

58 lines
1.3 KiB
Ruby

# typed: true
# frozen_string_literal: true
# Helper functions for querying operating system information.
#
# @api private
module OS
extend T::Sig
# Check if the operating system is macOS.
#
# @api public
sig { returns(T::Boolean) }
def self.mac?
return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
RbConfig::CONFIG["host_os"].include? "darwin"
end
# Check if the operating system is Linux.
#
# @api public
sig { returns(T::Boolean) }
def self.linux?
return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
RbConfig::CONFIG["host_os"].include? "linux"
end
# Get the kernel version.
#
# @api public
sig { returns(Version) }
def self.kernel_version
@kernel_version ||= Version.new(Utils.safe_popen_read("uname", "-r").chomp)
end
::OS_VERSION = ENV["HOMEBREW_OS_VERSION"]
GLIBC_CI_VERSION = "2.23"
if OS.mac?
require "os/mac"
# Don't tell people to report issues on unsupported configurations.
if !OS::Mac.prerelease? &&
!OS::Mac.outdated_release? &&
ARGV.none? { |v| v.start_with?("--cc=") } &&
ENV["HOMEBREW_PREFIX"] == "/usr/local"
ISSUES_URL = "https://docs.brew.sh/Troubleshooting"
end
PATH_OPEN = "/usr/bin/open"
elsif OS.linux?
require "os/linux"
ISSUES_URL = "https://docs.brew.sh/Troubleshooting"
PATH_OPEN = "xdg-open"
end
end