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)
|
|
|
|
|
2012-02-04 18:45:08 -08:00
|
|
|
# Used to annotate formulae that duplicate OS X provided software
|
|
|
|
# or cause conflicts when linked in.
|
|
|
|
class KegOnlyReason
|
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?
|
2014-04-01 21:35:22 -05:00
|
|
|
case @reason
|
|
|
|
when :provided_pre_mountain_lion
|
|
|
|
MacOS.version < :mountain_lion
|
2015-08-04 19:00:30 +01:00
|
|
|
when :provided_pre_mavericks
|
|
|
|
MacOS.version < :mavericks
|
2015-09-08 15:27:58 +01:00
|
|
|
when :provided_pre_el_capitan
|
|
|
|
MacOS.version < :el_capitan
|
2014-04-03 09:11:51 -05:00
|
|
|
when :provided_until_xcode43
|
|
|
|
MacOS::Xcode.version < "4.3"
|
|
|
|
when :provided_until_xcode5
|
|
|
|
MacOS::Xcode.version < "5.0"
|
2014-04-01 21:35:22 -05:00
|
|
|
else
|
|
|
|
true
|
|
|
|
end
|
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?
|
2012-08-09 02:00:58 -05:00
|
|
|
case @reason
|
2014-09-12 20:54:41 -05:00
|
|
|
when :provided_by_osx then <<-EOS
|
2015-06-16 20:02:10 -04:00
|
|
|
OS X already provides this software and installing another version in
|
2014-09-12 20:54:41 -05:00
|
|
|
parallel can cause all kinds of trouble.
|
|
|
|
EOS
|
|
|
|
when :shadowed_by_osx then <<-EOS
|
2015-08-04 19:00:30 +01:00
|
|
|
OS X provides similar software and installing this software in
|
2014-09-12 20:54:41 -05:00
|
|
|
parallel can cause all kinds of trouble.
|
2015-09-08 15:27:58 +01:00
|
|
|
EOS
|
|
|
|
when :provided_pre_mountain_lion then <<-EOS
|
|
|
|
OS X already provides this software in versions before Mountain Lion.
|
2015-08-04 19:00:30 +01:00
|
|
|
EOS
|
|
|
|
when :provided_pre_mavericks then <<-EOS
|
|
|
|
OS X already provides this software in versions before Mavericks.
|
2014-09-12 20:54:41 -05:00
|
|
|
EOS
|
2015-09-08 15:27:58 +01:00
|
|
|
when :provided_pre_el_capitan then <<-EOS
|
|
|
|
OS X already provides this software in versions before El Capitan.
|
2014-09-12 20:54:41 -05:00
|
|
|
EOS
|
2014-04-03 09:11:51 -05:00
|
|
|
when :provided_until_xcode43
|
2015-07-24 00:49:34 +02:00
|
|
|
"Xcode provides this software prior to version 4.3."
|
2014-04-03 09:11:51 -05:00
|
|
|
when :provided_until_xcode5
|
2015-07-24 00:49:34 +02:00
|
|
|
"Xcode provides this software prior to version 5."
|
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
|
2015-10-26 16:14:41 +01:00
|
|
|
SUPPORTED_TYPES = [:unneeded, :disable]
|
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
|
|
|
|
if @type == :unneeded
|
|
|
|
"This formula doesn't require compiling."
|
|
|
|
else
|
|
|
|
@reason
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|