audit: tweak versioned formulae logic (again).

References https://github.com/Homebrew/brew/pull/9027#issuecomment-722042589
This commit is contained in:
Mike McQuaid 2020-11-05 10:28:02 +00:00
parent cbb0b87e75
commit c4fc81b26b
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -280,8 +280,11 @@ module Homebrew
unversioned_name = unversioned_formula.basename(".rb")
problem "#{formula} is versioned but no #{unversioned_name} formula exists"
end
elsif @build_stable && formula.stable? &&
(versioned_formulae = formula.versioned_formulae - [formula]).present?
elsif @build_stable &&
formula.stable? &&
!@versioned_formula &&
(versioned_formulae = formula.versioned_formulae - [formula]) &&
versioned_formulae.present?
versioned_aliases = formula.aliases.grep(/.@\d/)
_, last_alias_version = versioned_formulae.map(&:name).last.split("@")
alias_name_major = "#{formula.name}@#{formula.version.major}"