aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-01-14 20:03:30 -0600
committerJack Nagel2012-01-15 17:18:17 -0600
commit411d15d40754d1630ba974026d85f7df38f88e90 (patch)
treeaac0e76241085102ee69bbf1b423009c879e252e /Library
parent8d100a0508f201417784553b4738262ccad448cb (diff)
downloadbrew-411d15d40754d1630ba974026d85f7df38f88e90.tar.bz2
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>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb5
-rw-r--r--Library/Homebrew/formula_installer.rb1
2 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 9b3c0ac5f..4256cfb77 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -156,6 +156,11 @@ class Formula
ARGV.formulae.include? self
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
head_prefix = HOMEBREW_CELLAR+@name+'HEAD'
if @version == 'HEAD' || head_prefix.directory?
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index c2c04c8f3..deee2b956 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -67,6 +67,7 @@ class FormulaInstaller
fi.show_header = false
oh1 "Installing #{f} dependency: #{dep}"
fi.install
+ dep.linked_keg.unlink if dep.linked_keg
fi.caveats
fi.finish
end