Skip to content
Snippets Groups Projects
Commit 7095738d authored by Mike McQuaid's avatar Mike McQuaid
Browse files

Remove config/doctor checks we no longer need

A bunch of these were needed before superenv, environment filtering or
on now long-unsupported versions of macOS.
parent 46f583c4
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,6 @@ module Homebrew
slow_checks = %w[
check_for_broken_symlinks
check_missing_deps
check_for_linked_keg_only_brews
]
methods = (checks.all.sort - slow_checks) + slow_checks
else
......
......@@ -107,18 +107,6 @@ module Homebrew
EOS
end
# See https://github.com/Homebrew/legacy-homebrew/pull/9986
def check_path_for_trailing_slashes
bad_paths = PATH.new(ENV["HOMEBREW_PATH"]).select { |p| p.end_with?("/") }
return if bad_paths.empty?
inject_file_list bad_paths, <<~EOS
Some directories in your path end in a slash.
Directories in your path should not end in a slash. This can break other
doctor checks. The following directories should be edited:
EOS
end
# Anaconda installs multiple system & brew dupes, including OpenSSL, Python,
# sqlite, libpng, Qt, etc. Regularly breaks compile on Vim, MacVim and others.
# Is flagged as part of the *-config script checks below, but people seem
......@@ -620,18 +608,6 @@ module Homebrew
message
end
def check_ssl_cert_file
return unless ENV.key?("SSL_CERT_FILE")
<<~EOS
Setting SSL_CERT_FILE can break downloading files; if that happens
you should unset it before running Homebrew.
Homebrew uses the system curl which uses system certificates by
default. Setting SSL_CERT_FILE makes it use an outdated OpenSSL, which
does not support modern OpenSSL certificate stores.
EOS
end
def check_for_symlinked_cellar
return unless HOMEBREW_CELLAR.exist?
return unless HOMEBREW_CELLAR.symlink?
......@@ -811,28 +787,6 @@ module Homebrew
false
end
def check_for_linked_keg_only_brews
return unless HOMEBREW_CELLAR.exist?
linked = Formula.installed.sort.select do |f|
f.keg_only? && __check_linked_brew(f)
end
return if linked.empty?
inject_file_list linked.map(&:full_name), <<~EOS
Some keg-only formulae are linked into the Cellar.
Linking a keg-only formula, such as gettext, into the cellar with
`brew link <formula>` will cause other formulae to detect them during
the `./configure` step. This may cause problems when compiling those
other formulae.
Binaries provided by keg-only formulae may override system binaries
with other strange results.
You may wish to `brew unlink` these brews:
EOS
end
def check_for_other_frameworks
# Other frameworks that are known to cause problems when present
frameworks_to_check = %w[
......@@ -893,53 +847,6 @@ module Homebrew
EOS
end
def check_for_enthought_python
return unless which "enpkg"
<<~EOS
Enthought Python was found in your PATH.
This can cause build problems, as this software installs its own
copies of iconv and libxml2 into directories that are picked up by
other build systems.
EOS
end
def check_for_library_python
return unless File.exist?("/Library/Frameworks/Python.framework")
<<~EOS
Python is installed at /Library/Frameworks/Python.framework
Homebrew only supports building against the System-provided Python or a
brewed Python. In particular, Pythons installed to /Library can interfere
with other software installs.
EOS
end
def check_for_old_homebrew_share_python_in_path
message = ""
["", "3"].map do |suffix|
next unless paths.include?((HOMEBREW_PREFIX/"share/python#{suffix}").to_s)
message += <<~EOS
#{HOMEBREW_PREFIX}/share/python#{suffix} is not needed in PATH.
EOS
end
unless message.empty?
message += <<~EOS
Formerly homebrew put Python scripts you installed via `pip` or `pip3`
(or `easy_install`) into that directory above but now it can be removed
from your PATH variable.
Python scripts will now install into #{HOMEBREW_PREFIX}/bin.
You can delete anything, except 'Extras', from the #{HOMEBREW_PREFIX}/share/python
(and #{HOMEBREW_PREFIX}/share/python@2) dir and install affected Python packages
anew with `pip install --upgrade`.
EOS
end
message unless message.empty?
end
def check_for_bad_python_symlink
return unless which "python"
`python -V 2>&1` =~ /Python (\d+)\./
......
......@@ -7,8 +7,6 @@ module Homebrew
check_for_bad_install_name_tool
check_for_installed_developer_tools
check_xcode_license_approved
check_for_osx_gcc_installer
check_xcode_8_without_clt_on_el_capitan
check_xcode_up_to_date
check_clt_up_to_date
check_for_other_package_managers
......@@ -92,20 +90,6 @@ module Homebrew
EOS
end
def check_xcode_8_without_clt_on_el_capitan
return unless MacOS::Xcode.without_clt?
# Scope this to Xcode 8 on El Cap for now
return unless MacOS.version == :el_capitan
return unless MacOS::Xcode.version >= "8"
<<~EOS
You have Xcode 8 installed without the CLT;
this causes certain builds to fail on OS X El Capitan (10.11).
Please install the CLT via:
sudo xcode-select --install
EOS
end
def check_xcode_minimum_version
return unless MacOS::Xcode.below_minimum_version?
......@@ -134,57 +118,6 @@ module Homebrew
EOS
end
def check_for_osx_gcc_installer
return unless MacOS.version < "10.7" || ((MacOS::Xcode.version || "0") > "4.1")
return unless DevelopmentTools.clang_version == "2.1"
fix_advice = if MacOS.version >= :mavericks
"Please run `xcode-select --install` to install the CLT."
elsif MacOS.version >= :lion
"Please install the CLT or Xcode #{MacOS::Xcode.latest_version}."
else
"Please install Xcode #{MacOS::Xcode.latest_version}."
end
<<~EOS
You seem to have osx-gcc-installer installed.
Homebrew doesn't support osx-gcc-installer. It causes many builds to fail and
is an unlicensed distribution of really old Xcode files.
#{fix_advice}
EOS
end
def check_for_stray_developer_directory
# if the uninstaller script isn't there, it's a good guess neither are
# any troublesome leftover Xcode files
uninstaller = Pathname.new("/Developer/Library/uninstall-developer-folder")
return unless ((MacOS::Xcode.version || "0") >= "4.3") && uninstaller.exist?
<<~EOS
You have leftover files from an older version of Xcode.
You should delete them using:
#{uninstaller}
EOS
end
def check_for_bad_install_name_tool
return if MacOS.version < "10.9"
libs = Pathname.new("/usr/bin/install_name_tool").dynamically_linked_libraries
# otool may not work, for example if the Xcode license hasn't been accepted yet
return if libs.empty?
return if libs.include? "/usr/lib/libxcselect.dylib"
<<~EOS
You have an outdated version of /usr/bin/install_name_tool installed.
This will cause binary package installations to fail.
This can happen if you install osx-gcc-installer or RailsInstaller.
To restore it, you must reinstall macOS or restore the binary from
the OS packages.
EOS
end
def check_for_other_package_managers
ponk = MacOS.macports_or_fink
return if ponk.empty?
......@@ -340,33 +273,6 @@ module Homebrew
may not build correctly with a non-/usr/local prefix.
EOS
end
def check_which_pkg_config
binary = which "pkg-config"
return if binary.nil?
mono_config = Pathname.new("/usr/bin/pkg-config")
if mono_config.exist? && mono_config.realpath.to_s.include?("Mono.framework")
<<~EOS
You have a non-Homebrew 'pkg-config' in your PATH:
/usr/bin/pkg-config => #{mono_config.realpath}
This was most likely created by the Mono installer. `./configure` may
have problems finding brew-installed packages using this other pkg-config.
Mono no longer installs this file as of 3.0.4. You should
`sudo rm /usr/bin/pkg-config` and upgrade to the latest version of Mono.
EOS
elsif binary.to_s != "#{HOMEBREW_PREFIX}/bin/pkg-config"
<<~EOS
You have a non-Homebrew 'pkg-config' in your PATH:
#{binary}
`./configure` may have problems finding brew-installed packages using
this other pkg-config.
EOS
end
end
end
end
end
class SystemConfig
class << self
def xcode
if instance_variable_defined?(:@xcode)
@xcode
elsif MacOS::Xcode.installed?
@xcode = MacOS::Xcode.version.to_s
@xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix?
@xcode
@xcode ||= if MacOS::Xcode.installed?
xcode = MacOS::Xcode.version.to_s
xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix?
xcode
end
end
def clt
if instance_variable_defined?(:@clt)
@clt
elsif MacOS::CLT.installed? && MacOS::Xcode.version >= "4.3"
@clt = MacOS::CLT.version
@clt ||= if MacOS::CLT.installed? && MacOS::Xcode.version >= "4.3"
MacOS::CLT.version
end
end
def macports_or_fink
@ponk ||= MacOS.macports_or_fink
@ponk.join(", ") unless @ponk.empty?
def xquartz
@xquartz ||= if MacOS::XQuartz.installed?
"#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}"
end
end
def describe_java
......@@ -36,11 +33,6 @@ class SystemConfig
javas.uniq.join(", ")
end
def describe_xquartz
return "N/A" unless MacOS::XQuartz.installed?
"#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}"
end
def describe_homebrew_ruby
s = describe_homebrew_ruby_version
......@@ -54,10 +46,9 @@ class SystemConfig
def dump_verbose_config(f = $stdout)
dump_generic_verbose_config(f)
f.puts "macOS: #{MacOS.full_version}-#{kernel}"
f.puts "Xcode: #{xcode ? xcode : "N/A"}"
f.puts "CLT: #{clt ? clt : "N/A"}"
f.puts "X11: #{describe_xquartz}"
f.puts "MacPorts/Fink: #{macports_or_fink}" if macports_or_fink
f.puts "Xcode: #{xcode ? xcode : "N/A"}"
f.puts "XQuartz: #{xquartz ? xquartz : "N/A"}"
end
end
end
......@@ -6,22 +6,6 @@ require "development_tools"
class SystemConfig
class << self
def gcc_4_2
@gcc_4_2 ||= if DevelopmentTools.installed?
DevelopmentTools.gcc_4_2_build_version
else
Version::NULL
end
end
def gcc_4_0
@gcc_4_0 ||= if DevelopmentTools.installed?
DevelopmentTools.gcc_4_0_build_version
else
Version::NULL
end
end
def clang
@clang ||= if DevelopmentTools.installed?
DevelopmentTools.clang_version
......@@ -72,42 +56,6 @@ class SystemConfig
end
end
def describe_perl
describe_path(which("perl", ENV["HOMEBREW_PATH"]))
end
def describe_python
python = begin
python_path = PATH.new(ENV["HOMEBREW_PATH"])
.prepend(Formula["python"].opt_libexec/"bin")
which "python", python_path
rescue FormulaUnavailableError
which "python"
end
return "N/A" if python.nil?
python_binary = Utils.popen_read python, "-c", "import sys; sys.stdout.write(sys.executable)"
python_binary = Pathname.new(python_binary).realpath
if python == python_binary
python
else
"#{python} => #{python_binary}"
end
end
def describe_ruby
ruby = which "ruby", ENV["HOMEBREW_PATH"]
return "N/A" if ruby.nil?
ruby_binary = Utils.popen_read ruby, "-rrbconfig", "-e", \
'include RbConfig;print"#{CONFIG["bindir"]}/#{CONFIG["ruby_install_name"]}#{CONFIG["EXEEXT"]}"'
ruby_binary = Pathname.new(ruby_binary).realpath
if ruby == ruby_binary
ruby
else
"#{ruby} => #{ruby_binary}"
end
end
def describe_homebrew_ruby_version
case RUBY_VERSION
when /^1\.[89]/, /^2\.0/
......@@ -212,8 +160,6 @@ class SystemConfig
end
f.puts hardware if hardware
f.puts "Homebrew Ruby: #{describe_homebrew_ruby}"
f.puts "GCC-4.0: build #{gcc_4_0}" unless gcc_4_0.null?
f.puts "GCC-4.2: build #{gcc_4_2}" unless gcc_4_2.null?
f.print "Clang: "
if clang.null?
f.puts "N/A"
......@@ -227,9 +173,6 @@ class SystemConfig
end
f.puts "Git: #{describe_git}"
f.puts "Curl: #{describe_curl}"
f.puts "Perl: #{describe_perl}"
f.puts "Python: #{describe_python}"
f.puts "Ruby: #{describe_ruby}"
f.puts "Java: #{describe_java}"
end
alias dump_generic_verbose_config dump_verbose_config
......
......@@ -12,7 +12,7 @@ GEM
parallel (1.12.1)
parallel_tests (2.21.2)
parallel
parser (2.5.0.2)
parser (2.5.0.5)
ast (~> 2.4.0)
powerpack (0.1.1)
rainbow (3.0.0)
......@@ -36,7 +36,7 @@ GEM
rspec-support (3.7.1)
rspec-wait (0.0.9)
rspec (>= 3, < 4)
rubocop (0.53.0)
rubocop (0.54.0)
parallel (~> 1.10)
parser (>= 2.5)
powerpack (~> 0.1)
......@@ -62,7 +62,7 @@ DEPENDENCIES
rspec-its
rspec-retry
rspec-wait
rubocop (= 0.53.0)
rubocop (= 0.54.0)
simplecov
BUNDLED WITH
......
......@@ -6,12 +6,6 @@ describe Homebrew::Diagnostic::Checks do
expect(subject.inject_file_list(%w[/a /b], "foo:\n")).to eq("foo:\n /a\n /b\n")
end
specify "#check_path_for_trailing_slashes" do
ENV["HOMEBREW_PATH"] += File::PATH_SEPARATOR + "/foo/bar/"
expect(subject.check_path_for_trailing_slashes)
.to match("Some directories in your path end in a slash")
end
specify "#check_build_from_source" do
ENV["HOMEBREW_BUILD_FROM_SOURCE"] = "1"
expect(subject.check_build_from_source)
......
......@@ -22,14 +22,14 @@ describe Homebrew::Diagnostic::Checks do
.to match("The following beta release of XQuartz is installed: 2.7.10_beta2")
end
specify "#check_xcode_8_without_clt_on_el_capitan" do
specify "#check_if_xcode_needs_clt_installed" do
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(:version).and_return("8.0")
allow(MacOS::Xcode).to receive(:without_clt?).and_return(true)
expect(subject.check_xcode_8_without_clt_on_el_capitan)
.to match("You have Xcode 8 installed without the CLT")
expect(subject.check_if_xcode_needs_clt_installed)
.to match("Xcode alone is not sufficient on El Capitan")
end
specify "#check_homebrew_prefix" do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment