upgrade: use standard Tab accessor

Yes, the formula object does refer to a version that has not yet been
installed, but we were not looking into Formula#prefix, but #linked_keg,
which is version agnostic (since the original patch was committed, we
Tab#for_formula learned to look into #opt_prefix as well). The rest of
the logic is already embedded in the Tab accessors.
This commit is contained in:
Jack Nagel 2013-01-23 00:26:31 -06:00
parent 8d03c760c2
commit 5ac4e4f071

View File

@ -43,10 +43,7 @@ module Homebrew extend self
end
def upgrade_formula f
# Generate using `for_keg` since the formula object points to a newer version
# that doesn't exist yet. Use `opt_prefix` to guard against keg-only installs.
# Also, guard against old installs that may not have an `opt_prefix` symlink.
tab = (f.opt_prefix.exist? ? Tab.for_keg(f.opt_prefix) : Tab.dummy_tab(f))
tab = Tab.for_formula(f)
outdated_keg = Keg.new(f.linked_keg.realpath) rescue nil
installer = FormulaInstaller.new(f)