| 
									
										
										
										
											2016-04-17 21:25:11 -04:00
										 |  |  | # | 
					
						
							|  |  |  | # Description: check linkage of installed keg | 
					
						
							|  |  |  | # Usage: | 
					
						
							|  |  |  | #   brew linkage <formulae> | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Only works on installed formulae. An error is raised if it is run on uninstalled | 
					
						
							|  |  |  | # formulae. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Options: | 
					
						
							| 
									
										
										
										
											2016-07-07 12:59:45 -07:00
										 |  |  | #  --test      - testing version: only display broken libs; exit non-zero if any | 
					
						
							|  |  |  | #                breakage was found. | 
					
						
							| 
									
										
										
										
											2016-07-03 16:50:55 +08:00
										 |  |  | #  --reverse   - For each dylib the keg references, print the dylib followed by the | 
					
						
							|  |  |  | #                binaries which link to it. | 
					
						
							| 
									
										
										
										
											2016-04-17 21:25:11 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-07 20:41:14 +08:00
										 |  |  | require "os/mac/linkage_checker" | 
					
						
							| 
									
										
										
										
											2016-04-17 21:25:11 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | module Homebrew | 
					
						
							|  |  |  |   def linkage | 
					
						
							|  |  |  |     ARGV.kegs.each do |keg| | 
					
						
							|  |  |  |       ohai "Checking #{keg.name} linkage" if ARGV.kegs.size > 1
 | 
					
						
							|  |  |  |       result = LinkageChecker.new(keg) | 
					
						
							|  |  |  |       if ARGV.include?("--test") | 
					
						
							|  |  |  |         result.display_test_output | 
					
						
							| 
									
										
										
										
											2016-07-07 20:41:14 +08:00
										 |  |  |         Homebrew.failed = true if result.broken_dylibs? | 
					
						
							| 
									
										
										
										
											2016-06-30 19:50:50 -07:00
										 |  |  |       elsif ARGV.include?("--reverse") | 
					
						
							|  |  |  |         result.display_reverse_output | 
					
						
							| 
									
										
										
										
											2016-04-17 21:25:11 -04:00
										 |  |  |       else | 
					
						
							|  |  |  |         result.display_normal_output | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2016-04-19 13:55:47 +08:00
										 |  |  | end |