| 
									
										
										
										
											2014-02-22 07:51:33 -08:00
										 |  |  | # Used to track formulae that cannot be installed at the same time | 
					
						
							| 
									
										
										
										
											2013-06-09 13:44:59 -05:00
										 |  |  | FormulaConflict = Struct.new(:name, :reason) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-18 19:57:19 +01:00
										 |  |  | # Used to annotate formulae that duplicate macOS provided software | 
					
						
							| 
									
										
										
										
											2012-02-04 18:45:08 -08:00
										 |  |  | # or cause conflicts when linked in. | 
					
						
							|  |  |  | class KegOnlyReason | 
					
						
							| 
									
										
										
										
											2017-03-19 20:45:21 +02:00
										 |  |  |   attr_reader :reason | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-08 01:34:45 -05:00
										 |  |  |   def initialize(reason, explanation) | 
					
						
							| 
									
										
										
										
											2012-02-04 18:45:08 -08:00
										 |  |  |     @reason = reason | 
					
						
							|  |  |  |     @explanation = explanation | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-09 02:00:58 -05:00
										 |  |  |   def valid? | 
					
						
							| 
									
										
										
										
											2018-08-15 10:14:17 -07:00
										 |  |  |     ![:provided_by_macos, :provided_by_osx, :shadowed_by_macos].include?(@reason) | 
					
						
							| 
									
										
										
										
											2012-08-09 02:00:58 -05:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-02-04 18:45:08 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-09 02:00:58 -05:00
										 |  |  |   def to_s | 
					
						
							| 
									
										
										
										
											2015-07-24 00:49:34 +02:00
										 |  |  |     return @explanation unless @explanation.empty? | 
					
						
							| 
									
										
										
										
											2018-01-18 09:47:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-09 02:00:58 -05:00
										 |  |  |     case @reason | 
					
						
							| 
									
										
										
										
											2018-04-16 22:17:48 +01:00
										 |  |  |     when :versioned_formula | 
					
						
							|  |  |  |       <<~EOS | 
					
						
							|  |  |  |         this is an alternate version of another formula | 
					
						
							|  |  |  |       EOS | 
					
						
							|  |  |  |     when :provided_by_macos | 
					
						
							|  |  |  |       <<~EOS | 
					
						
							|  |  |  |         macOS already provides this software and installing another version in | 
					
						
							|  |  |  |         parallel can cause all kinds of trouble | 
					
						
							|  |  |  |       EOS | 
					
						
							|  |  |  |     when :shadowed_by_macos | 
					
						
							|  |  |  |       <<~EOS | 
					
						
							|  |  |  |         macOS provides similar software and installing this software in | 
					
						
							|  |  |  |         parallel can cause all kinds of trouble | 
					
						
							|  |  |  |       EOS | 
					
						
							| 
									
										
										
										
											2012-02-04 18:45:08 -08:00
										 |  |  |     else | 
					
						
							| 
									
										
										
										
											2012-08-09 02:00:58 -05:00
										 |  |  |       @reason | 
					
						
							|  |  |  |     end.strip | 
					
						
							| 
									
										
										
										
											2012-02-04 18:45:08 -08:00
										 |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2015-09-14 19:51:04 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Used to annotate formulae that don't require compiling or cannot build bottle. | 
					
						
							|  |  |  | class BottleDisableReason | 
					
						
							| 
									
										
										
										
											2016-09-17 15:17:27 +01:00
										 |  |  |   SUPPORTED_TYPES = [:unneeded, :disable].freeze | 
					
						
							| 
									
										
										
										
											2015-10-23 10:41:39 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-14 19:51:04 +08:00
										 |  |  |   def initialize(type, reason) | 
					
						
							|  |  |  |     @type = type | 
					
						
							|  |  |  |     @reason = reason | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def unneeded? | 
					
						
							|  |  |  |     @type == :unneeded | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-23 10:41:39 +02:00
										 |  |  |   def valid? | 
					
						
							|  |  |  |     SUPPORTED_TYPES.include? @type | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-14 19:51:04 +08:00
										 |  |  |   def to_s | 
					
						
							| 
									
										
										
										
											2018-04-16 22:17:48 +01:00
										 |  |  |     return "This formula doesn't require compiling." if unneeded? | 
					
						
							|  |  |  |     @reason | 
					
						
							| 
									
										
										
										
											2015-09-14 19:51:04 +08:00
										 |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2018-08-15 10:14:17 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | require "extend/os/formula_support" |