Fix linked keg-only check when only directories are linked
This commit is contained in:
parent
aad4ed7faa
commit
c4dfacaf0c
@ -913,38 +913,25 @@ def check_for_autoconf
|
|||||||
end
|
end
|
||||||
|
|
||||||
def __check_linked_brew f
|
def __check_linked_brew f
|
||||||
links_found = []
|
|
||||||
|
|
||||||
prefix = f.prefix
|
prefix = f.prefix
|
||||||
|
|
||||||
prefix.find do |src|
|
prefix.find do |src|
|
||||||
next if src == prefix
|
next if src == prefix
|
||||||
dst = HOMEBREW_PREFIX + src.relative_path_from(prefix)
|
dst = HOMEBREW_PREFIX + src.relative_path_from(prefix)
|
||||||
|
return true if dst.symlink? && src == dst.resolved_path
|
||||||
next if !dst.symlink? || !dst.exist? || src != dst.resolved_path
|
|
||||||
|
|
||||||
if src.directory?
|
|
||||||
Find.prune
|
|
||||||
else
|
|
||||||
links_found << dst
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return links_found
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_for_linked_keg_only_brews
|
def check_for_linked_keg_only_brews
|
||||||
return unless HOMEBREW_CELLAR.exist?
|
return unless HOMEBREW_CELLAR.exist?
|
||||||
|
|
||||||
warnings = Hash.new
|
linked = Formula.select { |f|
|
||||||
|
f.keg_only? && f.installed? && __check_linked_brew(f)
|
||||||
|
}
|
||||||
|
|
||||||
Formula.each do |f|
|
unless linked.empty?
|
||||||
next unless f.keg_only? and f.installed?
|
|
||||||
links = __check_linked_brew f
|
|
||||||
warnings[f.full_name] = links unless links.empty?
|
|
||||||
end
|
|
||||||
|
|
||||||
unless warnings.empty?
|
|
||||||
s = <<-EOS.undent
|
s = <<-EOS.undent
|
||||||
Some keg-only formula are linked into the Cellar.
|
Some keg-only formula are linked into the Cellar.
|
||||||
Linking a keg-only formula, such as gettext, into the cellar with
|
Linking a keg-only formula, such as gettext, into the cellar with
|
||||||
@ -958,7 +945,7 @@ def check_for_linked_keg_only_brews
|
|||||||
You may wish to `brew unlink` these brews:
|
You may wish to `brew unlink` these brews:
|
||||||
|
|
||||||
EOS
|
EOS
|
||||||
warnings.each_key { |f| s << " #{f}\n" }
|
linked.each { |f| s << " #{f.full_name}\n" }
|
||||||
s
|
s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user