Skip to content

Commit

Permalink
[Qt] Try mirrors if main server is down
Browse files Browse the repository at this point in the history
  • Loading branch information
Osyotr committed Nov 10, 2023
1 parent f5c5b8d commit 3ccd9f9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ports/qtbase/cmake/qt_install_submodule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ function(qt_download_submodule_impl)
set(sha512 SHA512 "${${_qarg_SUBMODULE}_HASH}")
endif()

qt_get_url_filename("${_qarg_SUBMODULE}" url filename)
qt_get_url_filename("${_qarg_SUBMODULE}" urls filename)
vcpkg_download_distfile(archive
URLS "${url}"
URLS ${urls}
FILENAME "${filename}"
${sha512}
)
Expand Down
24 changes: 16 additions & 8 deletions ports/qtbase/cmake/qt_port_details.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,31 @@ set(QT_FROM_QT_GIT qtinterfaceframework)
#set(QT_FROM_QT_GIT ${QT_PORTS})
#list(POP_FRONT QT_FROM_QT_GIT)

function(qt_get_url_filename qt_port out_url out_filename)
function(qt_get_url_filename qt_port out_urls out_filename)
if("${qt_port}" IN_LIST QT_FROM_GITHUB)
set(url "https://github.com/qt/${qt_port}/archive/v${QT_VERSION}.tar.gz")
set(urls "https://github.com/qt/${qt_port}/archive/v${QT_VERSION}.tar.gz")
set(filename "qt-${qt_port}-v${QT_VERSION}.tar.gz")
elseif("${qt_port}" IN_LIST QT_FROM_GITHUB_BRANCH)
set(url "https://github.com/qt/${qt_port}/archive/${QT_VERSION}.tar.gz")
set(urls "https://github.com/qt/${qt_port}/archive/${QT_VERSION}.tar.gz")
set(filename "qt-${qt_port}-${QT_VERSION}.tar.gz")
else()
string(SUBSTRING "${QT_VERSION}" 0 3 qt_major_minor)

if(NOT QT_DEV_BRANCH)
set(url "https://download.qt.io/archive/qt/${qt_major_minor}/${QT_VERSION}/submodules/${qt_port}-everywhere-src-${QT_VERSION}.tar.xz")
set(branch_subpath "archive")
else()
set(url "https://download.qt.io/development_releases/qt/${qt_major_minor}/${QT_VERSION}/submodules/${qt_port}-everywhere-src-${QT_VERSION}.tar.xz")
set(branch_subpath "development_releases")
endif()

set(filename "${qt_port}-everywhere-src-${QT_VERSION}.tar.xz")
set(mirrors
"https://download.qt.io/"
"https://mirrors.ocf.berkeley.edu/qt/"
)
set(url_subpath "${branch_subpath}/qt/${qt_major_minor}/${QT_VERSION}/submodules/${filename}")
list(TRANSFORM mirrors APPEND url_subpath OUTPUT_VARIABLE urls)
endif()
set(${out_url} "${url}" PARENT_SCOPE)
set(${out_urls} ${urls} PARENT_SCOPE)
set(${out_filename} "${filename}" PARENT_SCOPE)
endfunction()

Expand Down Expand Up @@ -145,9 +153,9 @@ if(QT_UPDATE_VERSION)
string(SUBSTRING "${out}" 0 40 tag_sha)
string(APPEND msg "set(${qt_port}_REF ${tag_sha})\n")
else()
qt_get_url_filename("${qt_port}" url filename)
qt_get_url_filename("${qt_port}" urls filename)
vcpkg_download_distfile(archive
URLS "${url}"
URLS ${urls}
FILENAME "${filename}"
SKIP_SHA512
)
Expand Down
1 change: 1 addition & 0 deletions ports/qtbase/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "qtbase",
"version": "6.6.0",
"port-version": 1,
"description": "Qt Application Framework Base Module. Includes Core, GUI, Widgets, Networking, SQL, Concurrent and other essential qt components.",
"homepage": "https://www.qt.io/",
"license": null,
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7050,7 +7050,7 @@
},
"qtbase": {
"baseline": "6.6.0",
"port-version": 0
"port-version": 1
},
"qtcharts": {
"baseline": "6.6.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/q-/qtbase.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2bc851f8fa28687fcfd1128b49a1a48cb5896ab8",
"version": "6.6.0",
"port-version": 1
},
{
"git-tree": "eb1e1a00df34c350c817ee3d9ab90d2c52ced194",
"version": "6.6.0",
Expand Down

0 comments on commit 3ccd9f9

Please sign in to comment.