formula: realpath prefix before computing abv

versioned prefix is a directory, but unversioned is a symlink, so
realpath it before computing abv
This commit is contained in:
ilovezfs 2017-01-04 10:23:15 -08:00
parent 98dadd907e
commit 6195d6592b

View File

@ -553,7 +553,7 @@ class Formula
# called from within the same formula's {#install} or {#post_install} methods.
# Otherwise, return the full path to the formula's versioned cellar.
def prefix(v = pkg_version)
prefix = rack/v
prefix = FormulaPrefixPathname.new(rack/v)
if !@versioned_prefix && prefix.directory? && Keg.new(prefix).optlinked?
opt_prefix
else
@ -938,7 +938,7 @@ class Formula
# formula, as the path is stable even when the software is updated.
# <pre>args << "--with-readline=#{Formula["readline"].opt_prefix}" if build.with? "readline"</pre>
def opt_prefix
Pathname.new("#{HOMEBREW_PREFIX}/opt/#{name}")
FormulaPrefixPathname.new("#{HOMEBREW_PREFIX}/opt/#{name}")
end
def opt_bin
@ -2423,4 +2423,10 @@ class Formula
@link_overwrite_paths ||= Set.new
end
end
class FormulaPrefixPathname < Pathname
def abv
Pathname.new(realpath).abv
end
end
end