Merge pull request #5571 from MikeMcQuaid/supported-cleanup
Warn more on unsupported configurations
This commit is contained in:
commit
f82f3ffe7c
@ -134,6 +134,7 @@ module Homebrew
|
|||||||
def gist_logs
|
def gist_logs
|
||||||
raise FormulaUnspecifiedError if ARGV.resolved_formulae.length != 1
|
raise FormulaUnspecifiedError if ARGV.resolved_formulae.length != 1
|
||||||
|
|
||||||
|
Install.perform_preinstall_checks(all_fatal: true)
|
||||||
gistify_logs(ARGV.resolved_formulae.first)
|
gistify_logs(ARGV.resolved_formulae.first)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -79,6 +79,10 @@ module Homebrew
|
|||||||
].freeze
|
].freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def supported_configuration_checks
|
||||||
|
[].freeze
|
||||||
|
end
|
||||||
|
|
||||||
def development_tools_checks
|
def development_tools_checks
|
||||||
%w[
|
%w[
|
||||||
check_for_installed_developer_tools
|
check_for_installed_developer_tools
|
||||||
@ -97,11 +101,10 @@ module Homebrew
|
|||||||
|
|
||||||
def please_create_pull_requests(what = "unsupported configuration")
|
def please_create_pull_requests(what = "unsupported configuration")
|
||||||
<<~EOS
|
<<~EOS
|
||||||
You may encounter build failures and other breakages.
|
You will encounter build failures with some formulae.
|
||||||
Please create pull requests instead of asking for help on
|
Please create pull requests instead of asking for help on Homebrew's GitHub,
|
||||||
Homebrew's GitHub, Discourse, Twitter or IRC. You are
|
Discourse, Twitter or IRC. You are responsible for resolving any issues you
|
||||||
responsible for resolving any issues you experience, as
|
experience, as you are running this #{what}.
|
||||||
you are running this #{what}.
|
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -118,10 +121,8 @@ module Homebrew
|
|||||||
return unless ENV["HOMEBREW_BUILD_FROM_SOURCE"]
|
return unless ENV["HOMEBREW_BUILD_FROM_SOURCE"]
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
You have HOMEBREW_BUILD_FROM_SOURCE set. This environment variable is
|
You have HOMEBREW_BUILD_FROM_SOURCE set.
|
||||||
intended for use by Homebrew developers. If you are encountering errors,
|
#{please_create_pull_requests}
|
||||||
please try unsetting this. Please do not file issues if you encounter
|
|
||||||
errors when using this environment variable.
|
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -802,13 +803,13 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_homebrew_prefix
|
def check_homebrew_prefix
|
||||||
return if HOMEBREW_PREFIX.to_s == Homebrew::DEFAULT_PREFIX
|
return if Homebrew.default_prefix?
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Your Homebrew's prefix is not #{Homebrew::DEFAULT_PREFIX}.
|
Your Homebrew's prefix is not #{Homebrew::DEFAULT_PREFIX}.
|
||||||
You can install Homebrew anywhere you want but some bottles (binary packages)
|
Some of Homebrew's bottles (binary packages) can only be used with the default
|
||||||
can only be used with a standard prefix and some formulae (packages)
|
prefix (#{Homebrew::DEFAULT_PREFIX}).
|
||||||
may not build correctly with a non-standard prefix.
|
#{please_create_pull_requests}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,13 @@ require "os/linux/kernel"
|
|||||||
module Homebrew
|
module Homebrew
|
||||||
module Diagnostic
|
module Diagnostic
|
||||||
class Checks
|
class Checks
|
||||||
|
def supported_configuration_checks
|
||||||
|
%w[
|
||||||
|
check_glibc_minimum_version
|
||||||
|
check_kernel_minimum_version
|
||||||
|
].freeze
|
||||||
|
end
|
||||||
|
|
||||||
def check_tmpdir_sticky_bit
|
def check_tmpdir_sticky_bit
|
||||||
message = generic_check_tmpdir_sticky_bit
|
message = generic_check_tmpdir_sticky_bit
|
||||||
return if message.nil?
|
return if message.nil?
|
||||||
|
|||||||
@ -26,8 +26,8 @@ module Homebrew
|
|||||||
FileUtils.ln_sf ld_so, brew_ld_so
|
FileUtils.ln_sf ld_so, brew_ld_so
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform_preinstall_checks
|
def perform_preinstall_checks(all_fatal: false)
|
||||||
generic_perform_preinstall_checks
|
generic_perform_preinstall_checks(all_fatal: all_fatal)
|
||||||
symlink_ld_so
|
symlink_ld_so
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,17 +1,23 @@
|
|||||||
module Homebrew
|
module Homebrew
|
||||||
module Diagnostic
|
module Diagnostic
|
||||||
class Checks
|
class Checks
|
||||||
undef development_tools_checks, fatal_development_tools_checks,
|
undef supported_configuration_checks, development_tools_checks,
|
||||||
build_error_checks
|
fatal_development_tools_checks, build_error_checks
|
||||||
|
|
||||||
|
def supported_configuration_checks
|
||||||
|
%w[
|
||||||
|
check_build_from_source
|
||||||
|
check_homebrew_prefix
|
||||||
|
check_for_unsupported_macos
|
||||||
|
].freeze
|
||||||
|
end
|
||||||
|
|
||||||
def development_tools_checks
|
def development_tools_checks
|
||||||
%w[
|
%w[
|
||||||
check_for_unsupported_macos
|
|
||||||
check_for_installed_developer_tools
|
check_for_installed_developer_tools
|
||||||
check_xcode_license_approved
|
check_xcode_license_approved
|
||||||
check_xcode_up_to_date
|
check_xcode_up_to_date
|
||||||
check_clt_up_to_date
|
check_clt_up_to_date
|
||||||
check_for_other_package_managers
|
|
||||||
].freeze
|
].freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -136,21 +142,6 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_for_other_package_managers
|
|
||||||
ponk = MacOS.macports_or_fink
|
|
||||||
return if ponk.empty?
|
|
||||||
|
|
||||||
<<~EOS
|
|
||||||
You have MacPorts or Fink installed:
|
|
||||||
#{ponk.join(", ")}
|
|
||||||
|
|
||||||
This can cause trouble. You don't have to uninstall them, but you may want to
|
|
||||||
temporarily move them out of the way, e.g.
|
|
||||||
|
|
||||||
sudo mv /opt/local ~/macports
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_ruby_version
|
def check_ruby_version
|
||||||
ruby_version = "2.3.7"
|
ruby_version = "2.3.7"
|
||||||
return if RUBY_VERSION == ruby_version
|
return if RUBY_VERSION == ruby_version
|
||||||
@ -200,19 +191,6 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_for_bad_curl
|
|
||||||
return unless MacOS.version <= "10.8"
|
|
||||||
return if Formula["curl"].installed?
|
|
||||||
|
|
||||||
<<~EOS
|
|
||||||
The system curl on 10.8 and below is often incapable of supporting
|
|
||||||
modern secure connections & will fail on fetching formulae.
|
|
||||||
|
|
||||||
We recommend you:
|
|
||||||
brew install curl
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_xcode_license_approved
|
def check_xcode_license_approved
|
||||||
# If the user installs Xcode-only, they have to approve the
|
# If the user installs Xcode-only, they have to approve the
|
||||||
# license or no "xc*" tool will work.
|
# license or no "xc*" tool will work.
|
||||||
@ -236,18 +214,6 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_for_beta_xquartz
|
|
||||||
return unless MacOS::XQuartz.version.to_s.include?("beta")
|
|
||||||
|
|
||||||
<<~EOS
|
|
||||||
The following beta release of XQuartz is installed: #{MacOS::XQuartz.version}
|
|
||||||
|
|
||||||
XQuartz beta releases include address sanitization, and do not work with
|
|
||||||
all software; notably, wine will not work with beta releases of XQuartz.
|
|
||||||
We recommend only installing stable releases of XQuartz.
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_filesystem_case_sensitive
|
def check_filesystem_case_sensitive
|
||||||
dirs_to_check = [
|
dirs_to_check = [
|
||||||
HOMEBREW_PREFIX,
|
HOMEBREW_PREFIX,
|
||||||
|
|||||||
@ -17,6 +17,16 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_cc_argv
|
||||||
|
return unless ARGV.cc
|
||||||
|
|
||||||
|
@checks ||= Diagnostic::Checks.new
|
||||||
|
opoo <<~EOS
|
||||||
|
You passed `--cc=#{ARGV.cc}`.
|
||||||
|
#{@checks.please_create_pull_requests}
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
|
||||||
def attempt_directory_creation
|
def attempt_directory_creation
|
||||||
Keg::MUST_EXIST_DIRECTORIES.each do |dir|
|
Keg::MUST_EXIST_DIRECTORIES.each do |dir|
|
||||||
begin
|
begin
|
||||||
@ -28,28 +38,34 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def perform_development_tools_checks
|
def perform_development_tools_checks
|
||||||
fatal_checks(:fatal_development_tools_checks)
|
diagnostic_checks(:fatal_development_tools_checks)
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform_preinstall_checks
|
def perform_preinstall_checks(all_fatal: false)
|
||||||
check_cpu
|
check_cpu
|
||||||
attempt_directory_creation
|
attempt_directory_creation
|
||||||
fatal_checks(:fatal_install_checks)
|
check_cc_argv
|
||||||
|
diagnostic_checks(:supported_configuration_checks, fatal: all_fatal)
|
||||||
|
diagnostic_checks(:fatal_install_checks)
|
||||||
end
|
end
|
||||||
alias generic_perform_preinstall_checks perform_preinstall_checks
|
alias generic_perform_preinstall_checks perform_preinstall_checks
|
||||||
module_function :generic_perform_preinstall_checks
|
module_function :generic_perform_preinstall_checks
|
||||||
|
|
||||||
def fatal_checks(type)
|
def diagnostic_checks(type, fatal: true)
|
||||||
@checks ||= Diagnostic::Checks.new
|
@checks ||= Diagnostic::Checks.new
|
||||||
failed = false
|
failed = false
|
||||||
@checks.public_send(type).each do |check|
|
@checks.public_send(type).each do |check|
|
||||||
out = @checks.public_send(check)
|
out = @checks.public_send(check)
|
||||||
next if out.nil?
|
next if out.nil?
|
||||||
|
|
||||||
failed ||= true
|
if fatal
|
||||||
ofail out
|
failed ||= true
|
||||||
|
ofail out
|
||||||
|
else
|
||||||
|
opoo out
|
||||||
|
end
|
||||||
end
|
end
|
||||||
exit 1 if failed
|
exit 1 if failed && fatal
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -15,8 +15,12 @@ module OS
|
|||||||
|
|
||||||
if OS.mac?
|
if OS.mac?
|
||||||
require "os/mac"
|
require "os/mac"
|
||||||
# Don't tell people to report issues on unsupported versions of macOS.
|
# Don't tell people to report issues on unsupported configurations.
|
||||||
if !OS::Mac.prerelease? && !OS::Mac.outdated_release?
|
if !OS::Mac.prerelease? &&
|
||||||
|
!OS::Mac.outdated_release? &&
|
||||||
|
!ENV["HOMEBREW_BUILD_FROM_SOURCE"] &&
|
||||||
|
ARGV.none? { |v| v.start_with?("--cc=") } &&
|
||||||
|
ENV["HOMEBREW_PREFIX"] == "/usr/local"
|
||||||
ISSUES_URL = "https://docs.brew.sh/Troubleshooting".freeze
|
ISSUES_URL = "https://docs.brew.sh/Troubleshooting".freeze
|
||||||
end
|
end
|
||||||
PATH_OPEN = "/usr/bin/open".freeze
|
PATH_OPEN = "/usr/bin/open".freeze
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
module Homebrew
|
module Homebrew
|
||||||
DEFAULT_PREFIX = if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
|
DEFAULT_PREFIX ||= if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
|
||||||
"/usr/local".freeze
|
"/usr/local".freeze
|
||||||
else
|
else
|
||||||
"/home/linuxbrew/.linuxbrew".freeze
|
"/home/linuxbrew/.linuxbrew".freeze
|
||||||
|
|||||||
@ -164,7 +164,7 @@ describe Homebrew::Diagnostic::Checks do
|
|||||||
end
|
end
|
||||||
|
|
||||||
specify "#check_homebrew_prefix" do
|
specify "#check_homebrew_prefix" do
|
||||||
# the integration tests are run in a special prefix
|
allow(Homebrew).to receive(:default_prefix?).and_return(false)
|
||||||
expect(subject.check_homebrew_prefix)
|
expect(subject.check_homebrew_prefix)
|
||||||
.to match("Your Homebrew's prefix is not #{Homebrew::DEFAULT_PREFIX}")
|
.to match("Your Homebrew's prefix is not #{Homebrew::DEFAULT_PREFIX}")
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,12 +1,6 @@
|
|||||||
require "diagnostic"
|
require "diagnostic"
|
||||||
|
|
||||||
describe Homebrew::Diagnostic::Checks do
|
describe Homebrew::Diagnostic::Checks do
|
||||||
specify "#check_for_other_package_managers" do
|
|
||||||
allow(MacOS).to receive(:macports_or_fink).and_return(["fink"])
|
|
||||||
expect(subject.check_for_other_package_managers)
|
|
||||||
.to match("You have MacPorts or Fink installed:")
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "#check_for_unsupported_macos" do
|
specify "#check_for_unsupported_macos" do
|
||||||
ENV.delete("HOMEBREW_DEVELOPER")
|
ENV.delete("HOMEBREW_DEVELOPER")
|
||||||
allow(OS::Mac).to receive(:prerelease?).and_return(true)
|
allow(OS::Mac).to receive(:prerelease?).and_return(true)
|
||||||
@ -15,13 +9,6 @@ describe Homebrew::Diagnostic::Checks do
|
|||||||
.to match("We do not provide support for this pre-release version.")
|
.to match("We do not provide support for this pre-release version.")
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "#check_for_beta_xquartz" do
|
|
||||||
allow(MacOS::XQuartz).to receive(:version).and_return("2.7.10_beta2")
|
|
||||||
|
|
||||||
expect(subject.check_for_beta_xquartz)
|
|
||||||
.to match("The following beta release of XQuartz is installed: 2.7.10_beta2")
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "#check_if_xcode_needs_clt_installed" do
|
specify "#check_if_xcode_needs_clt_installed" do
|
||||||
allow(MacOS).to receive(:version).and_return(OS::Mac::Version.new("10.11"))
|
allow(MacOS).to receive(:version).and_return(OS::Mac::Version.new("10.11"))
|
||||||
allow(MacOS::Xcode).to receive(:installed?).and_return(true)
|
allow(MacOS::Xcode).to receive(:installed?).and_return(true)
|
||||||
|
|||||||
@ -41,3 +41,8 @@ PATCH_B_SHA256 = "57958271bb802a59452d0816e0670d16c8b70bdf6530bcf6f78726489ad89b
|
|||||||
|
|
||||||
TEST_SHA1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
|
TEST_SHA1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
|
||||||
TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
|
TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
|
||||||
|
|
||||||
|
# For testing's sake always assume the default prefix
|
||||||
|
module Homebrew
|
||||||
|
DEFAULT_PREFIX = HOMEBREW_PREFIX.to_s.freeze
|
||||||
|
end
|
||||||
|
|||||||
@ -9,19 +9,18 @@ describe Utils::Analytics do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "returns OS_VERSION and prefix when HOMEBREW_PREFIX is a custom prefix" do
|
it "returns OS_VERSION and prefix when HOMEBREW_PREFIX is a custom prefix" do
|
||||||
stub_const("HOMEBREW_PREFIX", "blah")
|
allow(Homebrew).to receive(:default_prefix?).and_return(false)
|
||||||
expect(described_class.os_prefix_ci).to include("#{OS_VERSION}, #{described_class.custom_prefix_label}")
|
expect(described_class.os_prefix_ci).to include("#{OS_VERSION}, #{described_class.custom_prefix_label}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "does not include prefix when HOMEBREW_PREFIX is the default prefix" do
|
||||||
|
expect(described_class.os_prefix_ci).not_to include(described_class.custom_prefix_label)
|
||||||
|
end
|
||||||
|
|
||||||
it "includes CI when ENV['CI'] is set" do
|
it "includes CI when ENV['CI'] is set" do
|
||||||
ENV["CI"] = "true"
|
ENV["CI"] = "true"
|
||||||
expect(described_class.os_prefix_ci).to include("CI")
|
expect(described_class.os_prefix_ci).to include("CI")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not include prefix when HOMEBREW_PREFIX is the default prefix" do
|
|
||||||
stub_const("HOMEBREW_PREFIX", Homebrew::DEFAULT_PREFIX)
|
|
||||||
expect(described_class.os_prefix_ci).not_to include(described_class.custom_prefix_label)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ module Utils
|
|||||||
def os_prefix_ci
|
def os_prefix_ci
|
||||||
@os_prefix_ci ||= begin
|
@os_prefix_ci ||= begin
|
||||||
os = OS_VERSION
|
os = OS_VERSION
|
||||||
prefix = ", #{custom_prefix_label}" if HOMEBREW_PREFIX.to_s != Homebrew::DEFAULT_PREFIX
|
prefix = ", #{custom_prefix_label}" unless Homebrew.default_prefix?
|
||||||
ci = ", CI" if ENV["CI"]
|
ci = ", CI" if ENV["CI"]
|
||||||
"#{os}#{prefix}#{ci}"
|
"#{os}#{prefix}#{ci}"
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user