Merge pull request #13440 from Rylan12/prefer-api-to-taps
Always prefer loading from API when `HOMEBREW_INSTALL_FROM_API` is set
This commit is contained in:
commit
b941470216
@ -217,14 +217,17 @@ module Cask
|
||||
next unless loader_class.can_load?(ref)
|
||||
|
||||
if loader_class == FromTapLoader && Homebrew::EnvConfig.install_from_api? &&
|
||||
ref.start_with?("homebrew/cask/") && !Tap.fetch("homebrew/cask").installed? &&
|
||||
Homebrew::API::CaskSource.available?(ref)
|
||||
ref.start_with?("homebrew/cask/") && Homebrew::API::CaskSource.available?(ref)
|
||||
return FromContentLoader.new(Homebrew::API::CaskSource.fetch(ref))
|
||||
end
|
||||
|
||||
return loader_class.new(ref)
|
||||
end
|
||||
|
||||
if Homebrew::EnvConfig.install_from_api? && Homebrew::API::CaskSource.available?(ref)
|
||||
return FromContentLoader.new(Homebrew::API::CaskSource.fetch(ref))
|
||||
end
|
||||
|
||||
return FromTapPathLoader.new(default_path(ref)) if FromTapPathLoader.can_load?(default_path(ref))
|
||||
|
||||
case (possible_tap_casks = tap_paths(ref)).count
|
||||
@ -239,10 +242,6 @@ module Cask
|
||||
EOS
|
||||
end
|
||||
|
||||
if Homebrew::EnvConfig.install_from_api? && Homebrew::API::CaskSource.available?(ref)
|
||||
return FromContentLoader.new(Homebrew::API::CaskSource.fetch(ref))
|
||||
end
|
||||
|
||||
possible_installed_cask = Cask.new(ref)
|
||||
return FromPathLoader.new(possible_installed_cask.installed_caskfile) if possible_installed_cask.installed?
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ module Homebrew
|
||||
updated_taps = []
|
||||
Tap.each do |tap|
|
||||
next unless tap.git?
|
||||
next if (tap.core_tap? || tap == "homebrew/cask") && Homebrew::EnvConfig.install_from_api? && args.auto_update?
|
||||
next if (tap.core_tap? || tap == "homebrew/cask") && Homebrew::EnvConfig.install_from_api?
|
||||
|
||||
if ENV["HOMEBREW_MIGRATE_LINUXBREW_FORMULAE"].present? && tap.core_tap? &&
|
||||
Settings.read("linuxbrewmigrated") != "true"
|
||||
|
||||
@ -701,10 +701,7 @@ EOS
|
||||
|
||||
for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*
|
||||
do
|
||||
# HOMEBREW_UPDATE_AUTO wasn't modified in subshell.
|
||||
# shellcheck disable=SC2031
|
||||
if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] &&
|
||||
[[ -n "${HOMEBREW_UPDATE_AUTO}" ]] &&
|
||||
[[ "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" ||
|
||||
"${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" ]]
|
||||
then
|
||||
|
||||
@ -641,7 +641,7 @@ module Formulary
|
||||
when URL_START_REGEX
|
||||
return FromUrlLoader.new(ref)
|
||||
when HOMEBREW_TAP_FORMULA_REGEX
|
||||
if ref.start_with?("homebrew/core/") && !CoreTap.instance.installed? && Homebrew::EnvConfig.install_from_api?
|
||||
if ref.start_with?("homebrew/core/") && Homebrew::EnvConfig.install_from_api?
|
||||
name = ref.split("/", 3).last
|
||||
return FormulaAPILoader.new(name) if Homebrew::API::Formula.all_formulae.key?(name)
|
||||
end
|
||||
@ -651,18 +651,16 @@ module Formulary
|
||||
|
||||
return FromPathLoader.new(ref) if File.extname(ref) == ".rb" && Pathname.new(ref).expand_path.exist?
|
||||
|
||||
if Homebrew::EnvConfig.install_from_api? && Homebrew::API::Formula.all_formulae.key?(ref)
|
||||
return FormulaAPILoader.new(ref)
|
||||
end
|
||||
|
||||
formula_with_that_name = core_path(ref)
|
||||
return FormulaLoader.new(ref, formula_with_that_name) if formula_with_that_name.file?
|
||||
|
||||
possible_alias = CoreTap.instance.alias_dir/ref
|
||||
return AliasLoader.new(possible_alias) if possible_alias.file?
|
||||
|
||||
if !CoreTap.instance.installed? &&
|
||||
Homebrew::EnvConfig.install_from_api? &&
|
||||
Homebrew::API::Formula.all_formulae.key?(ref)
|
||||
return FormulaAPILoader.new(ref)
|
||||
end
|
||||
|
||||
possible_tap_formulae = tap_paths(ref)
|
||||
raise TapFormulaAmbiguityError.new(ref, possible_tap_formulae) if possible_tap_formulae.size > 1
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user