Merge pull request #13714 from carlocab/dependent-conflict-allowlist
formula_auditor: create a versioned formula dependent conflict allowlist
This commit is contained in:
commit
d4e6925cbb
@ -344,6 +344,10 @@ module Homebrew
|
||||
recursive_runtime_formulae.each do |f|
|
||||
name = f.name
|
||||
unversioned_name, = name.split("@")
|
||||
# Allow use of the full versioned name (e.g. `python@3.99`) or an unversioned alias (`python`).
|
||||
next if formula.tap&.audit_exception :versioned_formula_dependent_conflicts_allowlist, name
|
||||
next if formula.tap&.audit_exception :versioned_formula_dependent_conflicts_allowlist, unversioned_name
|
||||
|
||||
version_hash[unversioned_name] ||= Set.new
|
||||
version_hash[unversioned_name] << name
|
||||
next if version_hash[unversioned_name].length < 2
|
||||
|
||||
@ -8,8 +8,8 @@ module Homebrew
|
||||
class TapAuditor
|
||||
extend T::Sig
|
||||
|
||||
attr_reader :name, :path, :formula_names, :cask_tokens, :tap_audit_exceptions, :tap_style_exceptions,
|
||||
:tap_pypi_formula_mappings, :problems
|
||||
attr_reader :name, :path, :formula_names, :formula_aliases, :cask_tokens,
|
||||
:tap_audit_exceptions, :tap_style_exceptions, :tap_pypi_formula_mappings, :problems
|
||||
|
||||
sig { params(tap: Tap, strict: T.nilable(T::Boolean)).void }
|
||||
def initialize(tap, strict:)
|
||||
@ -21,6 +21,7 @@ module Homebrew
|
||||
@tap_pypi_formula_mappings = tap.pypi_formula_mappings
|
||||
@problems = []
|
||||
|
||||
@formula_aliases = tap.aliases
|
||||
@formula_names = tap.formula_names.map do |formula_name|
|
||||
formula_name.split("/").last
|
||||
end
|
||||
@ -68,7 +69,9 @@ module Homebrew
|
||||
|
||||
list = list.keys if list.is_a? Hash
|
||||
invalid_formulae_casks = list.select do |formula_or_cask_name|
|
||||
@formula_names.exclude?(formula_or_cask_name) && @cask_tokens.exclude?("#{@name}/#{formula_or_cask_name}")
|
||||
formula_names.exclude?(formula_or_cask_name) &&
|
||||
formula_aliases.exclude?(formula_or_cask_name) &&
|
||||
cask_tokens.exclude?("#{@name}/#{formula_or_cask_name}")
|
||||
end
|
||||
|
||||
return if invalid_formulae_casks.empty?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user