diff options
| -rw-r--r-- | Library/Homebrew/diagnostic.rb | 77 | ||||
| -rw-r--r-- | Library/Homebrew/extend/os/mac/diagnostic.rb | 71 | ||||
| -rw-r--r-- | Library/Homebrew/test/diagnostic_spec.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/test/os/mac/diagnostic_spec.rb | 6 |
4 files changed, 77 insertions, 84 deletions
diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index e34e89fe1..5aa4d788b 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -415,23 +415,6 @@ module Homebrew EOS end - def check_homebrew_prefix - return if HOMEBREW_PREFIX.to_s == "/usr/local" - - # Allow our Jenkins CI tests to live outside of /usr/local. - if ENV["JENKINS_HOME"] && - ENV["GIT_URL"].to_s.start_with?("https://github.com/Homebrew/brew") - return - end - - <<-EOS.undent - Your Homebrew's prefix is not /usr/local. - You can install Homebrew anywhere you want but some bottles (binary packages) - can only be used with a /usr/local prefix and some formulae (packages) - may not build correctly with a non-/usr/local prefix. - EOS - end - def check_user_path_1 $seen_prefix_bin = false $seen_prefix_sbin = false @@ -513,33 +496,6 @@ module Homebrew 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.undent - 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.undent - 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 - def check_for_gettext find_relative_paths("lib/libgettextlib.dylib", "lib/libintl.dylib", @@ -716,39 +672,6 @@ module Homebrew EOS end - def check_filesystem_case_sensitive - dirs_to_check = [ - HOMEBREW_PREFIX, - HOMEBREW_REPOSITORY, - HOMEBREW_CELLAR, - HOMEBREW_TEMP, - ] - case_sensitive_dirs = dirs_to_check.select do |dir| - # We select the dir as being case-sensitive if either the UPCASED or the - # downcased variant is missing. - # Of course, on a case-insensitive fs, both exist because the os reports so. - # In the rare situation when the user has indeed a downcased and an upcased - # dir (e.g. /TMP and /tmp) this check falsely thinks it is case-insensitive - # but we don't care because: 1. there is more than one dir checked, 2. the - # check is not vital and 3. we would have to touch files otherwise. - upcased = Pathname.new(dir.to_s.upcase) - downcased = Pathname.new(dir.to_s.downcase) - dir.exist? && !(upcased.exist? && downcased.exist?) - end - return if case_sensitive_dirs.empty? - - volumes = Volumes.new - case_sensitive_vols = case_sensitive_dirs.map do |case_sensitive_dir| - volumes.get_mounts(case_sensitive_dir) - end - case_sensitive_vols.uniq! - - <<-EOS.undent - The filesystem on #{case_sensitive_vols.join(",")} appears to be case-sensitive. - The default macOS filesystem is case-insensitive. Please report any apparent problems. - EOS - end - def check_git_version # https://help.github.com/articles/https-cloning-errors return unless Utils.git_available? diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index ff936c75a..58d8c633d 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -307,6 +307,77 @@ module Homebrew We recommend only installing stable releases of XQuartz. EOS end + + def check_filesystem_case_sensitive + dirs_to_check = [ + HOMEBREW_PREFIX, + HOMEBREW_REPOSITORY, + HOMEBREW_CELLAR, + HOMEBREW_TEMP, + ] + case_sensitive_dirs = dirs_to_check.select do |dir| + # We select the dir as being case-sensitive if either the UPCASED or the + # downcased variant is missing. + # Of course, on a case-insensitive fs, both exist because the os reports so. + # In the rare situation when the user has indeed a downcased and an upcased + # dir (e.g. /TMP and /tmp) this check falsely thinks it is case-insensitive + # but we don't care because: 1. there is more than one dir checked, 2. the + # check is not vital and 3. we would have to touch files otherwise. + upcased = Pathname.new(dir.to_s.upcase) + downcased = Pathname.new(dir.to_s.downcase) + dir.exist? && !(upcased.exist? && downcased.exist?) + end + return if case_sensitive_dirs.empty? + + volumes = Volumes.new + case_sensitive_vols = case_sensitive_dirs.map do |case_sensitive_dir| + volumes.get_mounts(case_sensitive_dir) + end + case_sensitive_vols.uniq! + + <<-EOS.undent + The filesystem on #{case_sensitive_vols.join(",")} appears to be case-sensitive. + The default macOS filesystem is case-insensitive. Please report any apparent problems. + EOS + end + + def check_homebrew_prefix + return if HOMEBREW_PREFIX.to_s == "/usr/local" + + <<-EOS.undent + Your Homebrew's prefix is not /usr/local. + You can install Homebrew anywhere you want but some bottles (binary packages) + can only be used with a /usr/local prefix and some formulae (packages) + 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.undent + 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.undent + 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 diff --git a/Library/Homebrew/test/diagnostic_spec.rb b/Library/Homebrew/test/diagnostic_spec.rb index c4373671e..058b9823c 100644 --- a/Library/Homebrew/test/diagnostic_spec.rb +++ b/Library/Homebrew/test/diagnostic_spec.rb @@ -90,13 +90,6 @@ describe Homebrew::Diagnostic::Checks do end end - specify "#check_homebrew_prefix" do - ENV.delete("JENKINS_HOME") - # the integration tests are run in a special prefix - expect(subject.check_homebrew_prefix) - .to match("Your Homebrew's prefix is not /usr/local.") - end - specify "#check_user_path_1" do bin = HOMEBREW_PREFIX/"bin" sep = File::PATH_SEPARATOR diff --git a/Library/Homebrew/test/os/mac/diagnostic_spec.rb b/Library/Homebrew/test/os/mac/diagnostic_spec.rb index d2b38a332..787f80fec 100644 --- a/Library/Homebrew/test/os/mac/diagnostic_spec.rb +++ b/Library/Homebrew/test/os/mac/diagnostic_spec.rb @@ -39,4 +39,10 @@ describe Homebrew::Diagnostic::Checks do expect(subject.check_xcode_8_without_clt_on_el_capitan) .to match("You have Xcode 8 installed without the CLT") end + + specify "#check_homebrew_prefix" do + # the integration tests are run in a special prefix + expect(subject.check_homebrew_prefix) + .to match("Your Homebrew's prefix is not /usr/local.") + end end |
