Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#curl_download: default try_partial to false #13179

Merged
merged 1 commit into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions Library/Homebrew/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy

def initialize(url, name, version, **meta)
super
@try_partial = true
@mirrors = meta.fetch(:mirrors, [])
end

Expand Down Expand Up @@ -523,7 +524,7 @@ def _fetch(url:, resolved_url:, timeout:)
end

def _curl_download(resolved_url, to, timeout)
curl_download resolved_url, to: to, timeout: timeout
curl_download resolved_url, to: to, try_partial: @try_partial, timeout: timeout
end

# Curl options to be always passed to curl,
Expand Down Expand Up @@ -577,7 +578,7 @@ class HomebrewCurlDownloadStrategy < CurlDownloadStrategy
def _curl_download(resolved_url, to, timeout)
raise HomebrewCurlDownloadStrategyError, url unless Formula["curl"].any_version_installed?

curl_download resolved_url, to: to, timeout: timeout, use_homebrew_curl: true
curl_download resolved_url, to: to, try_partial: @try_partial, timeout: timeout, use_homebrew_curl: true
end
end

Expand Down Expand Up @@ -656,7 +657,7 @@ def _fetch(url:, resolved_url:, timeout:)
query.nil? ? [url, "-X", "POST"] : [url, "-d", query]
end

curl_download(*args, to: temporary_path, timeout: timeout)
curl_download(*args, to: temporary_path, try_partial: @try_partial, timeout: timeout)
end
end

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/utils/curl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def curl(*args, print_stdout: true, **options)
result
end

def curl_download(*args, to: nil, try_partial: true, **options)
def curl_download(*args, to: nil, try_partial: false, **options)
destination = Pathname(to)
destination.dirname.mkpath

Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/utils/spdx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def latest_tag

def download_latest_license_data!(to: DATA_PATH)
data_url = "https://raw.githubusercontent.com/spdx/license-list-data/#{latest_tag}/json/"
curl_download("#{data_url}licenses.json", to: to/"spdx_licenses.json", try_partial: false)
curl_download("#{data_url}exceptions.json", to: to/"spdx_exceptions.json", try_partial: false)
curl_download("#{data_url}licenses.json", to: to/"spdx_licenses.json")
curl_download("#{data_url}exceptions.json", to: to/"spdx_exceptions.json")
end

def parse_license_expression(license_expression)
Expand Down