-
Notifications
You must be signed in to change notification settings - Fork 4k
compiler: add retry loop and enable allowEmptyChecksums on Windows #12962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+40
−7
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,20 @@ | ||
| choco install -y pkgconfiglite --allow-empty-checksums | ||
| choco feature enable -n allowEmptyChecksums | ||
|
|
||
| set RETRY=0 | ||
| :install_pkgconfig | ||
| choco install -y pkgconfiglite --allow-empty-checksums --force | ||
| if %ERRORLEVEL% neq 0 ( | ||
| if %RETRY% lss 3 ( | ||
| set /a RETRY=%RETRY%+1 | ||
| echo pkgconfiglite installation failed. Retrying %RETRY% of 3 in 5 seconds... | ||
| @rem Sleep for 5 seconds using the loopback ping trick (timeout command fails in non-interactive CI) | ||
| ping -n 6 127.0.0.1 >nul | ||
| goto :install_pkgconfig | ||
| ) | ||
| echo Failed to install pkgconfiglite after 3 attempts. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should either loop 2 times for this statement to hold true. Or we can say here- |
||
| exit /b 1 | ||
| ) | ||
|
|
||
| choco install -y openjdk --version=17.0 | ||
| set PATH=%PATH%;"c:\Program Files\OpenJDK\jdk-17\bin" | ||
| set PROTOBUF_VER=35.1 | ||
|
|
@@ -24,11 +40,11 @@ if not exist "%CMAKE_NAME%" ( | |
| set PATH=%PATH%;%cd%\%CMAKE_NAME%\bin | ||
| :hasCmake | ||
| @rem GitHub requires TLSv1.2, and for whatever reason our powershell doesn't have it enabled | ||
| powershell -command "$ProgressPreference = 'SilentlyContinue'; $ErrorActionPreference = 'stop'; & { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; iwr https://github.com/google/protobuf/releases/download/v%PROTOBUF_VER%/protobuf-%PROTOBUF_VER%.zip -OutFile protobuf.zip }" || exit /b 1 | ||
| powershell -command "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('protobuf.zip', '.') }" || exit /b 1 | ||
| call :RunPowershellWithRetry "$ProgressPreference = 'SilentlyContinue'; $ErrorActionPreference = 'stop'; & { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; iwr https://github.com/google/protobuf/releases/download/v%PROTOBUF_VER%/protobuf-%PROTOBUF_VER%.zip -OutFile protobuf.zip }" || exit /b 1 | ||
| call :RunPowershellWithRetry "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('protobuf.zip', '.') }" || exit /b 1 | ||
| del protobuf.zip | ||
| powershell -command "$ProgressPreference = 'SilentlyContinue'; $ErrorActionPreference = 'stop'; & { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; iwr https://github.com/abseil/abseil-cpp/archive/refs/tags/%ABSL_VERSION%.zip -OutFile absl.zip }" || exit /b 1 | ||
| powershell -command "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('absl.zip', '.') }" || exit /b 1 | ||
| call :RunPowershellWithRetry "$ProgressPreference = 'SilentlyContinue'; $ErrorActionPreference = 'stop'; & { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; iwr https://github.com/abseil/abseil-cpp/archive/refs/tags/%ABSL_VERSION%.zip -OutFile absl.zip }" || exit /b 1 | ||
| call :RunPowershellWithRetry "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('absl.zip', '.') }" || exit /b 1 | ||
| del absl.zip | ||
| move abseil-cpp-%ABSL_VERSION% protobuf-%PROTOBUF_VER%\third_party\abseil-cpp | ||
| mkdir protobuf-%PROTOBUF_VER%\build | ||
|
|
@@ -58,8 +74,25 @@ goto :eof | |
|
|
||
| :installCmake | ||
|
|
||
| powershell -command "$ErrorActionPreference = 'stop'; & { iwr https://cmake.org/files/v3.3/%CMAKE_NAME%.zip -OutFile cmake.zip }" || exit /b 1 | ||
| powershell -command "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('cmake.zip', '.') }" || exit /b 1 | ||
| call :RunPowershellWithRetry "$ErrorActionPreference = 'stop'; & { iwr https://cmake.org/files/v3.3/%CMAKE_NAME%.zip -OutFile cmake.zip }" || exit /b 1 | ||
| call :RunPowershellWithRetry "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('cmake.zip', '.') }" || exit /b 1 | ||
| del cmake.zip | ||
| goto :eof | ||
|
|
||
| @rem Helper to retry powershell commands (e.g. for transient network failures during iwr) | ||
| :RunPowershellWithRetry | ||
| set "PS_CMD=%~1" | ||
| set PS_RETRY=0 | ||
| :ps_retry_loop | ||
| powershell -command "%PS_CMD%" | ||
| if %ERRORLEVEL% equ 0 exit /b 0 | ||
| if %PS_RETRY% lss 3 ( | ||
| set /a PS_RETRY=%PS_RETRY%+1 | ||
| echo PowerShell command failed. Retrying %PS_RETRY% of 3 in 5 seconds... | ||
| ping -n 6 127.0.0.1 >nul | ||
| goto :ps_retry_loop | ||
| ) | ||
| echo PowerShell command failed after 3 attempts: %PS_CMD% | ||
| exit /b 1 | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this modifies the global Chocolatey state, do we need to disable it (
choco feature disable -n allowEmptyChecksums) after the installation finishes? Or is it safe to leave it permanently enabled?