Merge pull request #5366 from sjackman/bottle
bottle: Skip matches to files in build deps
This commit is contained in:
		
						commit
						704e8570e5
					
				| @ -134,7 +134,7 @@ module Homebrew | |||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def keg_contain?(string, keg, ignores) |   def keg_contain?(string, keg, ignores, formula_and_runtime_deps_names = nil) | ||||||
|     @put_string_exists_header, @put_filenames = nil |     @put_string_exists_header, @put_filenames = nil | ||||||
| 
 | 
 | ||||||
|     print_filename = lambda do |str, filename| |     print_filename = lambda do |str, filename| | ||||||
| @ -178,6 +178,19 @@ module Homebrew | |||||||
|           offset, match = str.split(" ", 2) |           offset, match = str.split(" ", 2) | ||||||
|           next if linked_libraries.include? match # Don't bother reporting a string if it was found by otool |           next if linked_libraries.include? match # Don't bother reporting a string if it was found by otool | ||||||
| 
 | 
 | ||||||
|  |           # Do not report matches to files that do not exist. | ||||||
|  |           next unless File.exist? match | ||||||
|  | 
 | ||||||
|  |           # Do not report matches to build dependencies. | ||||||
|  |           if formula_and_runtime_deps_names.present? | ||||||
|  |             begin | ||||||
|  |               keg_name = Keg.for(Pathname.new(match)).name | ||||||
|  |               next unless formula_and_runtime_deps_names.include? keg_name | ||||||
|  |             rescue NotAKegError | ||||||
|  |               nil | ||||||
|  |             end | ||||||
|  |           end | ||||||
|  | 
 | ||||||
|           result = true |           result = true | ||||||
|           text_matches << [match, offset] |           text_matches << [match, offset] | ||||||
|         end |         end | ||||||
| @ -272,6 +285,7 @@ module Homebrew | |||||||
| 
 | 
 | ||||||
|     ohai "Bottling #{filename}..." |     ohai "Bottling #{filename}..." | ||||||
| 
 | 
 | ||||||
|  |     formula_and_runtime_deps_names = [f.name] + f.runtime_dependencies.map(&:name) | ||||||
|     keg = Keg.new(f.prefix) |     keg = Keg.new(f.prefix) | ||||||
|     relocatable = false |     relocatable = false | ||||||
|     skip_relocation = false |     skip_relocation = false | ||||||
| @ -342,9 +356,9 @@ module Homebrew | |||||||
|         if args.skip_relocation? |         if args.skip_relocation? | ||||||
|           skip_relocation = true |           skip_relocation = true | ||||||
|         else |         else | ||||||
|           relocatable = false if keg_contain?(prefix_check, keg, ignores) |           relocatable = false if keg_contain?(prefix_check, keg, ignores, formula_and_runtime_deps_names) | ||||||
|           relocatable = false if keg_contain?(repository, keg, ignores) |           relocatable = false if keg_contain?(repository, keg, ignores) | ||||||
|           relocatable = false if keg_contain?(cellar, keg, ignores) |           relocatable = false if keg_contain?(cellar, keg, ignores, formula_and_runtime_deps_names) | ||||||
|           if prefix != prefix_check |           if prefix != prefix_check | ||||||
|             relocatable = false if keg_contain_absolute_symlink_starting_with?(prefix, keg) |             relocatable = false if keg_contain_absolute_symlink_starting_with?(prefix, keg) | ||||||
|             relocatable = false if keg_contain?("#{prefix}/etc", keg, ignores) |             relocatable = false if keg_contain?("#{prefix}/etc", keg, ignores) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Shaun Jackman
						Shaun Jackman