Prune LinkedKegs relative to correct path

Fixes Homebrew/homebrew#16948.
This commit is contained in:
Jack Nagel 2013-01-07 17:50:23 -06:00
parent c2fd7856d2
commit e3068f631a
3 changed files with 5 additions and 3 deletions

View File

@ -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?

View File

@ -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

View File

@ -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