diff options
| author | Jack Nagel | 2012-12-17 17:05:53 -0600 |
|---|---|---|
| committer | Jack Nagel | 2012-12-17 17:18:22 -0600 |
| commit | 3dcce70a6af0a187f6c30e66cef45bee3cae6a6f (patch) | |
| tree | 5ff5af6efba3b34be927cb62b54be2cfedd90eb3 /Library/Homebrew | |
| parent | 68d1dfe5d77781e74cab72f0950484ae58d5e425 (diff) | |
| download | brew-3dcce70a6af0a187f6c30e66cef45bee3cae6a6f.tar.bz2 | |
Better reporting for MacPorts/Fink installations
closes Homebrew/homebrew#15853.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/cmd/--config.rb | 11 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/doctor.rb | 11 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/install.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/compat/compatibility.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/macos.rb | 47 |
5 files changed, 43 insertions, 32 deletions
diff --git a/Library/Homebrew/cmd/--config.rb b/Library/Homebrew/cmd/--config.rb index 342d837f0..ac113c885 100644 --- a/Library/Homebrew/cmd/--config.rb +++ b/Library/Homebrew/cmd/--config.rb @@ -85,6 +85,11 @@ module Homebrew extend self `uname -m`.chomp end + def macports_or_fink + @ponk ||= MacOS.macports_or_fink + @ponk.join(", ") unless @ponk.empty? + end + # we try to keep output minimal def dump_build_config puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}" @@ -104,8 +109,7 @@ module Homebrew extend self puts "Clang: #{clang ? "#{clang} build #{clang_build}" : "N/A"}" end - ponk = macports_or_fink_installed? - puts "MacPorts/Fink: #{ponk}" if ponk + puts "MacPorts/Fink: #{macports_or_fink}" if macports_or_fink puts "X11: #{describe_x11}" end @@ -131,8 +135,7 @@ module Homebrew extend self puts "GCC-4.2: build #{gcc_42}" if gcc_42 puts "LLVM-GCC: #{llvm ? "build #{llvm}" : "N/A"}" puts "Clang: #{clang ? "#{clang} build #{clang_build}" : "N/A"}" - ponk = macports_or_fink_installed? - puts "MacPorts or Fink? #{ponk}" if ponk + puts "MacPorts/Fink: #{macports_or_fink}" if macports_or_fink puts "X11: #{describe_x11}" puts "System Ruby: #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}" puts "Perl: #{describe_perl}" diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 79091b7db..fc8b637ba 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -184,11 +184,14 @@ def check_for_stray_las end def check_for_other_package_managers - if macports_or_fink_installed? + ponk = MacOS.macports_or_fink + unless ponk.empty? <<-EOS.undent - You have Macports or Fink installed. - This can cause trouble. You don't have to uninstall them, but you may like to - try temporarily moving them away, eg. + You have MacPorts or Fink installed: + #{ponk.join(", ")} + + This can cause trouble. You don't have to uninstall them, but you may want to + temporarily move them out of the way, e.g. sudo mv /opt/local ~/macports EOS diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index ad5420df1..34114e4ae 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -49,7 +49,7 @@ module Homebrew extend self end def check_macports - if MacOS.macports_or_fink_installed? + unless MacOS.macports_or_fink.empty? opoo "It appears you have MacPorts or Fink installed." puts "Software installed with other package managers causes known problems for" puts "Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again." diff --git a/Library/Homebrew/compat/compatibility.rb b/Library/Homebrew/compat/compatibility.rb index 41874e063..f0d6ab0b1 100644 --- a/Library/Homebrew/compat/compatibility.rb +++ b/Library/Homebrew/compat/compatibility.rb @@ -219,6 +219,10 @@ module MacOS extend self 10.8 <= MACOS_VERSION # Actually Mountain Lion or newer end alias_method :mountain_lion_or_newer?, :mountain_lion? + + def macports_or_fink_installed? + not MacOS.macports_or_fink.empty? + end end diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index 321162699..fe9829a9b 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -137,36 +137,37 @@ module MacOS extend self end end - def macports_or_fink_installed? - # See these issues for some history: - # http://github.com/mxcl/homebrew/issues/#issue/13 - # http://github.com/mxcl/homebrew/issues/#issue/41 - # http://github.com/mxcl/homebrew/issues/#issue/48 - return false unless MACOS - - %w[port fink].each do |ponk| + # See these issues for some history: + # http://github.com/mxcl/homebrew/issues/#issue/13 + # http://github.com/mxcl/homebrew/issues/#issue/41 + # http://github.com/mxcl/homebrew/issues/#issue/48 + def macports_or_fink + paths = [] + + # First look in the path because MacPorts is relocatable and Fink + # may become relocatable in the future. + %w{port fink}.each do |ponk| path = which(ponk) - return ponk unless path.nil? + paths << path unless path.nil? end - # we do the above check because macports can be relocated and fink may be - # able to be relocated in the future. This following check is because if - # fink and macports are not in the PATH but are still installed it can - # *still* break the build -- because some build scripts hardcode these paths: - %w[/sw/bin/fink /opt/local/bin/port].each do |ponk| - return ponk if File.exist? ponk + # Look in the standard locations, because even if port or fink are + # not in the path they can still break builds if the build scripts + # have these paths baked in. + %w{/sw/bin/fink /opt/local/bin/port}.each do |ponk| + path = Pathname.new(ponk) + paths << path if path.exist? end - # finally, sometimes people make their MacPorts or Fink read-only so they - # can quickly test Homebrew out, but still in theory obey the README's - # advise to rename the root directory. This doesn't work, many build scripts - # error out when they try to read from these now unreadable directories. - %w[/sw /opt/local].each do |path| - path = Pathname.new(path) - return path if path.exist? and not path.readable? + # Finally, some users make their MacPorts or Fink directorie + # read-only in order to try out Homebrew, but this doens't work as + # some build scripts error out when trying to read from these now + # unreadable paths. + %w{/sw /opt/local}.map { |p| Pathname.new(p) }.each do |path| + paths << path if path.exist? && !path.readable? end - false + paths.uniq end def prefer_64_bit? |
