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?
|
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
|
2017-07-30 00:21:33 +01:00
|
|
|
when :provided_pre_high_sierra
|
|
|
|
MacOS.version < :high_sierra
|
2014-04-03 09:11:51 -05:00
|
|
|
when :provided_until_xcode43
|
2016-06-05 12:46:43 +02:00
|
|
|
MacOS::Xcode.installed? && MacOS::Xcode.version < "4.3"
|
2014-04-03 09:11:51 -05:00
|
|
|
when :provided_until_xcode5
|
2016-06-05 12:46:43 +02:00
|
|
|
MacOS::Xcode.installed? && 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?
|
2018-01-18 09:47:33 +00:00
|
|
|
|
2012-08-09 02:00:58 -05:00
|
|
|
case @reason
|
2017-10-15 02:28:32 +02:00
|
|
|
when :versioned_formula then <<~EOS
|
2017-04-28 04:56:22 +01:00
|
|
|
this is an alternate version of another formula
|
2017-01-17 10:43:43 +00:00
|
|
|
EOS
|
2018-01-18 09:47:33 +00:00
|
|
|
when :provided_by_macos then <<~EOS
|
2017-01-17 10:43:43 +00:00
|
|
|
macOS already provides this software and installing another version in
|
2017-04-28 04:56:22 +01:00
|
|
|
parallel can cause all kinds of trouble
|
2017-01-17 10:43:43 +00:00
|
|
|
EOS
|
2018-01-18 09:47:33 +00:00
|
|
|
when :shadowed_by_macos then <<~EOS
|
2017-01-17 10:43:43 +00:00
|
|
|
macOS provides similar software and installing this software in
|
2017-04-28 04:56:22 +01:00
|
|
|
parallel can cause all kinds of trouble
|
2017-01-17 10:43:43 +00:00
|
|
|
EOS
|
2017-10-15 02:28:32 +02:00
|
|
|
when :provided_pre_mountain_lion then <<~EOS
|
2017-04-28 04:56:22 +01:00
|
|
|
macOS already provides this software in versions before Mountain Lion
|
2017-01-17 10:43:43 +00:00
|
|
|
EOS
|
2017-10-15 02:28:32 +02:00
|
|
|
when :provided_pre_mavericks then <<~EOS
|
2017-04-28 04:56:22 +01:00
|
|
|
macOS already provides this software in versions before Mavericks
|
2017-01-17 10:43:43 +00:00
|
|
|
EOS
|
2017-10-15 02:28:32 +02:00
|
|
|
when :provided_pre_el_capitan then <<~EOS
|
2017-04-28 04:56:22 +01:00
|
|
|
macOS already provides this software in versions before El Capitan
|
2017-01-17 10:43:43 +00:00
|
|
|
EOS
|
2017-10-15 02:28:32 +02:00
|
|
|
when :provided_pre_high_sierra then <<~EOS
|
2017-07-30 00:21:33 +01:00
|
|
|
macOS already provides this software in versions before High Sierra
|
|
|
|
EOS
|
2017-10-15 02:28:32 +02:00
|
|
|
when :provided_until_xcode43 then <<~EOS
|
2017-04-28 04:56:22 +01:00
|
|
|
Xcode provides this software prior to version 4.3
|
2017-01-17 10:43:43 +00:00
|
|
|
EOS
|
2017-10-15 02:28:32 +02:00
|
|
|
when :provided_until_xcode5 then <<~EOS
|
2017-04-28 04:56:22 +01:00
|
|
|
Xcode provides this software prior to version 5
|
2017-01-17 10:43:43 +00:00
|
|
|
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
|
2017-06-26 07:30:28 +02:00
|
|
|
if unneeded?
|
2015-09-14 19:51:04 +08:00
|
|
|
"This formula doesn't require compiling."
|
|
|
|
else
|
|
|
|
@reason
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|