utils/repology: temporarily disable functionality.

Doesn't work with system `curl` currently.
This commit is contained in:
Mike McQuaid 2021-06-30 08:51:33 +01:00
parent 5a5db3ab96
commit 1680ddb267
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
2 changed files with 23 additions and 16 deletions

View File

@ -14,8 +14,11 @@ describe Repology do
it "returns a hash for existing package" do
response = described_class.single_package_query("openclonk", repository: "homebrew")
expect(response).not_to be_nil
expect(response).to be_a(Hash)
expect(response).to be_nil
# TODO: uncomment (and remove line above) when we have a fix for Repology
# `curl` issues
# expect(response).not_to be_nil
# expect(response).to be_a(Hash)
end
end

View File

@ -15,26 +15,30 @@ module Repology
MAX_PAGINATION = 15
private_constant :MAX_PAGINATION
def query_api(last_package_in_response = "", repository:)
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"
def query_api(_last_package_in_response = "", repository:)
{}
# TODO: uncomment (and remove lines above) when we have a fix for Repology
# `curl` issues
# 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"
output, _errors, _status = curl_output(url.to_s)
JSON.parse(output)
# output, _errors, _status = curl_output(url.to_s)
# JSON.parse(output)
end
def single_package_query(name, repository:)
url = "https://repology.org/tools/project-by?repo=#{repository}&" \
"name_type=srcname&target_page=api_v1_project&name=#{name}"
# TODO: uncomment when we have a fix for Repology `curl` issues
# url = "https://repology.org/tools/project-by?repo=#{repository}&" \
# "name_type=srcname&target_page=api_v1_project&name=#{name}"
output, _errors, _status = curl_output("--location", url.to_s)
# output, _errors, _status = curl_output("--location", url.to_s)
begin
data = JSON.parse(output)
{ name => data }
rescue
nil
end
# begin
# data = JSON.parse(output)
# { name => data }
# rescue
# nil
# end
end
def parse_api_response(limit = nil, repository:)