Merge pull request #5168 from commitay/we-add-the-bottle-block

audit: check for `bottle do` blocks in new formulae
This commit is contained in:
commitay 2018-10-24 22:33:09 +10:00 committed by GitHub
commit a4c62d37b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -254,6 +254,7 @@ module Homebrew
def initialize(formula, options = {}) def initialize(formula, options = {})
@formula = formula @formula = formula
@versioned_formula = formula.versioned_formula? @versioned_formula = formula.versioned_formula?
@new_formula_inclusive = options[:new_formula]
@new_formula = options[:new_formula] && !@versioned_formula @new_formula = options[:new_formula] && !@versioned_formula
@strict = options[:strict] @strict = options[:strict]
@online = options[:online] @online = options[:online]
@ -563,6 +564,18 @@ module Homebrew
end end
end end
def audit_bottle_spec
# special case: new versioned formulae should be audited
return unless @new_formula_inclusive
return unless @core_tap
return if formula.bottle_disabled?
return unless formula.bottle_defined?
new_formula_problem "New formulae should not have a `bottle do` block"
end
def audit_bottle_disabled def audit_bottle_disabled
return unless formula.bottle_disabled? return unless formula.bottle_disabled?
return if formula.bottle_unneeded? return if formula.bottle_unneeded?