diff options
| author | Mike McQuaid | 2017-01-17 10:43:43 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2017-01-17 10:50:04 +0000 |
| commit | dac66c4ada178c09b3b9b77feb2eaa7442b7443e (patch) | |
| tree | a40def8efa0738a85dabc40f76e88e22b3728424 /Library | |
| parent | eece7706d16920443d490013ba989a66028a62f3 (diff) | |
| download | brew-dac66c4ada178c09b3b9b77feb2eaa7442b7443e.tar.bz2 | |
Add `keg_only :versioned_formula`.
This is used to indicate a formula is a version of another formula.
This will be used to provide a consistent interface for older formulae
versions and replaces the use of `conflicts_with`.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/formula.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/formula_support.rb | 47 |
3 files changed, 40 insertions, 22 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 394e0e763..281839621 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -459,6 +459,14 @@ class FormulaAuditor end def audit_conflicts + if formula.versioned_formula? + problem <<-EOS + Versioned formulae should not use `conflicts_with`. + Use `keg_only :versioned_formula` instead. + EOS + return + end + formula.conflicts.each do |c| begin Formulary.factory(c.name) @@ -497,7 +505,7 @@ class FormulaAuditor return unless @new_formula return if formula.deprecated_options.empty? - return if formula.name.include?("@") + return if formula.versioned_formula? problem "New formulae should not use `deprecated_option`." end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 1ced5030f..77688840c 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -382,6 +382,11 @@ class Formula PkgVersion.new(version, revision) end + # If this is a `@`-versioned formula. + def versioned_formula? + name.include?("@") + end + # A named Resource for the currently active {SoftwareSpec}. # Additional downloads can be defined as {#resource}s. # {Resource#stage} will create a temporary directory and yield to a block. diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb index e4f800364..dcb995a6b 100644 --- a/Library/Homebrew/formula_support.rb +++ b/Library/Homebrew/formula_support.rb @@ -29,27 +29,32 @@ class KegOnlyReason def to_s return @explanation unless @explanation.empty? case @reason - when :provided_by_macos, :provided_by_osx then <<-EOS -macOS already provides this software and installing another version in -parallel can cause all kinds of trouble. -EOS - when :shadowed_by_macos, :shadowed_by_osx then <<-EOS -macOS provides similar software and installing this software in -parallel can cause all kinds of trouble. -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_until_xcode43 - "Xcode provides this software prior to version 4.3." - when :provided_until_xcode5 - "Xcode provides this software prior to version 5." + when :versioned_formula then <<-EOS.undent + This is an alternate version of another formula. + EOS + when :provided_by_macos, :provided_by_osx then <<-EOS.undent + macOS already provides this software and installing another version in + parallel can cause all kinds of trouble. + EOS + when :shadowed_by_macos, :shadowed_by_osx then <<-EOS.undent + macOS provides similar software and installing this software in + parallel can cause all kinds of trouble. + EOS + when :provided_pre_mountain_lion then <<-EOS.undent + macOS already provides this software in versions before Mountain Lion. + EOS + when :provided_pre_mavericks then <<-EOS.undent + macOS already provides this software in versions before Mavericks. + EOS + when :provided_pre_el_capitan then <<-EOS.undent + macOS already provides this software in versions before El Capitan. + EOS + when :provided_until_xcode43 then <<-EOS.undent + Xcode provides this software prior to version 4.3. + EOS + when :provided_until_xcode5 then <<-EOS.undent + Xcode provides this software prior to version 5. + EOS else @reason end.strip |
