mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Output more warnings on unsupported configurations
This commit is contained in:
parent
8258ecc3ca
commit
3a0e0dca36
@ -79,6 +79,10 @@ module Homebrew
|
||||
].freeze
|
||||
end
|
||||
|
||||
def supported_configuration_checks
|
||||
[].freeze
|
||||
end
|
||||
|
||||
def development_tools_checks
|
||||
%w[
|
||||
check_for_installed_developer_tools
|
||||
@ -97,11 +101,10 @@ module Homebrew
|
||||
|
||||
def please_create_pull_requests(what = "unsupported configuration")
|
||||
<<~EOS
|
||||
You may encounter build failures and other breakages.
|
||||
Please create pull requests instead of asking for help on
|
||||
Homebrew's GitHub, Discourse, Twitter or IRC. You are
|
||||
responsible for resolving any issues you experience, as
|
||||
you are running this #{what}.
|
||||
You will encounter build failures with some formulae.
|
||||
Please create pull requests instead of asking for help on Homebrew's GitHub,
|
||||
Discourse, Twitter or IRC. You are responsible for resolving any issues you
|
||||
experience, as you are running this #{what}.
|
||||
EOS
|
||||
end
|
||||
|
||||
@ -118,10 +121,8 @@ module Homebrew
|
||||
return unless ENV["HOMEBREW_BUILD_FROM_SOURCE"]
|
||||
|
||||
<<~EOS
|
||||
You have HOMEBREW_BUILD_FROM_SOURCE set. This environment variable is
|
||||
intended for use by Homebrew developers. If you are encountering errors,
|
||||
please try unsetting this. Please do not file issues if you encounter
|
||||
errors when using this environment variable.
|
||||
You have HOMEBREW_BUILD_FROM_SOURCE set.
|
||||
#{please_create_pull_requests}
|
||||
EOS
|
||||
end
|
||||
|
||||
@ -806,9 +807,9 @@ module Homebrew
|
||||
|
||||
<<~EOS
|
||||
Your Homebrew's prefix is not #{Homebrew::DEFAULT_PREFIX}.
|
||||
You can install Homebrew anywhere you want but some bottles (binary packages)
|
||||
can only be used with a standard prefix and some formulae (packages)
|
||||
may not build correctly with a non-standard prefix.
|
||||
Some of Homebrew's bottles (binary packages) can only be used with the default
|
||||
prefix (#{Homebrew::DEFAULT_PREFIX}).
|
||||
#{please_create_pull_requests}
|
||||
EOS
|
||||
end
|
||||
|
||||
|
@ -7,6 +7,13 @@ require "os/linux/kernel"
|
||||
module Homebrew
|
||||
module Diagnostic
|
||||
class Checks
|
||||
def supported_configuration_checks
|
||||
%w[
|
||||
check_glibc_minimum_version
|
||||
check_kernel_minimum_version
|
||||
].freeze
|
||||
end
|
||||
|
||||
def check_tmpdir_sticky_bit
|
||||
message = generic_check_tmpdir_sticky_bit
|
||||
return if message.nil?
|
||||
|
@ -26,8 +26,8 @@ module Homebrew
|
||||
FileUtils.ln_sf ld_so, brew_ld_so
|
||||
end
|
||||
|
||||
def perform_preinstall_checks
|
||||
generic_perform_preinstall_checks
|
||||
def perform_preinstall_checks(all_fatal: false)
|
||||
generic_perform_preinstall_checks(all_fatal: all_fatal)
|
||||
symlink_ld_so
|
||||
end
|
||||
end
|
||||
|
@ -1,12 +1,19 @@
|
||||
module Homebrew
|
||||
module Diagnostic
|
||||
class Checks
|
||||
undef development_tools_checks, fatal_development_tools_checks,
|
||||
build_error_checks
|
||||
undef supported_configuration_checks, development_tools_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
|
||||
%w[
|
||||
check_for_unsupported_macos
|
||||
check_for_installed_developer_tools
|
||||
check_xcode_license_approved
|
||||
check_xcode_up_to_date
|
||||
|
@ -17,6 +17,16 @@ module Homebrew
|
||||
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
|
||||
Keg::MUST_EXIST_DIRECTORIES.each do |dir|
|
||||
begin
|
||||
@ -28,28 +38,34 @@ module Homebrew
|
||||
end
|
||||
|
||||
def perform_development_tools_checks
|
||||
fatal_checks(:fatal_development_tools_checks)
|
||||
diagnostic_checks(:fatal_development_tools_checks)
|
||||
end
|
||||
|
||||
def perform_preinstall_checks
|
||||
def perform_preinstall_checks(all_fatal: false)
|
||||
check_cpu
|
||||
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
|
||||
alias generic_perform_preinstall_checks perform_preinstall_checks
|
||||
module_function :generic_perform_preinstall_checks
|
||||
|
||||
def fatal_checks(type)
|
||||
def diagnostic_checks(type, fatal: true)
|
||||
@checks ||= Diagnostic::Checks.new
|
||||
failed = false
|
||||
@checks.public_send(type).each do |check|
|
||||
out = @checks.public_send(check)
|
||||
next if out.nil?
|
||||
|
||||
failed ||= true
|
||||
ofail out
|
||||
if fatal
|
||||
failed ||= true
|
||||
ofail out
|
||||
else
|
||||
opoo out
|
||||
end
|
||||
end
|
||||
exit 1 if failed
|
||||
exit 1 if failed && fatal
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user