diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index f153b0d55a..a100e07939 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -537,8 +537,7 @@ class Formula sig { returns(T::Array[String]) } def oldnames @oldnames ||= if tap - T.must(tap).formula_renames - .flat_map { |old_name, new_name| (new_name == name) ? old_name : [] } + T.must(tap).formula_oldnames.fetch(name, []) else [] end @@ -2237,7 +2236,7 @@ class Formula "versions" => { "stable" => stable&.version&.to_s, "head" => head&.version&.to_s, - "bottle" => !bottle_specification.checksums.empty?, + "bottle" => bottle_defined?, }, "urls" => {}, "revision" => revision, @@ -2434,7 +2433,7 @@ class Formula "files" => {}, } bottle_spec.collector.each_tag do |tag| - tag_spec = bottle_spec.collector.specification_for(tag) + tag_spec = bottle_spec.collector.specification_for(tag, no_older_versions: true) os_cellar = tag_spec.cellar os_cellar = os_cellar.inspect if os_cellar.is_a?(Symbol) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index c0349e6ec8..277ad75a01 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -767,6 +767,15 @@ class Tap end end + # Hash with tap formula old names. Reverse of {#formula_renames}. + sig { returns(T::Hash[String, T::Array[String]]) } + def formula_oldnames + @formula_oldnames ||= formula_renames.each_with_object({}) do |(old_name, new_name), hash| + hash[new_name] ||= [] + hash[new_name] << old_name + end + end + # Hash with tap migrations. sig { returns(Hash) } def tap_migrations diff --git a/Library/Homebrew/utils/bottles.rb b/Library/Homebrew/utils/bottles.rb index 2b9a178d72..ea7a55ba03 100644 --- a/Library/Homebrew/utils/bottles.rb +++ b/Library/Homebrew/utils/bottles.rb @@ -209,10 +209,7 @@ module Utils sig { returns(T::Boolean) } def macos? - to_macos_version - true - rescue MacOSVersion::Error - false + MacOSVersion::SYMBOLS.key?(system) end sig { returns(T::Boolean) }