diff --git a/Library/Homebrew/cmd/formulae.sh b/Library/Homebrew/cmd/formulae.sh index 9812e9ce3c..b7fec73180 100644 --- a/Library/Homebrew/cmd/formulae.sh +++ b/Library/Homebrew/cmd/formulae.sh @@ -13,7 +13,9 @@ homebrew-formulae() { # HOMEBREW_CACHE is set by brew.sh # shellcheck disable=SC2154 - if [[ -n "${HOMEBREW_INSTALL_FROM_API}" && -f "${HOMEBREW_CACHE}/api/formula.json" ]] + if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" && + -n "${HOMEBREW_INSTALL_FROM_API}" && + -f "${HOMEBREW_CACHE}/api/formula.json" ]] then local api_formulae api_formulae="$(ruby -e "require 'json'; JSON.parse(File.read('${HOMEBREW_CACHE}/api/formula.json')).each { |f| puts f['name'] }" 2>/dev/null)" diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index a21f0eae4d..ba3fb8de9c 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -385,6 +385,12 @@ user account: EOS fi + if [[ -d "${HOMEBREW_CORE_REPOSITORY}" ]] || + [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" && -n "${HOMEBREW_INSTALL_FROM_API}" ]] + then + HOMEBREW_CORE_AVAILABLE="1" + fi + if [[ ! -w "${HOMEBREW_REPOSITORY}" ]] then odie <` will not upgrade `` if it is installed but " \ "outdated.", @@ -478,5 +482,10 @@ module Homebrew def cask_opts_require_sha? cask_opts.include?("--require-sha") end + + sig { returns(T::Boolean) } + def install_from_api? + ENV["HOMEBREW_NO_INSTALL_FROM_API"].blank? && ENV["HOMEBREW_INSTALL_FROM_API"].present? + end end end diff --git a/docs/Manpage.md b/docs/Manpage.md index 1dff56dc4c..1e4fb74d13 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -2151,8 +2151,6 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just - `HOMEBREW_INSTALL_FROM_API`
If set, install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew's API instead of needing (large, slow) local checkouts of these repositories. - *Note:* Setting HOMEBREW_INSTALL_FROM_API is not compatible with Homebrew's developer mode so will error (as Homebrew development needs a full clone). - - `HOMEBREW_LIVECHECK_WATCHLIST`
Consult this file for the list of formulae to check by default when no formula argument is passed to `brew livecheck`. @@ -2210,6 +2208,9 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just - `HOMEBREW_NO_INSTALL_CLEANUP`
If set, `brew install`, `brew upgrade` and `brew reinstall` will never automatically cleanup installed/upgraded/reinstalled formulae or all formulae every `HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS` days. Alternatively, HOMEBREW_NO_CLEANUP_FORMULAE allows specifying specific formulae to not clean up. +- `HOMEBREW_NO_INSTALL_FROM_API` +
If set, do not install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew's API even if `HOMEBREW_INSTALL_FROM_API` is set and instead use (large, slow) local checkouts of these repositories. + - `HOMEBREW_NO_INSTALL_UPGRADE`
If set, `brew install *`formula`*` will not upgrade `*`formula`*` if it is installed but outdated. diff --git a/manpages/brew.1 b/manpages/brew.1 index 85b8a4a71a..8df46bb35f 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -3142,9 +3142,6 @@ Print this text before the installation summary of each successful build\. .br If set, install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew\'s API instead of needing (large, slow) local checkouts of these repositories\. . -.IP -\fINote:\fR Setting HOMEBREW_INSTALL_FROM_API is not compatible with Homebrew\'s developer mode so will error (as Homebrew development needs a full clone)\. -. .TP \fBHOMEBREW_LIVECHECK_WATCHLIST\fR . @@ -3254,6 +3251,12 @@ If set, forbid redirects from secure HTTPS to insecure HTTP\. If set, \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will never automatically cleanup installed/upgraded/reinstalled formulae or all formulae every \fBHOMEBREW_CLEANUP_PERIODIC_FULL_DAYS\fR days\. Alternatively, HOMEBREW_NO_CLEANUP_FORMULAE allows specifying specific formulae to not clean up\. . .TP +\fBHOMEBREW_NO_INSTALL_FROM_API\fR +. +.br +If set, do not install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew\'s API even if \fBHOMEBREW_INSTALL_FROM_API\fR is set and instead use (large, slow) local checkouts of these repositories\. +. +.TP \fBHOMEBREW_NO_INSTALL_UPGRADE\fR . .br