Skip to content

Commit f238d3b

Browse files
authored
Merge pull request #20151 from Homebrew/fix-doctor-linux
Fix `brew doctor` cask handling on Linux
2 parents 44dcb58 + e1873d3 commit f238d3b

3 files changed

Lines changed: 42 additions & 28 deletions

File tree

Library/Homebrew/diagnostic.rb

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -908,24 +908,21 @@ def check_for_unnecessary_cask_tap
908908
EOS
909909
end
910910

911+
def check_deprecated_cask_taps
912+
tapped_caskroom_taps = ::Tap.select { |t| t.user == "caskroom" || t.name == "phinze/cask" }
913+
.map(&:name)
914+
return if tapped_caskroom_taps.empty?
915+
916+
<<~EOS
917+
You have the following deprecated Cask taps installed:
918+
#{tapped_caskroom_taps.join("\n ")}
919+
Please remove them with:
920+
brew untap #{tapped_caskroom_taps.join(" ")}
921+
EOS
922+
end
923+
911924
def check_cask_software_versions
912925
add_info "Homebrew Version", HOMEBREW_VERSION
913-
add_info "macOS", MacOS.full_version
914-
add_info "SIP", begin
915-
csrutil = "/usr/bin/csrutil"
916-
if File.executable?(csrutil)
917-
Open3.capture2(csrutil, "status")
918-
.first
919-
.gsub("This is an unsupported configuration, likely to break in " \
920-
"the future and leave your machine in an unknown state.", "")
921-
.gsub("System Integrity Protection status: ", "")
922-
.delete("\t.")
923-
.capitalize
924-
.strip
925-
else
926-
"N/A"
927-
end
928-
end
929926

930927
nil
931928
end

Library/Homebrew/extend/os/linux/diagnostic.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ def check_gcc_dependent_linkage
189189
are prone to breaking when GCC is updated. You should `brew reinstall` these formulae:
190190
EOS
191191
end
192+
193+
def check_cask_software_versions
194+
super
195+
add_info "Linux", OS::Linux.os_version
196+
197+
nil
198+
end
192199
end
193200
end
194201
end

Library/Homebrew/extend/os/mac/diagnostic.rb

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -424,18 +424,6 @@ def check_for_multiple_volumes
424424
EOS
425425
end
426426

427-
def check_deprecated_caskroom_taps
428-
tapped_caskroom_taps = ::Tap.select { |t| t.user == "caskroom" || t.name == "phinze/cask" }
429-
.map(&:name)
430-
return if tapped_caskroom_taps.empty?
431-
432-
<<~EOS
433-
You have the following deprecated, cask taps tapped:
434-
#{tapped_caskroom_taps.join("\n ")}
435-
Untap them with `brew untap`.
436-
EOS
437-
end
438-
439427
def check_if_supported_sdk_available
440428
return unless ::DevelopmentTools.installed?
441429
return unless MacOS.sdk_root_needed?
@@ -496,6 +484,28 @@ def check_broken_sdks
496484
#{installation_instructions}
497485
EOS
498486
end
487+
488+
def check_cask_software_versions
489+
super
490+
add_info "macOS", MacOS.full_version
491+
add_info "SIP", begin
492+
csrutil = "/usr/bin/csrutil"
493+
if File.executable?(csrutil)
494+
Open3.capture2(csrutil, "status")
495+
.first
496+
.gsub("This is an unsupported configuration, likely to break in " \
497+
"the future and leave your machine in an unknown state.", "")
498+
.gsub("System Integrity Protection status: ", "")
499+
.delete("\t.")
500+
.capitalize
501+
.strip
502+
else
503+
"N/A"
504+
end
505+
end
506+
507+
nil
508+
end
499509
end
500510
end
501511
end

0 commit comments

Comments
 (0)