aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2015-09-11 16:32:14 +0800
committerXu Cheng2015-09-11 18:32:35 +0800
commit5241932b45d8d0897cb1af0f9c6dccf6c2250d29 (patch)
tree05e116814854743722ec65e1d70d44a2501ae6f6 /Library
parent6d6daae0506d35193d7032eaf87982bdb5b421f8 (diff)
downloadbrew-5241932b45d8d0897cb1af0f9c6dccf6c2250d29.tar.bz2
keg_relocate: fix absolute symlink
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/keg_relocate.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb
index f0d6abefe..963f219ba 100644
--- a/Library/Homebrew/keg_relocate.rb
+++ b/Library/Homebrew/keg_relocate.rb
@@ -16,6 +16,15 @@ class Keg
end
end
end
+
+ symlink_files.each do |file|
+ link = file.readlink
+ # Don't fix relative symlinks
+ next unless link.absolute?
+ if link.to_s.start_with?(HOMEBREW_CELLAR.to_s) || link.to_s.start_with?(HOMEBREW_PREFIX.to_s)
+ FileUtils.ln_sf(link.relative_path_from(file.parent), file)
+ end
+ end
end
def relocate_install_names(old_prefix, new_prefix, old_cellar, new_cellar, options = {})
@@ -184,4 +193,13 @@ class Keg
end if lib.directory?
libtool_files
end
+
+ def symlink_files
+ symlink_files = []
+ path.find do |pn|
+ symlink_files << pn if pn.symlink?
+ end
+
+ symlink_files
+ end
end