diff options
| author | Jack Nagel | 2012-02-09 17:32:41 -0600 |
|---|---|---|
| committer | Mike McQuaid | 2012-02-10 08:57:11 +0000 |
| commit | 2eabe2cbc84649696aeb6fa842a70f3794955597 (patch) | |
| tree | 8a6aeaf5e8b9323f299034127e5c5cc13a1a6853 | |
| parent | 256357b8b5a7e6350d6cdd09f65ab2ad4ad785fa (diff) | |
| download | homebrew-2eabe2cbc84649696aeb6fa842a70f3794955597.tar.bz2 | |
install: unlink old kegs
If a formula makes it all the way to the actual install step, it is safe
to unlink the keg before linking; this will prune dead symlinks in the
case where a keg was removed with `rm -rf <keg>` but not unlinked with
`brew unlink`.
Fixes #10077.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
| -rw-r--r-- | Library/Homebrew/cmd/install.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 5aa198f31..4260eaac9 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -103,6 +103,10 @@ module Homebrew extend self begin fi = FormulaInstaller.new(f) fi.install + # Due to the nature of Keg#unlink, this will remove symlinks from an + # older keg, which may still be present if an uninstallation was done + # via `rm -rf <keg>`; this is desired. + Keg.new("#{f.rack}/#{f.version}").unlink fi.caveats fi.finish rescue FormulaAlreadyInstalledError => e |
