upgrade: unlink relative to the correct keg

Calling Keg#unlink on "#{f.rack}/#{f.version}" will perform the unlink
relative to the _new_ keg, rather than the keg we are upgrading from.
Fix this by resolving the linked_keg entry and unlinking relative to it.

Fixes Homebrew/homebrew#10296.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2012-02-20 15:02:32 -06:00
parent 83e9dbf266
commit 86e7c8a772

View File

@ -39,7 +39,7 @@ module Homebrew extend self
installer.show_header = false
oh1 "Upgrading #{f.name}"
installer.install
Keg.new("#{f.rack}/#{f.version}").unlink
Keg.new(f.linked_keg.realpath).unlink if f.linked_keg.directory?
installer.caveats
installer.finish # includes link step
end