clear core tap cache on formula creation

Addresses inability to find just-created formula, see https://github.com/Homebrew/brew/pull/19244#issuecomment-2646030394 for context.
This commit is contained in:
Adrian Ho 2025-02-10 14:55:20 +08:00
parent 6bdf8f9ce6
commit 987363da15
2 changed files with 4 additions and 3 deletions

View File

@ -220,6 +220,7 @@ module Homebrew
path = fc.write_formula!
formula = Homebrew.with_no_api_env do
CoreTap.instance.clear_cache
Formula[fc.name]
end
PyPI.update_python_resources! formula, ignore_non_pypi_packages: true if args.python?

View File

@ -100,9 +100,9 @@ module Homebrew
sig { params(name: String).returns(String) }
def latest_versioned_formula(name)
name_prefix = "#{name}@"
Tap.fetch("homebrew/core").formula_names
.select { |f| f.start_with?(name_prefix) }
.max_by { |v| Gem::Version.new(v.sub(name_prefix, "")) } || "python"
CoreTap.instance.formula_names
.select { |f| f.start_with?(name_prefix) }
.max_by { |v| Gem::Version.new(v.sub(name_prefix, "")) } || "python"
end
sig { returns(String) }