From 6b5213286c389abe2706e67c1a60f0c9ed376ddd Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Apr 2021 14:58:39 +0100 Subject: [PATCH] Rename "exact" tag match to "no_older_versions" This is more specific about the behaviour we want to have in future. --- Library/Homebrew/dev-cmd/bottle.rb | 2 +- Library/Homebrew/dev-cmd/unbottled.rb | 2 +- Library/Homebrew/extend/os/mac/utils/bottles.rb | 6 +++--- Library/Homebrew/software_spec.rb | 14 +++++++------- Library/Homebrew/utils/bottles.rb | 10 +++++----- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 145f9a7fca..314cbe046d 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -344,7 +344,7 @@ module Homebrew 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) skip_relocation = bottle_cellar == :any_skip_relocation diff --git a/Library/Homebrew/dev-cmd/unbottled.rb b/Library/Homebrew/dev-cmd/unbottled.rb index d7bf41554c..9966a748e2 100644 --- a/Library/Homebrew/dev-cmd/unbottled.rb +++ b/Library/Homebrew/dev-cmd/unbottled.rb @@ -158,7 +158,7 @@ module Homebrew formulae.each do |f| 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 next end diff --git a/Library/Homebrew/extend/os/mac/utils/bottles.rb b/Library/Homebrew/extend/os/mac/utils/bottles.rb index 03a302a0ca..b27a934194 100644 --- a/Library/Homebrew/extend/os/mac/utils/bottles.rb +++ b/Library/Homebrew/extend/os/mac/utils/bottles.rb @@ -16,10 +16,10 @@ module Utils 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. - if exact || (OS::Mac.prerelease? && Homebrew::EnvConfig.developer? && - Homebrew::EnvConfig.skip_or_later_bottles?) + if no_older_versions || + (OS::Mac.prerelease? && Homebrew::EnvConfig.developer? && Homebrew::EnvConfig.skip_or_later_bottles?) generic_find_matching_tag(tag) else generic_find_matching_tag(tag) || diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index e9e077a8db..42498d696b 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -495,9 +495,9 @@ class BottleSpecification cellar == :any_skip_relocation end - sig { params(tag: T.any(Symbol, Utils::Bottles::Tag), exact: T::Boolean).returns(T::Boolean) } - def tag?(tag, exact: false) - checksum_for(tag, exact: exact) ? true : false + sig { params(tag: T.any(Symbol, Utils::Bottles::Tag), no_older_versions: T::Boolean).returns(T::Boolean) } + def tag?(tag, no_older_versions: false) + checksum_for(tag, no_older_versions: no_older_versions) ? true : false end # Checksum methods in the DSL's bottle block take @@ -543,14 +543,14 @@ class BottleSpecification sig { params( - tag: T.any(Symbol, Utils::Bottles::Tag), - exact: T::Boolean, + tag: T.any(Symbol, Utils::Bottles::Tag), + no_older_versions: T::Boolean, ).returns( T.nilable([Checksum, Symbol, T.any(Symbol, String)]), ) } - def checksum_for(tag, exact: false) - collector.fetch_checksum_for(tag, exact: exact) + def checksum_for(tag, no_older_versions: false) + collector.fetch_checksum_for(tag, no_older_versions: no_older_versions) end def checksums diff --git a/Library/Homebrew/utils/bottles.rb b/Library/Homebrew/utils/bottles.rb index adcf14a0f3..131bc4efbd 100644 --- a/Library/Homebrew/utils/bottles.rb +++ b/Library/Homebrew/utils/bottles.rb @@ -204,21 +204,21 @@ module Utils sig { params( - tag: T.any(Symbol, Utils::Bottles::Tag), - exact: T::Boolean, + tag: T.any(Symbol, Utils::Bottles::Tag), + no_older_versions: T::Boolean, ).returns( 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 = 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 end private - def find_matching_tag(tag, exact: false) + def find_matching_tag(tag, no_older_versions: false) tag if key?(tag.to_sym) end end