Fix cases of core taps being unnecessarily installed

This commit is contained in:
Bo Anderson 2023-07-13 19:45:28 +01:00
parent ba02c669e1
commit beaa6c32a0
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
5 changed files with 7 additions and 8 deletions

View File

@ -179,9 +179,7 @@ module Homebrew
next unless name =~ HOMEBREW_TAP_FORMULA_REGEX
tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2))
next if (tap.core_tap? || tap == "homebrew/cask") && !EnvConfig.no_install_from_api?
tap.install unless tap.installed?
tap.ensure_installed!
end
if args.ignore_dependencies?

View File

@ -600,7 +600,7 @@ class Reporter
next unless (HOMEBREW_PREFIX/"Caskroom"/new_name).exist?
new_tap = Tap.fetch(new_tap_name)
new_tap.install unless new_tap.installed?
new_tap.ensure_installed!
ohai "#{name} has been moved to Homebrew.", <<~EOS
To uninstall the cask, run:
brew uninstall --cask --force #{name}
@ -650,7 +650,7 @@ class Reporter
EOS
end
else
new_tap.install unless new_tap.installed?
new_tap.ensure_installed!
# update tap for each Tab
tabs.each { |tab| tab.tap = new_tap }
tabs.each(&:write)

View File

@ -107,6 +107,7 @@ module Homebrew
destination_tap = Tap.fetch(args.named.second)
unless Homebrew::EnvConfig.developer?
odie "Cannot extract formula to homebrew/core!" if destination_tap.core_tap?
odie "Cannot extract formula to homebrew/cask!" if destination_tap.core_cask_tap?
odie "Cannot extract formula to the same tap!" if destination_tap == source_tap
end
destination_tap.install unless destination_tap.installed?

View File

@ -229,8 +229,8 @@ class FormulaInstaller
rescue TapFormulaUnavailableError => e
raise if e.tap.installed?
e.tap.install
retry
e.tap.ensure_installed!
retry if e.tap.installed? # It may have not installed if it's a core tap.
end
rescue FormulaUnavailableError => e
e.dependent = formula.full_name

View File

@ -626,7 +626,7 @@ module Formulary
new_tap_user, new_tap_repo, = new_tap_name.split("/")
new_tap_name = "#{new_tap_user}/#{new_tap_repo}"
new_tap = Tap.fetch new_tap_name
new_tap.install unless new_tap.installed?
new_tap.ensure_installed!
new_tapped_name = "#{new_tap_name}/#{name}"
name, path = formula_name_path(new_tapped_name, warn: false)
old_name = tapped_name