Merge pull request #12333 from Rylan12/install-from-api-fixes

`HOMEBREW_INSTALL_FROM_API` fixes
This commit is contained in:
Mike McQuaid 2021-10-27 12:06:42 +01:00 committed by GitHub
commit 5c5a701135
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 5 deletions

View File

@ -138,6 +138,7 @@ module Homebrew
end end
args.named.each do |name| args.named.each do |name|
next if EnvConfig.install_from_api?
next if File.exist?(name) next if File.exist?(name)
next if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX next if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX

View File

@ -591,6 +591,8 @@ module Homebrew
def check_coretap_integrity def check_coretap_integrity
coretap = CoreTap.instance coretap = CoreTap.instance
return if !coretap.installed? && EnvConfig.install_from_api?
broken_tap(coretap) || examine_git_origin(coretap.path, Homebrew::EnvConfig.core_git_remote) broken_tap(coretap) || examine_git_origin(coretap.path, Homebrew::EnvConfig.core_git_remote)
end end
@ -722,6 +724,8 @@ module Homebrew
end end
repos.each do |name, path| repos.each do |name, path|
next unless path.exist?
status = path.cd do status = path.cd do
`git status --untracked-files=all --porcelain 2>/dev/null` `git status --untracked-files=all --porcelain 2>/dev/null`
end end
@ -877,11 +881,13 @@ module Homebrew
end end
def check_deleted_formula def check_deleted_formula
keg_names = Keg.all.map(&:name).uniq kegs = Keg.all
deleted_formulae = keg_names.map do |keg_name| deleted_formulae = kegs.map do |keg|
keg_name if Formulary.tap_paths(keg_name).blank? next if !CoreTap.instance.installed? && EnvConfig.install_from_api? && Tab.for_keg(keg).tap.core_tap?
end.compact
keg.name if Formulary.tap_paths(keg.name).blank?
end.compact.uniq
return if deleted_formulae.blank? return if deleted_formulae.blank?

View File

@ -191,7 +191,9 @@ module Homebrew
}, },
HOMEBREW_INSTALL_FROM_API: { HOMEBREW_INSTALL_FROM_API: {
description: "If set, install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew's " \ description: "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.", "API instead of needing (large, slow) local checkouts of these repositories." \
"\n\n *Note:* Setting HOMEBREW_INSTALL_FROM_API is not compatible with Homebrew's " \
"developer mode so will error (as Homebrew development needs a full clone).",
boolean: true, boolean: true,
}, },
HOMEBREW_LIVECHECK_WATCHLIST: { HOMEBREW_LIVECHECK_WATCHLIST: {

View File

@ -2032,6 +2032,8 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
- `HOMEBREW_INSTALL_FROM_API` - `HOMEBREW_INSTALL_FROM_API`
<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. <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.
*Note:* Users with developer mode enabled cannot set HOMEBREW_INSTALL_FROM_API.
- `HOMEBREW_LIVECHECK_WATCHLIST` - `HOMEBREW_LIVECHECK_WATCHLIST`
<br>Consult this file for the list of formulae to check by default when no formula argument is passed to `brew livecheck`. <br>Consult this file for the list of formulae to check by default when no formula argument is passed to `brew livecheck`.

View File

@ -2933,6 +2933,9 @@ Print this text before the installation summary of each successful build\.
.br .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\. 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 Users with developer mode enabled cannot set HOMEBREW_INSTALL_FROM_API\.
.
.TP .TP
\fBHOMEBREW_LIVECHECK_WATCHLIST\fR \fBHOMEBREW_LIVECHECK_WATCHLIST\fR
. .