Skip to content

Commit

Permalink
Add fallback for Qt downloads
Browse files Browse the repository at this point in the history
Proposed by @dtinth
The CI used to fail quickly on network errors. This introduces a retry of the whole aqt install-qt run on failure.

Co-authored-by: Christian Hoffmann <christian@hoffie.info>
Co-authored-by: ann0see <ann0see@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 21, 2022
1 parent 9ec578c commit 72357da
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions autobuild/windows/autobuild_windowsinstaller_1_prepare.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ param(
# Fail early on all errors
$ErrorActionPreference = "Stop"

Function Install-Qt {
param(
[string] $QtVersion,
[string] $QtArch,
[string] $InstallDir
)
$Args = ("--outputdir", "$InstallDir", "windows", "desktop", "$QtVersion", "$QtArch")
aqt install-qt @Args
if ( !$? )
{
echo "WARNING: Qt installation via first aqt run failed, re-starting with different base URL."
aqt install-qt @Args -b https://mirrors.ocf.berkeley.edu/qt/
if ( !$? )
{
throw "Qt installation with args @Arguments failed with exit code $LastExitCode"
}
}
}

###################
### PROCEDURE ###
###################
Expand All @@ -25,7 +44,8 @@ $Qt32Version = "5.15.2"
$Qt64Version = "5.15.2"
$AqtinstallVersion = "2.0.5"
$JackVersion = "1.9.17"
$MsvcVersion = "2019"
$Msvc32Version = "win32_msvc2019"
$Msvc64Version = "win64_msvc2019_64"

if ( Test-Path -Path $QtDir )
{
Expand All @@ -42,20 +62,10 @@ else
}

echo "Get Qt 64 bit..."
# intermediate solution if the main server is down: append e.g. " -b https://mirrors.ocf.berkeley.edu/qt/" to the "aqt"-line below
aqt install-qt --outputdir "${QtDir}" windows desktop "${Qt64Version}" "win64_msvc${MsvcVersion}_64"
if ( !$? )
{
throw "64bit Qt installation failed with exit code $LastExitCode"
}
Install-Qt ${Qt64Version} ${Msvc64Version} ${QtDir}

echo "Get Qt 32 bit..."
# intermediate solution if the main server is down: append e.g. " -b https://mirrors.ocf.berkeley.edu/qt/" to the "aqt"-line below
aqt install-qt --outputdir "${QtDir}" windows desktop "${Qt32Version}" "win32_msvc${MsvcVersion}"
if ( !$? )
{
throw "32bit Qt installation failed with exit code $LastExitCode"
}
Install-Qt ${Qt32Version} ${Msvc32Version} ${QtDir}
}


Expand Down

0 comments on commit 72357da

Please sign in to comment.