aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2013-01-07 17:50:23 -0600
committerJack Nagel2013-01-08 11:03:13 -0600
commit30dc1bea9adae95d5c19045ffc3d67cc8b1e1eea (patch)
tree9827388e4ac48ac49fd64e63da8b81ae7ff94e1e
parent3a8e95c5260d6615c0795a75084dcd447a630583 (diff)
downloadhomebrew-30dc1bea9adae95d5c19045ffc3d67cc8b1e1eea.tar.bz2
Prune LinkedKegs relative to correct path
Fixes #16948.
-rw-r--r--Library/Homebrew/cmd/doctor.rb2
-rw-r--r--Library/Homebrew/cmd/prune.rb2
-rw-r--r--Library/Homebrew/keg.rb4
3 files changed, 5 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 752f80930..76f35bb12 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -202,7 +202,7 @@ end
def check_for_broken_symlinks
require 'keg'
broken_symlinks = []
- Keg::PRUNEABLE_DIRECTORIES.map { |d| HOMEBREW_PREFIX/d }.each do |d|
+ Keg::PRUNEABLE_DIRECTORIES.each do |d|
next unless d.directory?
d.find do |pn|
broken_symlinks << pn if pn.symlink? and pn.readlink.expand_path.to_s =~ /^#{HOMEBREW_PREFIX}/ and not pn.exist?
diff --git a/Library/Homebrew/cmd/prune.rb b/Library/Homebrew/cmd/prune.rb
index 394b8ad7f..29e57ee3e 100644
--- a/Library/Homebrew/cmd/prune.rb
+++ b/Library/Homebrew/cmd/prune.rb
@@ -9,7 +9,7 @@ module Homebrew extend self
$d = 0
dirs = []
- Keg::PRUNEABLE_DIRECTORIES.map{ |d| HOMEBREW_PREFIX/d }.each do |path|
+ Keg::PRUNEABLE_DIRECTORIES.each do |path|
next unless path.directory?
path.find do |path|
path.extend ObserverPathnameExtension
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index 0560b6f26..3a4d01262 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -11,7 +11,9 @@ class Keg < Pathname
LOCALEDIR_RX = /(locale|man)\/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?/
INFOFILE_RX = %r[info/([^.].*?\.info|dir)$]
TOP_LEVEL_DIRECTORIES = %w[bin etc include lib sbin share var Frameworks]
- PRUNEABLE_DIRECTORIES = %w[bin etc include lib sbin share Frameworks Library/LinkedKegs]
+ PRUNEABLE_DIRECTORIES = %w[bin etc include lib sbin share Frameworks LinkedKegs].map do |d|
+ case d when 'LinkedKegs' then HOMEBREW_LIBRARY/d else HOMEBREW_PREFIX/d end
+ end
# if path is a file in a keg then this will return the containing Keg object
def self.for path