Skip to content
Snippets Groups Projects
Commit d84655ef authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #2442 from tdsmith/fix-symlink-relocation

Virtualenv relocation fixes
parents 1a87964e 2144c355
No related branches found
No related tags found
No related merge requests found
...@@ -125,6 +125,12 @@ class Keg ...@@ -125,6 +125,12 @@ class Keg
mach_o_files mach_o_files
end end
def recursive_fgrep_args
# Don't recurse into symlinks; the man page says this is the default, but
# it's wrong. -O is a BSD-grep-only option.
"-lrO"
end
def self.file_linked_libraries(file, string) def self.file_linked_libraries(file, string)
# Check dynamic library linkage. Importantly, do not perform for static # Check dynamic library linkage. Importantly, do not perform for static
# libraries, which will falsely report "linkage" to themselves. # libraries, which will falsely report "linkage" to themselves.
......
...@@ -16,9 +16,12 @@ class Keg ...@@ -16,9 +16,12 @@ class Keg
link = file.readlink link = file.readlink
# Don't fix relative symlinks # Don't fix relative symlinks
next unless link.absolute? next unless link.absolute?
if link.to_s.start_with?(HOMEBREW_CELLAR.to_s) || link.to_s.start_with?(HOMEBREW_PREFIX.to_s) link_starts_cellar = link.to_s.start_with?(HOMEBREW_CELLAR.to_s)
FileUtils.ln_sf(link.relative_path_from(file.parent), file) link_starts_prefix = link.to_s.start_with?(HOMEBREW_PREFIX.to_s)
end next if !link_starts_cellar && !link_starts_prefix
new_src = link.relative_path_from(file.parent)
file.unlink
FileUtils.ln_s(new_src, file)
end end
end end
alias generic_fix_dynamic_linkage fix_dynamic_linkage alias generic_fix_dynamic_linkage fix_dynamic_linkage
...@@ -96,8 +99,14 @@ class Keg ...@@ -96,8 +99,14 @@ class Keg
[] []
end end
def recursive_fgrep_args
# for GNU grep; overridden for BSD grep on OS X
"-lr"
end
alias generic_recursive_fgrep_args recursive_fgrep_args
def each_unique_file_matching(string) def each_unique_file_matching(string)
Utils.popen_read("/usr/bin/fgrep", "-lr", string, to_s) do |io| Utils.popen_read("/usr/bin/fgrep", recursive_fgrep_args, string, to_s) do |io|
hardlinks = Set.new hardlinks = Set.new
until io.eof? until io.eof?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment