Unlink old keg when upgrading dependencies

Installing a formula via `brew install` may trigger upgrades of its
dependencies if the dependencies are installed but outdated. However, we
never unlinked the existing keg in FormulaInstaller#install_dependency
which caused the link step to fail.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2012-01-14 20:03:30 -06:00
parent 8d100a0508
commit 411d15d407
2 changed files with 6 additions and 0 deletions

View File

@ -156,6 +156,11 @@ class Formula
ARGV.formulae.include? self ARGV.formulae.include? self
end end
def linked_keg
keg = Pathname.new(HOMEBREW_REPOSITORY/"Library/LinkedKegs"/@name)
if keg.exist? then Keg.new(keg.realpath) else nil end
end
def installed_prefix def installed_prefix
head_prefix = HOMEBREW_CELLAR+@name+'HEAD' head_prefix = HOMEBREW_CELLAR+@name+'HEAD'
if @version == 'HEAD' || head_prefix.directory? if @version == 'HEAD' || head_prefix.directory?

View File

@ -67,6 +67,7 @@ class FormulaInstaller
fi.show_header = false fi.show_header = false
oh1 "Installing #{f} dependency: #{dep}" oh1 "Installing #{f} dependency: #{dep}"
fi.install fi.install
dep.linked_keg.unlink if dep.linked_keg
fi.caveats fi.caveats
fi.finish fi.finish
end end