Merge pull request #11540 from MikeMcQuaid/brew_doctor_apple_silicon

diagnostic: hide some warnings on Apple Silicon.
This commit is contained in:
Mike McQuaid 2021-06-16 09:51:43 +01:00 committed by GitHub
commit f18f5e404c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 4 deletions

View File

@ -487,7 +487,16 @@ module Homebrew
#{HOMEBREW_PREFIX}/bin #{HOMEBREW_PREFIX}/sbin
/Applications/Server.app/Contents/ServerRoot/usr/bin
/Applications/Server.app/Contents/ServerRoot/usr/sbin
].map(&:downcase)
]
if OS.mac? && Hardware::CPU.physical_cpu_arm64?
allowlist += %W[
#{HOMEBREW_MACOS_ARM_DEFAULT_PREFIX}/bin
#{HOMEBREW_MACOS_ARM_DEFAULT_PREFIX}/sbin
#{HOMEBREW_DEFAULT_PREFIX}/bin
#{HOMEBREW_DEFAULT_PREFIX}/sbin
]
end
allowlist.map!(&:downcase)
paths.each do |p|
next if allowlist.include?(p.downcase) || !File.directory?(p)

View File

@ -316,10 +316,18 @@ module Homebrew
end
if gettext&.linked_keg&.directory?
homebrew_owned = @found.all? do |path|
Pathname.new(path).realpath.to_s.start_with? "#{HOMEBREW_CELLAR}/gettext"
allowlist = ["#{HOMEBREW_CELLAR}/gettext"]
if Hardware::CPU.physical_cpu_arm64?
allowlist += %W[
#{HOMEBREW_MACOS_ARM_DEFAULT_PREFIX}/Cellar/gettext
#{HOMEBREW_DEFAULT_PREFIX}/Cellar/gettext
]
end
return if @found.all? do |path|
realpath = Pathname.new(path).realpath.to_s
allowlist.any? { |rack| realpath.start_with?(rack) }
end
return if homebrew_owned
end
inject_file_list @found, <<~EOS