Merge pull request #20151 from Homebrew/fix-doctor-linux

Fix `brew doctor` cask handling on Linux
This commit is contained in:
Rylan Polster 2025-06-22 10:10:28 +00:00 committed by GitHub
commit f238d3b494
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 42 additions and 28 deletions

View File

@ -908,24 +908,21 @@ module Homebrew
EOS EOS
end end
def check_deprecated_cask_taps
tapped_caskroom_taps = ::Tap.select { |t| t.user == "caskroom" || t.name == "phinze/cask" }
.map(&:name)
return if tapped_caskroom_taps.empty?
<<~EOS
You have the following deprecated Cask taps installed:
#{tapped_caskroom_taps.join("\n ")}
Please remove them with:
brew untap #{tapped_caskroom_taps.join(" ")}
EOS
end
def check_cask_software_versions def check_cask_software_versions
add_info "Homebrew Version", HOMEBREW_VERSION add_info "Homebrew Version", HOMEBREW_VERSION
add_info "macOS", MacOS.full_version
add_info "SIP", begin
csrutil = "/usr/bin/csrutil"
if File.executable?(csrutil)
Open3.capture2(csrutil, "status")
.first
.gsub("This is an unsupported configuration, likely to break in " \
"the future and leave your machine in an unknown state.", "")
.gsub("System Integrity Protection status: ", "")
.delete("\t.")
.capitalize
.strip
else
"N/A"
end
end
nil nil
end end

View File

@ -189,6 +189,13 @@ module OS
are prone to breaking when GCC is updated. You should `brew reinstall` these formulae: are prone to breaking when GCC is updated. You should `brew reinstall` these formulae:
EOS EOS
end end
def check_cask_software_versions
super
add_info "Linux", OS::Linux.os_version
nil
end
end end
end end
end end

View File

@ -424,18 +424,6 @@ module OS
EOS EOS
end end
def check_deprecated_caskroom_taps
tapped_caskroom_taps = ::Tap.select { |t| t.user == "caskroom" || t.name == "phinze/cask" }
.map(&:name)
return if tapped_caskroom_taps.empty?
<<~EOS
You have the following deprecated, cask taps tapped:
#{tapped_caskroom_taps.join("\n ")}
Untap them with `brew untap`.
EOS
end
def check_if_supported_sdk_available def check_if_supported_sdk_available
return unless ::DevelopmentTools.installed? return unless ::DevelopmentTools.installed?
return unless MacOS.sdk_root_needed? return unless MacOS.sdk_root_needed?
@ -496,6 +484,28 @@ module OS
#{installation_instructions} #{installation_instructions}
EOS EOS
end end
def check_cask_software_versions
super
add_info "macOS", MacOS.full_version
add_info "SIP", begin
csrutil = "/usr/bin/csrutil"
if File.executable?(csrutil)
Open3.capture2(csrutil, "status")
.first
.gsub("This is an unsupported configuration, likely to break in " \
"the future and leave your machine in an unknown state.", "")
.gsub("System Integrity Protection status: ", "")
.delete("\t.")
.capitalize
.strip
else
"N/A"
end
end
nil
end
end end
end end
end end