| 
									
										
										
										
											2018-06-29 19:57:39 +01:00
										 |  |  | #:  * `linkage` [`--test`] [`--reverse`] <formula>: | 
					
						
							| 
									
										
										
										
											2016-09-08 09:05:00 +01:00
										 |  |  | #:    Checks the library links of an installed formula. | 
					
						
							|  |  |  | #: | 
					
						
							|  |  |  | #:    Only works on installed formulae. An error is raised if it is run on | 
					
						
							|  |  |  | #:    uninstalled formulae. | 
					
						
							|  |  |  | #: | 
					
						
							|  |  |  | #:    If `--test` is passed, only display missing libraries and exit with a | 
					
						
							|  |  |  | #:    non-zero exit code if any missing libraries were found. | 
					
						
							|  |  |  | #: | 
					
						
							|  |  |  | #:    If `--reverse` is passed, print the dylib followed by the binaries | 
					
						
							|  |  |  | #:    which link to it for each library the keg references. | 
					
						
							| 
									
										
										
										
											2016-04-17 21:25:11 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-28 10:39:15 -05:00
										 |  |  | require "cache_store" | 
					
						
							| 
									
										
										
										
											2018-02-28 09:13:17 -08:00
										 |  |  | require "linkage_checker" | 
					
						
							| 
									
										
										
										
											2018-06-02 20:45:50 +05:30
										 |  |  | require "cli_parser" | 
					
						
							| 
									
										
										
										
											2016-04-17 21:25:11 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   module_function | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-17 21:25:11 -04:00
										 |  |  |   def linkage | 
					
						
							| 
									
										
										
										
											2018-06-02 20:45:50 +05:30
										 |  |  |     Homebrew::CLI::Parser.parse do | 
					
						
							|  |  |  |       switch "--test" | 
					
						
							|  |  |  |       switch "--reverse" | 
					
						
							|  |  |  |       switch :verbose | 
					
						
							|  |  |  |       switch :debug | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-22 14:46:14 +01:00
										 |  |  |     CacheStoreDatabase.use(:linkage) do |db| | 
					
						
							| 
									
										
										
										
											2018-02-24 17:32:29 -05:00
										 |  |  |       ARGV.kegs.each do |keg| | 
					
						
							|  |  |  |         ohai "Checking #{keg.name} linkage" if ARGV.kegs.size > 1
 | 
					
						
							| 
									
										
										
										
											2018-01-16 17:37:59 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-29 19:57:39 +01:00
										 |  |  |         result = LinkageChecker.new(keg, cache_db: db) | 
					
						
							| 
									
										
										
										
											2018-01-16 17:37:59 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-02 20:45:50 +05:30
										 |  |  |         if args.test? | 
					
						
							| 
									
										
										
										
											2018-02-24 17:32:29 -05:00
										 |  |  |           result.display_test_output | 
					
						
							| 
									
										
										
										
											2018-04-24 16:49:51 -04:00
										 |  |  |           Homebrew.failed = true if result.broken_library_linkage? | 
					
						
							| 
									
										
										
										
											2018-06-02 20:45:50 +05:30
										 |  |  |         elsif args.reverse? | 
					
						
							| 
									
										
										
										
											2018-02-24 17:32:29 -05:00
										 |  |  |           result.display_reverse_output | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |           result.display_normal_output | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2016-04-17 21:25:11 -04:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2016-04-19 13:55:47 +08:00
										 |  |  | end |