Rename "exact" tag match to "no_older_versions"

This is more specific about the behaviour we want to have in future.
This commit is contained in:
Mike McQuaid 2021-04-08 14:58:39 +01:00
parent 7a0de03d82
commit 6b5213286c
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
5 changed files with 17 additions and 17 deletions

View File

@ -344,7 +344,7 @@ module Homebrew
end end
end end
_, _, bottle_cellar = Formula[f.name].bottle_specification.checksum_for(bottle_tag, exact: true) _, _, bottle_cellar = Formula[f.name].bottle_specification.checksum_for(bottle_tag, no_older_versions: true)
relocatable = [:any, :any_skip_relocation].include?(bottle_cellar) relocatable = [:any, :any_skip_relocation].include?(bottle_cellar)
skip_relocation = bottle_cellar == :any_skip_relocation skip_relocation = bottle_cellar == :any_skip_relocation

View File

@ -158,7 +158,7 @@ module Homebrew
formulae.each do |f| formulae.each do |f|
name = f.name.downcase name = f.name.downcase
if f.bottle_specification.tag?(@bottle_tag, exact: true) if f.bottle_specification.tag?(@bottle_tag, no_older_versions: true)
puts "#{Tty.bold}#{Tty.green}#{name}#{Tty.reset}: already bottled" if any_named_args puts "#{Tty.bold}#{Tty.green}#{name}#{Tty.reset}: already bottled" if any_named_args
next next
end end

View File

@ -16,10 +16,10 @@ module Utils
alias generic_find_matching_tag find_matching_tag alias generic_find_matching_tag find_matching_tag
def find_matching_tag(tag, exact: false) def find_matching_tag(tag, no_older_versions: false)
# Used primarily by developers testing beta macOS releases. # Used primarily by developers testing beta macOS releases.
if exact || (OS::Mac.prerelease? && Homebrew::EnvConfig.developer? && if no_older_versions ||
Homebrew::EnvConfig.skip_or_later_bottles?) (OS::Mac.prerelease? && Homebrew::EnvConfig.developer? && Homebrew::EnvConfig.skip_or_later_bottles?)
generic_find_matching_tag(tag) generic_find_matching_tag(tag)
else else
generic_find_matching_tag(tag) || generic_find_matching_tag(tag) ||

View File

@ -495,9 +495,9 @@ class BottleSpecification
cellar == :any_skip_relocation cellar == :any_skip_relocation
end end
sig { params(tag: T.any(Symbol, Utils::Bottles::Tag), exact: T::Boolean).returns(T::Boolean) } sig { params(tag: T.any(Symbol, Utils::Bottles::Tag), no_older_versions: T::Boolean).returns(T::Boolean) }
def tag?(tag, exact: false) def tag?(tag, no_older_versions: false)
checksum_for(tag, exact: exact) ? true : false checksum_for(tag, no_older_versions: no_older_versions) ? true : false
end end
# Checksum methods in the DSL's bottle block take # Checksum methods in the DSL's bottle block take
@ -544,13 +544,13 @@ class BottleSpecification
sig { sig {
params( params(
tag: T.any(Symbol, Utils::Bottles::Tag), tag: T.any(Symbol, Utils::Bottles::Tag),
exact: T::Boolean, no_older_versions: T::Boolean,
).returns( ).returns(
T.nilable([Checksum, Symbol, T.any(Symbol, String)]), T.nilable([Checksum, Symbol, T.any(Symbol, String)]),
) )
} }
def checksum_for(tag, exact: false) def checksum_for(tag, no_older_versions: false)
collector.fetch_checksum_for(tag, exact: exact) collector.fetch_checksum_for(tag, no_older_versions: no_older_versions)
end end
def checksums def checksums

View File

@ -205,20 +205,20 @@ module Utils
sig { sig {
params( params(
tag: T.any(Symbol, Utils::Bottles::Tag), tag: T.any(Symbol, Utils::Bottles::Tag),
exact: T::Boolean, no_older_versions: T::Boolean,
).returns( ).returns(
T.nilable([Checksum, Symbol, T.any(Symbol, String)]), T.nilable([Checksum, Symbol, T.any(Symbol, String)]),
) )
} }
def fetch_checksum_for(tag, exact: false) def fetch_checksum_for(tag, no_older_versions: false)
tag = Utils::Bottles::Tag.from_symbol(tag) if tag.is_a?(Symbol) tag = Utils::Bottles::Tag.from_symbol(tag) if tag.is_a?(Symbol)
tag = find_matching_tag(tag, exact: exact)&.to_sym tag = find_matching_tag(tag, no_older_versions: no_older_versions)&.to_sym
return self[tag][:checksum], tag, self[tag][:cellar] if tag return self[tag][:checksum], tag, self[tag][:cellar] if tag
end end
private private
def find_matching_tag(tag, exact: false) def find_matching_tag(tag, no_older_versions: false)
tag if key?(tag.to_sym) tag if key?(tag.to_sym)
end end
end end