Skip to content

Commit

Permalink
Retry Chocolatey install to workaround failures
Browse files Browse the repository at this point in the history
    Automatically retry up to 3 times on failure when installing
    Chocolatey modules, using the 'appveyor-retry' script.  This can be
    removed later if needed.

    Sometimes Chocolatey returns a 404 for a package that exists.  This
    happens a lot.  The official fix is to get the Business edition for
    the more-stable private CDN, but since we're an open-source community
    effort, sometimes a little kludgery goes a long way.

    See http://help.appveyor.com/discussions/suggestions/816-generic-wrapper-for-retry#comment_40579488
    And appveyor/ci#418
  • Loading branch information
digitalcircuit authored and TheOneRing committed Dec 13, 2016
1 parent de38ee8 commit c603d04
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions appveyorHelp.psm1
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Write-Host "Appveyor Helper scrips https://github.com/TheOneRing/appVeyorHelp"

$ErrorActionPreference="Stop"

$script:INSTALL_DIR="$env:APPVEYOR_BUILD_FOLDER\work\install"
Expand Down Expand Up @@ -71,14 +69,25 @@ function SETUP-QT()
$script:QT_BINARY_DIRS = @($qtDir)

BAT-CALL "$qtDir\bin\qtenv2.bat"
if ($compiler.StartsWith("mingw49"))

if ($compiler.StartsWith("mingw"))
{
# supported values are
#mingw49_32
#mingw53_32
#remove sh.exe from path
$env:PATH=$env:PATH -replace "C:\\Program Files \(x86\)\\Git\\bin", ""
$script:MAKE="mingw32-make"
$script:CMAKE_GENERATOR="MinGW Makefiles"
$script:STRIP=@("strip", "-s")
$script:QT_BINARY_DIRS += (Resolve-Path "$qtDir\..\..\Tools\mingw492_32\opt\")
if ($compiler -eq "mingw49_32")
{
$script:QT_BINARY_DIRS += (Resolve-Path "$qtDir\..\..\Tools\mingw492_32\opt\")
}
elseif ($compiler -eq "mingw53_32")
{
$script:QT_BINARY_DIRS += (Resolve-Path "$qtDir\..\..\Tools\mingw530_32\opt\")
}
}
elseif ($compiler.StartsWith("msvc"))
{
Expand Down Expand Up @@ -110,10 +119,13 @@ function SETUP-QT()
}
}

function Install-ChocolatelyModule([string] $module, [string[]] $myargs)
function Install-ChocolateyModule([string] $module, [string[]] $myargs)
{
Write-Host "Install chocolately package $module"
LogExec cinst $module @myargs -y
Write-Host "Install chocolatey package $module"
LogExec appveyor-retry cinst $module @myargs -y
# Retry installation in case it fails; remove 'appveyor-retry' to run in a generic manner
# See http://help.appveyor.com/discussions/suggestions/816-generic-wrapper-for-retry#comment_40579488
# And https://github.com/appveyor/ci/issues/418
}

function Install-CmakeGitModule([string] $url, [hashtable] $arguments)
Expand Down Expand Up @@ -162,10 +174,10 @@ function Init([string[]] $chocoDeps, [System.Collections.Specialized.OrderedDict
foreach($module in $chocoDeps) {
if($module -eq "nsis")
{
Install-ChocolatelyModule "nsis.portable" @("-pre")
Install-ChocolateyModule "nsis.portable" @("-pre")
continue
}
Install-ChocolatelyModule $module
Install-ChocolateyModule $module
}

foreach($key in $cmakeModules.Keys) {
Expand Down

0 comments on commit c603d04

Please sign in to comment.