bump: fix tests
This commit is contained in:
parent
5889b44a60
commit
c952ea7358
@ -351,10 +351,11 @@ export HOMEBREW_COMMAND_DEPTH="$((HOMEBREW_COMMAND_DEPTH + 1))"
|
|||||||
setup_curl() {
|
setup_curl() {
|
||||||
# This is set by the user environment.
|
# This is set by the user environment.
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" && -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]] &&
|
HOMEBREW_BREWED_CURL_PATH="${HOMEBREW_PREFIX}/opt/curl/bin/curl"
|
||||||
"${HOMEBREW_PREFIX}/opt/curl/bin/curl" --version &>/dev/null
|
if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" && -x "${HOMEBREW_BREWED_CURL_PATH}" ]] &&
|
||||||
|
"${HOMEBREW_BREWED_CURL_PATH}" --version &>/dev/null
|
||||||
then
|
then
|
||||||
HOMEBREW_CURL="${HOMEBREW_PREFIX}/opt/curl/bin/curl"
|
HOMEBREW_CURL="${HOMEBREW_BREWED_CURL_PATH}"
|
||||||
elif [[ -n "${HOMEBREW_DEVELOPER}" && -x "${HOMEBREW_CURL_PATH}" ]]
|
elif [[ -n "${HOMEBREW_DEVELOPER}" && -x "${HOMEBREW_CURL_PATH}" ]]
|
||||||
then
|
then
|
||||||
HOMEBREW_CURL="${HOMEBREW_CURL_PATH}"
|
HOMEBREW_CURL="${HOMEBREW_CURL_PATH}"
|
||||||
@ -592,6 +593,7 @@ export HOMEBREW_CELLAR
|
|||||||
export HOMEBREW_SYSTEM
|
export HOMEBREW_SYSTEM
|
||||||
export HOMEBREW_SYSTEM_CA_CERTIFICATES_TOO_OLD
|
export HOMEBREW_SYSTEM_CA_CERTIFICATES_TOO_OLD
|
||||||
export HOMEBREW_CURL
|
export HOMEBREW_CURL
|
||||||
|
export HOMEBREW_BREWED_CURL_PATH
|
||||||
export HOMEBREW_CURL_WARNING
|
export HOMEBREW_CURL_WARNING
|
||||||
export HOMEBREW_SYSTEM_CURL_TOO_OLD
|
export HOMEBREW_SYSTEM_CURL_TOO_OLD
|
||||||
export HOMEBREW_GIT
|
export HOMEBREW_GIT
|
||||||
|
@ -56,15 +56,14 @@ module Homebrew
|
|||||||
|
|
||||||
limit = args.limit.to_i if args.limit.present?
|
limit = args.limit.to_i if args.limit.present?
|
||||||
|
|
||||||
unless quiet_system(HOMEBREW_SHIMS_PATH/"shared/curl", "--tlsv1.3", "--head", "https://repology.org/")
|
unless Utils::Curl.curl_supports_tls13?
|
||||||
begin
|
begin
|
||||||
brewed_curl = Formula["curl"]
|
unless Pathname.new(ENV["HOMEBREW_BREWED_CURL_PATH"]).exist?
|
||||||
unless brewed_curl.any_version_installed?
|
|
||||||
ohai "Installing `curl` for Repology queries..."
|
ohai "Installing `curl` for Repology queries..."
|
||||||
safe_system HOMEBREW_BREW_FILE, "install", "--formula", brewed_curl.full_name
|
safe_system HOMEBREW_BREW_FILE, "install", "--formula", Formula["curl"].full_name
|
||||||
end
|
end
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
opoo "A `curl` with TLS 1.3 support is required for Repology queries"
|
opoo "A `curl` with TLS 1.3 support is required for Repology queries."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -170,12 +170,12 @@ RSpec.configure do |config|
|
|||||||
end
|
end
|
||||||
|
|
||||||
config.before(:each, :needs_tls13) do
|
config.before(:each, :needs_tls13) do
|
||||||
begin
|
unless curl_supports_tls13?
|
||||||
curl = Utils::Curl.curl_executable(use_homebrew_curl: OS.mac?)
|
ENV["HOMEBREW_CURL"] = ENV["HOMEBREW_BREWED_CURL_PATH"]
|
||||||
rescue FormulaUnavailableError
|
skip "A `curl` with TLS 1.3 support is required." unless curl_supports_tls13?
|
||||||
skip "curl formula not available"
|
|
||||||
end
|
end
|
||||||
skip "Requires curl with TLS 1.3 support." unless quiet_system curl, "--tlsv1.3", "--head", "https://brew.sh/"
|
rescue FormulaUnavailableError
|
||||||
|
skip "No `curl` formula is available."
|
||||||
end
|
end
|
||||||
|
|
||||||
config.before(:each, :needs_unzip) do
|
config.before(:each, :needs_unzip) do
|
||||||
|
@ -22,7 +22,8 @@ describe Repology do
|
|||||||
describe "parse_api_response", :needs_network, :needs_tls13 do
|
describe "parse_api_response", :needs_network, :needs_tls13 do
|
||||||
it "returns a hash of data" do
|
it "returns a hash of data" do
|
||||||
limit = 1
|
limit = 1
|
||||||
response = described_class.parse_api_response(limit, repository: "homebrew")
|
start_with = "x"
|
||||||
|
response = described_class.parse_api_response(limit, start_with, repository: "homebrew")
|
||||||
|
|
||||||
expect(response).not_to be_nil
|
expect(response).not_to be_nil
|
||||||
expect(response).to be_a(Hash)
|
expect(response).to be_a(Hash)
|
||||||
|
@ -17,7 +17,7 @@ module Utils
|
|||||||
module_function
|
module_function
|
||||||
|
|
||||||
def curl_executable(use_homebrew_curl: false)
|
def curl_executable(use_homebrew_curl: false)
|
||||||
return Formula["curl"].opt_bin/"curl" if use_homebrew_curl
|
return Pathname.new(ENV["HOMEBREW_BREWED_CURL_PATH"]) if use_homebrew_curl
|
||||||
|
|
||||||
@curl_executable ||= HOMEBREW_SHIMS_PATH/"shared/curl"
|
@curl_executable ||= HOMEBREW_SHIMS_PATH/"shared/curl"
|
||||||
end
|
end
|
||||||
@ -357,10 +357,11 @@ module Utils
|
|||||||
file.unlink
|
file.unlink
|
||||||
end
|
end
|
||||||
|
|
||||||
def homebrew_curl_available?
|
def curl_supports_tls13?
|
||||||
Formulary.factory("curl").present?
|
@curl_supports_tls13 ||= Hash.new do |h, key|
|
||||||
rescue FormulaUnavailableError
|
h[key] = quiet_system(curl_executable, "--tlsv1.3", "--head", "https://brew.sh/")
|
||||||
false
|
end
|
||||||
|
@curl_supports_tls13[ENV["HOMEBREW_CURL"]]
|
||||||
end
|
end
|
||||||
|
|
||||||
def http_status_ok?(status)
|
def http_status_ok?(status)
|
||||||
|
@ -19,7 +19,7 @@ module Repology
|
|||||||
last_package_in_response += "/" if last_package_in_response.present?
|
last_package_in_response += "/" if last_package_in_response.present?
|
||||||
url = "https://repology.org/api/v1/projects/#{last_package_in_response}?inrepo=#{repository}&outdated=1"
|
url = "https://repology.org/api/v1/projects/#{last_package_in_response}?inrepo=#{repository}&outdated=1"
|
||||||
|
|
||||||
output, _errors, _status = curl_output(url.to_s, use_homebrew_curl: OS.mac?)
|
output, _errors, _status = curl_output(url.to_s, use_homebrew_curl: !curl_supports_tls13?)
|
||||||
JSON.parse(output)
|
JSON.parse(output)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ module Repology
|
|||||||
url = "https://repology.org/tools/project-by?repo=#{repository}&" \
|
url = "https://repology.org/tools/project-by?repo=#{repository}&" \
|
||||||
"name_type=srcname&target_page=api_v1_project&name=#{name}"
|
"name_type=srcname&target_page=api_v1_project&name=#{name}"
|
||||||
|
|
||||||
output, _errors, _status = curl_output("--location", url.to_s, use_homebrew_curl: OS.mac?)
|
output, _errors, _status = curl_output("--location", url.to_s, use_homebrew_curl: !curl_supports_tls13?)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
data = JSON.parse(output)
|
data = JSON.parse(output)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user