@@ -144,6 +144,8 @@ $buildConfig = switch ($buildMode) {
144144
145145$wrappersConfig = if ($buildMode -eq " hybrid" -or $buildMode -eq " minimal" ) { " RelWithDebInfo" } else { $null }
146146$isMinimalMode = ($buildMode -eq " minimal" )
147+ $script :SvnRetryCount = 500
148+ $script :SvnRetryDelaySeconds = 1
147149
148150function Test-RequiredLibContent {
149151 param ([Parameter (Mandatory = $true )][string ]$LibPath )
@@ -167,6 +169,17 @@ function Get-CyclesLibrariesVersion {
167169 return $versionMatch.Matches [0 ].Groups[1 ].Value.Trim(' "' )
168170}
169171
172+ function Get-SvnRetryDelaySeconds {
173+ return $script :SvnRetryDelaySeconds
174+ }
175+
176+ function Invoke-SvnCommand {
177+ param ([Parameter (Mandatory = $true )][string []]$Arguments )
178+
179+ & svn @Arguments 2>&1 | Out-Host
180+ return $LASTEXITCODE
181+ }
182+
170183function Ensure-SvnLib {
171184 param (
172185 [Parameter (Mandatory = $true )][string ]$LibName ,
@@ -183,19 +196,41 @@ function Ensure-SvnLib {
183196 New-Item - Path $libRoot - ItemType Directory - Force | Out-Null
184197 }
185198
186- if ( Test-Path ( Join-Path $libPath " .svn " )) {
187- & svn -- non - interactive cleanup $libPath | Out-Host
188- & svn -- non - interactive update $libPath | Out-Host
189- }
190- else {
191- & svn -- non - interactive checkout -- force " $SvnLibBaseUrl / $LibName " $libPath | Out-Host
192- }
199+ $maxAttempts = $ script :SvnRetryCount + 1
200+ $lastSvnExitCode = 0
201+
202+ for ( $attempt = 1 ; $attempt -le $maxAttempts ; $attempt ++ ) {
203+ $workingCopyExists = Test-Path ( Join-Path $libPath " .svn " )
204+ $operation = if ( $workingCopyExists ) { " update " } else { " checkout " }
205+ Write-Log " [SVN] $LibName attempt $attempt / $maxAttempts ( $operation ). "
193206
194- if ($LASTEXITCODE -ne 0 -or -not (Test-RequiredLibContent - LibPath $libPath )) {
195- throw " Failed to prepare SVN library '$LibName '."
207+ if ($workingCopyExists ) {
208+ $cleanupExitCode = Invoke-SvnCommand - Arguments @ (" --non-interactive" , " cleanup" , $libPath )
209+ if ($cleanupExitCode -ne 0 ) {
210+ $lastSvnExitCode = $cleanupExitCode
211+ }
212+ else {
213+ $lastSvnExitCode = Invoke-SvnCommand - Arguments @ (" --non-interactive" , " update" , $libPath )
214+ }
215+ }
216+ else {
217+ $lastSvnExitCode = Invoke-SvnCommand - Arguments @ (" --non-interactive" , " checkout" , " --force" , " $SvnLibBaseUrl /$LibName " , $libPath )
218+ }
219+
220+ if ($lastSvnExitCode -eq 0 -and (Test-RequiredLibContent - LibPath $libPath )) {
221+ Write-Log " [SVN] $LibName ready."
222+ return
223+ }
224+
225+ if ($attempt -lt $maxAttempts ) {
226+ $reason = if ($lastSvnExitCode -ne 0 ) { " svn exit code $lastSvnExitCode " } else { " required files are still missing" }
227+ $delaySeconds = Get-SvnRetryDelaySeconds
228+ Write-Log " [SVN] $LibName attempt $attempt /$maxAttempts failed ($reason ). Retrying in $delaySeconds seconds."
229+ Start-Sleep - Seconds $delaySeconds
230+ }
196231 }
197232
198- Write-Log " [ SVN] $LibName ready ."
233+ throw " Failed to prepare SVN library ' $LibName ' after $maxAttempts attempt(s) ."
199234}
200235
201236function Remove-DirectorySafe {
@@ -392,6 +427,7 @@ try {
392427 Write-Log " HIP build dir: $hipBuildDir "
393428 Write-Log " Rhino branch root: $rhinoBranchRoot "
394429 Write-Log " Docker volume: $dockerVolume "
430+ Write-Log " SVN retries after first failure: $script :SvnRetryCount (fixed $script :SvnRetryDelaySeconds second delay)."
395431 Write-Log " Allowed cleanup paths: $ ( $script :AllowedCleanupPaths -join ' , ' ) "
396432
397433 if ($guardErrors.Count -gt 0 ) {
@@ -404,7 +440,9 @@ try {
404440 }
405441 $cyclesLibVersion = Get-CyclesLibrariesVersion
406442 $svnLibBaseUrl = " https://svn.blender.org/svnroot/bf-blender/tags/blender-$cyclesLibVersion -release/lib"
407- Ensure- SvnLib - LibName " linux_x86_64_glibc_228" - SvnLibBaseUrl $svnLibBaseUrl
443+ if (-not $isMinimalMode ) {
444+ Ensure- SvnLib - LibName " linux_x86_64_glibc_228" - SvnLibBaseUrl $svnLibBaseUrl
445+ }
408446 Ensure- SvnLib - LibName " win64_vc15" - SvnLibBaseUrl $svnLibBaseUrl
409447 }
410448
0 commit comments