Skip to content

Commit

Permalink
Merge pull request #43 from f-fr/multiple-urls
Browse files Browse the repository at this point in the history
Changes `download_url` to `download_urls` returning a list of
  • Loading branch information
docelic authored Jul 16, 2021
2 parents 409db7f + 44f11f0 commit b60fe3d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions support/generate_bindings.cr
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ struct QtVersion
"qt-everywhere#{@infix}-src-#{@name}.0"
end

def download_url
"https://download.qt.io/archive/qt/#{@name}/#{@name}.0/single/#{base_name}.tar.xz"
def download_urls
["https://download.qt.io/archive/qt/#{@name}/#{@name}.0/single/#{base_name}.tar.xz",
"https://download.qt.io/new_archive/qt/#{@name}/#{@name}.0/single/#{base_name}.tar.xz"]
end

def path
Expand Down Expand Up @@ -92,18 +93,23 @@ end
def download_missing_qts(versions)
urls = versions
.reject{|v| File.file? v.archive_path}
.map{|v| v.download_url}
.map{|v| v.download_urls}

if urls.empty?
report_step "All Qt sources already present"
return
end

arguments = [ "--remote-name-all", "--location" ] + urls

report_step "Downloading missing Qt sources (#{versions.map{|v|v.name}.join(", ")})"
Dir.cd TEMPDIR do
system("curl", arguments)

urls.each do |version_urls|
version_urls.each do |url|
arguments = [ "--fail", "--remote-name-all", "--location", url ]

break if Dir.cd TEMPDIR do
system("curl", arguments)
end
end
end
end

Expand Down

0 comments on commit b60fe3d

Please sign in to comment.