mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
resource: automatic determine mirrors for glibc-bootstrap
This commit is contained in:
parent
7a14ae6187
commit
46b3d24dd3
@ -78,8 +78,11 @@ class Resource
|
|||||||
end
|
end
|
||||||
|
|
||||||
def downloader
|
def downloader
|
||||||
@downloader ||= download_strategy.new(url, download_name, version,
|
return @downloader if @downloader.present?
|
||||||
mirrors: mirrors.dup, **specs)
|
|
||||||
|
url, *mirrors = determine_url_mirrors
|
||||||
|
@downloader = download_strategy.new(url, download_name, version,
|
||||||
|
mirrors: mirrors, **specs)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Removes /s from resource names; this allows Go package names
|
# Removes /s from resource names; this allows Go package names
|
||||||
@ -277,6 +280,23 @@ class Resource
|
|||||||
version unless version.null?
|
version unless version.null?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def determine_url_mirrors
|
||||||
|
extra_urls = []
|
||||||
|
|
||||||
|
# glibc-bootstrap
|
||||||
|
if url.start_with?("https://github.com/Homebrew/glibc-bootstrap/releases/download")
|
||||||
|
if Homebrew::EnvConfig.artifact_domain.present?
|
||||||
|
extra_urls << url.sub("https://github.com", Homebrew::EnvConfig.artifact_domain)
|
||||||
|
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}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
[*extra_urls, url, *mirrors].uniq
|
||||||
|
end
|
||||||
|
|
||||||
# A resource containing a Go package.
|
# A resource containing a Go package.
|
||||||
class Go < Resource
|
class Go < Resource
|
||||||
def stage(target, &block)
|
def stage(target, &block)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user