Use correct basename when updating dylib IDs

This commit is contained in:
Jack Nagel 2014-04-13 13:53:46 -05:00
parent dfddb2a761
commit 169aa1ac39

View File

@ -130,14 +130,16 @@ class Keg < Pathname
end end
def dylib_id_for file, options={} def dylib_id_for file, options={}
# the shortpath ensures that library upgrades dont break installed tools # The new dylib ID should have the same basename as the old dylib ID, not
relative_path = file.relative_path_from(self) # the basename of the file itself.
shortpath = HOMEBREW_PREFIX.join(relative_path) basename = File.basename(file.dylib_id)
relative_dirname = file.dirname.relative_path_from(self)
shortpath = HOMEBREW_PREFIX.join(relative_dirname, basename)
if shortpath.exist? and not options[:keg_only] if shortpath.exist? and not options[:keg_only]
shortpath.to_s shortpath.to_s
else else
"#{HOMEBREW_PREFIX}/opt/#{fname}/#{relative_path}" "#{HOMEBREW_PREFIX}/opt/#{fname}/#{relative_dirname}/#{basename}"
end end
end end