Add HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK
This fits the use-case I've heard multiple times where people want to rely exclusively on their artifact provider. Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
This commit is contained in:
parent
960b1ebbb0
commit
a37864da0f
@ -47,6 +47,11 @@ set_ruby_variables() {
|
||||
if [[ -n "${HOMEBREW_ARTIFACT_DOMAIN}" ]]
|
||||
then
|
||||
ruby_URLs+=("${HOMEBREW_ARTIFACT_DOMAIN}/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:${ruby_SHA}")
|
||||
if [[ -n "${HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK}" ]]
|
||||
then
|
||||
ruby_URL="${ruby_URLs[0]}"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
if [[ -n "${HOMEBREW_BOTTLE_DOMAIN}" ]]
|
||||
then
|
||||
|
||||
@ -405,6 +405,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
||||
|
||||
if (domain = Homebrew::EnvConfig.artifact_domain)
|
||||
url = url.sub(%r{^https?://#{GitHubPackages::URL_DOMAIN}/}o, "#{domain.chomp("/")}/")
|
||||
urls = [] if Homebrew::EnvConfig.artifact_domain_no_fallback?
|
||||
end
|
||||
|
||||
ohai "Downloading #{url}"
|
||||
|
||||
@ -44,6 +44,12 @@ module Homebrew
|
||||
"to instead be downloaded from " \
|
||||
"`http://localhost:8080/v2/homebrew/core/gettext/manifests/0.21`",
|
||||
},
|
||||
HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK: {
|
||||
description: "If `HOMEBREW_ARTIFACT_DOMAIN` and `HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK` are both set, " \
|
||||
"if the request to `HOMEBREW_ARTIFACT_DOMAIN` fails then it Homebrew will error rather than " \
|
||||
"trying any other/default URLs.",
|
||||
boolean: true,
|
||||
},
|
||||
HOMEBREW_AUTO_UPDATE_SECS: {
|
||||
description: "Run `brew update` once every `HOMEBREW_AUTO_UPDATE_SECS` seconds before some commands, " \
|
||||
"e.g. `brew install`, `brew upgrade` and `brew tap`. Alternatively, " \
|
||||
|
||||
@ -237,8 +237,12 @@ class Resource < Downloadable
|
||||
# glibc-bootstrap
|
||||
if url.start_with?("https://github.com/Homebrew/glibc-bootstrap/releases/download")
|
||||
if (artifact_domain = Homebrew::EnvConfig.artifact_domain.presence)
|
||||
extra_urls << url.sub("https://github.com", artifact_domain)
|
||||
artifact_url = url.sub("https://github.com", artifact_domain)
|
||||
return [artifact_url] if Homebrew::EnvConfig.artifact_domain_no_fallback?
|
||||
|
||||
extra_urls << artifact_url
|
||||
end
|
||||
|
||||
if Homebrew::EnvConfig.bottle_domain != HOMEBREW_BOTTLE_DEFAULT_DOMAIN
|
||||
tag, filename = url.split("/").last(2)
|
||||
extra_urls << "#{Homebrew::EnvConfig.bottle_domain}/glibc-bootstrap/#{tag}/#{filename}"
|
||||
|
||||
@ -25,6 +25,9 @@ module Homebrew::EnvConfig
|
||||
sig { returns(T.nilable(::String)) }
|
||||
def artifact_domain; end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def artifact_domain_no_fallback?; end
|
||||
|
||||
sig { returns(T.nilable(::String)) }
|
||||
def auto_update_secs; end
|
||||
|
||||
|
||||
@ -3510,6 +3510,12 @@ command execution e.g. `$(cat file)`.
|
||||
downloaded from
|
||||
`http://localhost:8080/v2/homebrew/core/gettext/manifests/0.21`
|
||||
|
||||
`HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK`
|
||||
|
||||
: If `HOMEBREW_ARTIFACT_DOMAIN` and `HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK` are
|
||||
both set, if the request to `HOMEBREW_ARTIFACT_DOMAIN` fails then it Homebrew
|
||||
will error rather than trying any other/default URLs.
|
||||
|
||||
`HOMEBREW_AUTO_UPDATE_SECS`
|
||||
|
||||
: Run `brew update` once every `HOMEBREW_AUTO_UPDATE_SECS` seconds before some
|
||||
|
||||
@ -2244,6 +2244,9 @@ Linux only: Pass this value to a type name representing the compiler\[u2019]s \f
|
||||
\fBHOMEBREW_ARTIFACT_DOMAIN\fP
|
||||
Prefix all download URLs, including those for bottles, with this value\. For example, \fBHOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080\fP will cause a formula with the URL \fBhttps://example\.com/foo\.tar\.gz\fP to instead download from \fBhttp://localhost:8080/https://example\.com/foo\.tar\.gz\fP\&\. Bottle URLs however, have their domain replaced with this prefix\. This results in e\.g\. \fBhttps://ghcr\.io/v2/homebrew/core/gettext/manifests/0\.21\fP to instead be downloaded from \fBhttp://localhost:8080/v2/homebrew/core/gettext/manifests/0\.21\fP
|
||||
.TP
|
||||
\fBHOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK\fP
|
||||
If \fBHOMEBREW_ARTIFACT_DOMAIN\fP and \fBHOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK\fP are both set, if the request to \fBHOMEBREW_ARTIFACT_DOMAIN\fP fails then it Homebrew will error rather than trying any other/default URLs\.
|
||||
.TP
|
||||
\fBHOMEBREW_AUTO_UPDATE_SECS\fP
|
||||
Run \fBbrew update\fP once every \fBHOMEBREW_AUTO_UPDATE_SECS\fP seconds before some commands, e\.g\. \fBbrew install\fP, \fBbrew upgrade\fP and \fBbrew tap\fP\&\. Alternatively, disable auto\-update entirely with \fBHOMEBREW_NO_AUTO_UPDATE\fP\&\.
|
||||
.RS
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user