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
commit3e4335894d32b39119f6f02b9f0106f73c3ac6ef (patch)
tree4ecf7de3ef4c926689071c640159b21c1e92c29a /Library
parentba5ed2d1556b944db119b251f9763eb2a5311ada (diff)
downloadhomebrew-3e4335894d32b39119f6f02b9f0106f73c3ac6ef.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