Merge pull request #4081 from MikeMcQuaid/deprecate_old_keg_only

formula_support: deprecate more keg_only reasons.
This commit is contained in:
Mike McQuaid 2018-04-17 11:51:37 +01:00 committed by GitHub
commit 7b6fb39497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 84 additions and 52 deletions

View File

@ -2,15 +2,80 @@ require "formula_support"
class KegOnlyReason class KegOnlyReason
module Compat module Compat
def valid?
case @reason
when :provided_by_osx
odisabled "keg_only :provided_by_osx", "keg_only :provided_by_macos"
when :shadowed_by_osx
odisabled "keg_only :shadowed_by_osx", "keg_only :shadowed_by_macos"
when :provided_pre_mountain_lion
odeprecated "keg_only :provided_pre_mountain_lion"
MacOS.version < :mountain_lion
when :provided_pre_mavericks
odeprecated "keg_only :provided_pre_mavericks"
MacOS.version < :mavericks
when :provided_pre_el_capitan
odeprecated "keg_only :provided_pre_el_capitan"
MacOS.version < :el_capitan
when :provided_pre_high_sierra
odeprecated "keg_only :provided_pre_high_sierra"
MacOS.version < :high_sierra
when :provided_until_xcode43
odeprecated "keg_only :provided_until_xcode43"
MacOS::Xcode.version < "4.3"
when :provided_until_xcode5
odeprecated "keg_only :provided_until_xcode5"
MacOS::Xcode.version < "5.0"
else
super
end
end
def to_s def to_s
case @reason case @reason
when :provided_by_osx when :provided_by_osx
odisabled "keg_only :provided_by_osx", "keg_only :provided_by_macos" odisabled "keg_only :provided_by_osx", "keg_only :provided_by_macos"
when :shadowed_by_osx when :shadowed_by_osx
odisabled "keg_only :shadowed_by_osx", "keg_only :shadowed_by_macos" odisabled "keg_only :shadowed_by_osx", "keg_only :shadowed_by_macos"
end when :provided_pre_mountain_lion
odeprecated "keg_only :provided_pre_mountain_lion"
<<~EOS
macOS already provides this software in versions before Mountain Lion
EOS
when :provided_pre_mavericks
odeprecated "keg_only :provided_pre_mavericks"
<<~EOS
macOS already provides this software in versions before Mavericks
EOS
when :provided_pre_el_capitan
odeprecated "keg_only :provided_pre_el_capitan"
<<~EOS
macOS already provides this software in versions before El Capitan
EOS
when :provided_pre_high_sierra
odeprecated "keg_only :provided_pre_high_sierra"
<<~EOS
macOS already provides this software in versions before High Sierra
EOS
when :provided_until_xcode43
odeprecated "keg_only :provided_until_xcode43"
<<~EOS
Xcode provides this software prior to version 4.3
EOS
when :provided_until_xcode5
odeprecated "keg_only :provided_until_xcode5"
<<~EOS
Xcode provides this software prior to version 5
EOS
else
super super
end.to_s.strip
end end
end end

View File

@ -12,57 +12,27 @@ class KegOnlyReason
end end
def valid? def valid?
case @reason
when :provided_pre_mountain_lion
MacOS.version < :mountain_lion
when :provided_pre_mavericks
MacOS.version < :mavericks
when :provided_pre_el_capitan
MacOS.version < :el_capitan
when :provided_pre_high_sierra
MacOS.version < :high_sierra
when :provided_until_xcode43
MacOS::Xcode.version < "4.3"
when :provided_until_xcode5
MacOS::Xcode.version < "5.0"
else
true true
end end
end
def to_s def to_s
return @explanation unless @explanation.empty? return @explanation unless @explanation.empty?
case @reason case @reason
when :versioned_formula then <<~EOS when :versioned_formula
<<~EOS
this is an alternate version of another formula this is an alternate version of another formula
EOS EOS
when :provided_by_macos then <<~EOS when :provided_by_macos
<<~EOS
macOS already provides this software and installing another version in macOS already provides this software and installing another version in
parallel can cause all kinds of trouble parallel can cause all kinds of trouble
EOS EOS
when :shadowed_by_macos then <<~EOS when :shadowed_by_macos
<<~EOS
macOS provides similar software and installing this software in macOS provides similar software and installing this software in
parallel can cause all kinds of trouble parallel can cause all kinds of trouble
EOS EOS
when :provided_pre_mountain_lion then <<~EOS
macOS already provides this software in versions before Mountain Lion
EOS
when :provided_pre_mavericks then <<~EOS
macOS already provides this software in versions before Mavericks
EOS
when :provided_pre_el_capitan then <<~EOS
macOS already provides this software in versions before El Capitan
EOS
when :provided_pre_high_sierra then <<~EOS
macOS already provides this software in versions before High Sierra
EOS
when :provided_until_xcode43 then <<~EOS
Xcode provides this software prior to version 4.3
EOS
when :provided_until_xcode5 then <<~EOS
Xcode provides this software prior to version 5
EOS
else else
@reason @reason
end.strip end.strip
@ -87,10 +57,7 @@ class BottleDisableReason
end end
def to_s def to_s
if unneeded? return "This formula doesn't require compiling." if unneeded?
"This formula doesn't require compiling."
else
@reason @reason
end end
end
end end