Provisioning: Use Remove function when removing items in Windows

Sometimes items are locked by some windows process so that they can't be
removed. This will fail provisioning instantly.

Let's give the removing process more time by retrying if it will fail
on first attempt

Change-Id: Ic5c16c0d920ed0625d0c6830323d0bc6ba2cd608
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
This commit is contained in:
Heikki Halmet 2019-11-19 10:13:21 +02:00
parent ed8cddd726
commit 4a37ec2dd5
33 changed files with 43 additions and 43 deletions

View File

@ -7,6 +7,6 @@ $url = "http://ci-files01-hki.intra.qt.io/input/3rdparty/Qt3DStudio-3rdparty-win
Download $url $url $zip
Verify-Checksum $zip "08D740D2EFB4CBCDE7D012908B89AA48DE5CD4E1"
Extract-7Zip $zip C:\Utils\Qt3DStudio3rdparty
Remove-Item -Path $zip
Remove "$zip"
Set-EnvironmentVariable "QT3DSTUDIO_3RDPARTY_DIR" "C:/Utils/Qt3DStudio3rdparty"

View File

@ -60,7 +60,7 @@ Verify-Checksum $zip $sha1
Extract-7Zip $zip C:\Utils\tmp
Extract-7Zip C:\Utils\tmp\openssl-$version.tar C:\Utils\tmp
Move-Item C:\Utils\tmp\openssl-${version} $destination
Remove-Item -Path $zip
Remove "$zip"
Write-Host "Configuring OpenSSL $version for Android..."
Push-Location $destination

View File

@ -41,7 +41,7 @@ $officialurl = "https://cmake.org/files/v" + $majorminorversion + "/cmake-" + $v
$cachedurl = "\\ci-files01-hki.intra.qt.io\provisioning\cmake\cmake-" + $version + "-win32-x86.zip"
Write-Host "Removing old cmake"
Remove-Item "C:\CMake" -Force -Recurse -ErrorAction SilentlyContinue
Remove "C:\CMake"
Download $officialurl $cachedurl $zip
Verify-Checksum $zip "fac77ed3eca52168b15c30979ee43310a3cb968e"

View File

@ -14,6 +14,6 @@ Verify-Checksum $package_path $sdkChecksumSha1 sha1
Write-Host "Installing DirectX SDK"
Run-Executable $package_path "/u"
Remove-Item -Path $package_path
Remove "$package_path"
Write-Output "DirectX SDK = 9.29.1962 (Jun 10)" >> ~\versions.txt

View File

@ -67,14 +67,14 @@ try {
Download $breakpad_tar_url $breakpad_tar_url $targetBreakpad
Verify-Checksum $targetBreakpad $breakpad_tar_sha
Extract-tar_gz $targetBreakpad $installFolder
Remove-Item -Path $targetBreakpad
Remove "$targetBreakpad"
# linux-syscall-support
Download $linux_syscall_support_tar_url $linux_syscall_support_tar_url $targetSyscall
Verify-Checksum $targetSyscall $linux_syscall_support_tar_sha
Extract-tar_gz $targetSyscall "$env:tmp\"
New-Item -ItemType directory -Path "$installFolder\breakpad\third_party\lss"
Get-ChildItem -Path "$env:tmp\linux-syscall-support\*" -Recurse | Move-Item -Destination "$installFolder\breakpad\third_party\lss"
Remove-Item -Path $targetSyscall
Remove "$targetSyscall"
}
catch {
Write-Host "Cached download failed: Attempping fallback method eg git."

View File

@ -57,6 +57,6 @@ Verify-Checksum $dependsPackage $sha1
Extract-7Zip $dependsPackage $TARGETDIR
Write-Host "Cleaning $dependsPackage.."
Remove-Item -Recurse -Force -Path "$dependsPackage"
Remove "$dependsPackage"
Write-Output "Dependency Walker = $version" >> ~\versions.txt

View File

@ -61,7 +61,7 @@ function InstallMinGW
Set-EnvironmentVariable "$envvar" ("$targetdir\mingw" + $win_arch.Substring($win_arch.get_Length()-2))
Write-Host "Cleaning $mingwPackage.."
Remove-Item -Recurse -Force -Path "$mingwPackage"
Remove "$mingwPackage"
Write-Output "MinGW = $version $release" >> ~\versions.txt

View File

@ -77,6 +77,6 @@ if ((Test-Path $url_cache_prebuilt)) {
}
Write-Host "Cleaning $PackagePath.."
Remove-Item -Recurse -Force -Path "$PackagePath"
Remove "$PackagePath"
Write-Output "msys2 = $version" >> ~\versions.txt

View File

@ -52,7 +52,7 @@ Verify-Checksum $nppPackage $sha1
Run-Executable "$nppPackage" "/S"
Write-Host "Cleaning $nppPackage.."
Remove-Item -Recurse -Force -Path "$nppPackage"
Remove "$nppPackage"
Write-Output "Notepad++ = $version" >> ~\versions.txt

View File

@ -57,7 +57,7 @@ if(![System.IO.File]::Exists("$installationFolder\bin\protoc.exe")){
exit 1
}
Remove-Item "$zip"
Remove "$zip"
Add-Path "$installationFolder\bin"
Set-EnvironmentVariable PROTOBUF_INCLUDE "$installationFolder\include"

View File

@ -52,6 +52,6 @@ Verify-Checksum $rubyPackage $sha1
Run-Executable $rubyPackage "/dir=C:\Ruby-$version$arch /tasks=modpath /verysilent"
Write-Host "Cleaning $rubyPackage.."
Remove-Item -Recurse -Force -Path "$rubyPackage"
Remove "$rubyPackage"
Write-Output "Ruby = $version" >> ~\versions.txt

View File

@ -56,7 +56,7 @@ Verify-Checksum $7zPackage $sha1
Run-Executable $7zPackage "/S","/D=$7zTargetLocation"
Write-Host "Cleaning $7zPackage.."
Remove-Item -Recurse -Force -Path "$7zPackage"
Remove "$7zPackage"
Add-Path $7zTargetLocation

View File

@ -53,6 +53,6 @@ Verify-Checksum $strawberryPackage $sha1
Run-Executable "msiexec" "/quiet /i $strawberryPackage INSTALLDIR=C:\strawberry REBOOT=REALLYSUPPRESS"
Write-Host "Cleaning $strawberryPackage.."
Remove-Item -Recurse -Force -Path "$strawberryPackage"
Remove "$strawberryPackage"
Write-Output "strawberry = $version" >> ~\versions.txt

View File

@ -32,7 +32,7 @@ function install() {
Verify-Checksum $zip $sha1
Extract-7Zip $zip C:\Utils\
Rename-Item C:\Utils\libclang $destination
Remove-Item -Force -Path $zip
Remove "$zip"
}
$toolchainSuffix = ""

View File

@ -53,7 +53,7 @@ function Extract-Mesa
Verify-Checksum $package $sha1
Extract-7Zip $package $targetFolder
Write-Host "Removing $package"
Remove-Item -Path $package
Remove "$package"
}
if (Is64BitWinHost) {

View File

@ -46,6 +46,6 @@ Verify-Checksum $zip $sha1
Write-Host "MQTT: Installing $zip..."
Extract-7Zip $zip C:\Utils
Remove-Item -Path $zip
Remove "$zip"
Set-EnvironmentVariable "MQTT_TEST_BROKER_LOCATION" "C:\Utils\paho.mqtt.testing-$commitSHA\interoperability\startbroker.py"

View File

@ -45,6 +45,6 @@ Write-Host "Installing Update 5 for Visual Studio $version..."
Run-Executable "$package" "/norestart /passive"
Write-Host "Removing $package ..."
Remove-Item $package
Remove "$package"
Write-Output "Visual Studio = $version" >> ~\versions.txt

View File

@ -57,7 +57,7 @@ function DownloadAndInstall
$zipDir = [io.path]::GetFileNameWithoutExtension($package)
Extract-7Zip $package $installPath "$zipDir\lib $zipDir\bin $zipDir\share $zipDir\include"
Remove-Item -Path $package
Remove "$package"
}
if (Is64BitWinHost) {

View File

@ -6,7 +6,7 @@ Download https://github.com/ninja-build/ninja/releases/download/v1.6.0/ninja-win
Verify-Checksum $zip "E01093F6533818425F8EFB0843CED7DCAABEA3B2"
Extract-7Zip $zip C:\Utils\Ninja
Remove-Item -Path $zip
Remove "$zip"
Add-Path "C:\Utils\Ninja"

View File

@ -53,7 +53,7 @@ function DownloadAndInstallUA
Write-Host "UACPPSDK: Extracting $zip..."
Extract-7Zip $zip (Get-DefaultDownloadLocation)
Remove-Item -Path $zip
Remove "$zip"
$executable = (Get-DefaultDownloadLocation) + "$InstallerFileName.exe"
# We cannot call the installer as the x86 and x64 versions of the installer are not
@ -65,7 +65,7 @@ function DownloadAndInstallUA
#Remove-Item $executable
Extract-7Zip $executable $Destination
Remove-Item $executable
Remove "$executable"
}
#x86 version

View File

@ -56,7 +56,7 @@ if (Is64BitWinHost) {
Run-Executable "$packagex64" "/SP- /SILENT /LOG /SUPPRESSMSGBOXES /NORESTART /DIR=$installFolder"
Write-Host "Remove downloaded $packagex64 ..."
Remove-Item -Path $packagex64
Remove "$packagex64"
Set-EnvironmentVariable "OPENSSL_CONF_x64" "$installFolder\bin\openssl.cfg"
Set-EnvironmentVariable "OPENSSL_INCLUDE_x64" "$installFolder\include"
@ -83,7 +83,7 @@ Write-Host "Installing $packagex86 ..."
Run-Executable "$packagex86" "/SP- /SILENT /LOG /SUPPRESSMSGBOXES /NORESTART /DIR=$installFolder"
Write-Host "Remove downloaded $packagex86 ..."
Remove-Item -Path $packagex86
Remove "$packagex86"
Set-EnvironmentVariable "OPENSSL_CONF_x86" "$installFolder\bin\openssl.cfg"
Set-EnvironmentVariable "OPENSSL_INCLUDE_x86" "$installFolder\include"

View File

@ -55,10 +55,10 @@ if (Is64BitWinHost) {
Extract-7Zip $packagex64 $installFolder "pgsql\lib pgsql\bin pgsql\share pgsql\include"
Write-Host "Remove downloaded $packagex64 ..."
Remove-Item -Path $packagex64
Remove $packagex64
# Remove pthread.h file so it won't be used in mingw builds (QTBUG-79555)
Remove-item -Path "$installFolder\pgsql\include\pthread.h"
Remove-item -Path "$installFolder\pgsql\include\unistd.h"
Remove "$installFolder\pgsql\include\pthread.h"
Remove "$installFolder\pgsql\include\unistd.h"
Set-EnvironmentVariable "POSTGRESQL_INCLUDE_x64" "$installFolder\pgsql\include"
Set-EnvironmentVariable "POSTGRESQL_LIB_x64" "$installFolder\pgsql\lib"
@ -83,10 +83,10 @@ Write-Host "Installing $packagex86 ..."
Extract-7Zip $packagex86 $installFolder "pgsql\lib pgsql\bin pgsql\share pgsql\include"
Write-Host "Remove downloaded $packagex86 ..."
Remove-Item -Path $packagex86
Remove $packagex86
# Remove pthread.h file so it won't be used in mingw builds (QTBUG-79555)
Remove-item -Path "$installFolder\pgsql\include\pthread.h"
Remove-item -Path "$installFolder\pgsql\include\unistd.h"
Remove "$installFolder\pgsql\include\pthread.h"
Remove "$installFolder\pgsql\include\unistd.h"
Set-EnvironmentVariable "POSTGRESQL_INCLUDE_x86" "$installFolder\pgsql\include"
Set-EnvironmentVariable "POSTGRESQL_LIB_x86" "$installFolder\pgsql\lib"

View File

@ -82,8 +82,7 @@ while ($stop -ne $true)
# We need to change allowZip64 from 'False' to 'True' to be able to create ZIP files that use the ZIP64 extensions when the zipfile is larger than 2 GB
Write-Host "Changing allowZip64 value to 'True'..."
(Get-Content $targetDir\lib\zipfile.py) | ForEach-Object { $_ -replace "allowZip64=False", "allowZip64=True" } | Set-Content $targetDir\lib\zipfile.py
Write-Host "Remove $package..."
Remove-Item -Path $package
Remove "$package"
# When installing 32 bit python to 64 bit host, we want to keep only default python in path
# For cross-compilation we export some helper env variable

View File

@ -60,8 +60,7 @@ Download $externalUrl $internalUrl $package
Verify-Checksum $package $sha1
Write-Host "Installing $package..."
Run-Executable "$package" "/q TargetDir=$install_path"
Write-Host "Remove $package..."
Remove-Item -Path $package
Remove "$package"
# For cross-compilation we export some helper env variable
if (($archVer -eq 32) -And (Is64BitWinHost)) {

View File

@ -45,4 +45,4 @@ Download $url $url $installer
Verify-Checksum $installer $sha1
Run-Executable $installer "/S"
Run-Executable "C:\Program Files\squishcoco\cocolic.exe" "--license-server=Qt-SRV-33.intra.qt.io:49344"
Remove-Item -Force -Path $installer
Remove "$installer"

View File

@ -31,13 +31,15 @@
##
#############################################################################
. "$PSScriptRoot\helpers.ps1"
$auth_file = "C:\Users\qt\work\influxdb\coin_vms_writer.auth"
# Provisioning should run even without the secrets repository
if (Test-Path $auth_file) {
$auth_content = Get-Content $auth_file
$influxdb_password = $auth_content.Substring($auth_content.LastIndexOf(':') + 1)
Remove-Item $auth_file
Remove "$auth_file"
} else {
$influxdb_password = "no_password_provided"
}

View File

@ -43,6 +43,6 @@ Copy-Item $url_cache $vulkanPackage
Run-Executable $vulkanPackage "/S"
Write-Host "Cleaning $vulkanPackage.."
Remove-Item -Recurse -Force -Path "$vulkanPackage"
Remove "$vulkanPackage"
Write-Output "Vulkan SDK = $version" >> ~\versions.txt

View File

@ -45,6 +45,6 @@ Verify-Checksum $package $sha1
Run-Executable $package "/features + /q"
Write-Host "Cleaning $package.."
Remove-Item -Recurse -Force -Path "$package"
Remove "$package"
Write-Output "Windows 10 SDK = 10.0.16229.91" >> ~\versions.txt

View File

@ -7,6 +7,6 @@ $url_cache = "\\ci-files01-hki.intra.qt.io\provisioning\windows\winrtrunner\winr
Download $url $url_cache $zip
Verify-Checksum $zip "93548e8c3fb8fded2474996ef5e0163f489ce8cf"
Extract-7Zip $zip C:\Utils\winrtrunner
Remove-Item -Path $zip
Remove "$zip"
Set-EnvironmentVariable "CI_WINRTRUNNER_PATH" "C:\Utils\winrtrunner"

View File

@ -41,4 +41,4 @@ $destination = "C:\Windows\temp\sign.zip"
Download $url $url $destination
Extract-7Zip "$destination" "C:\Utils"
Remove-Item -Path "$destination"
Remove "$destination"

View File

@ -44,4 +44,4 @@ Extract-7Zip $zip C:\
Set-EnvironmentVariable "QNX_700" "C:\QNX700"
Write-Output "QNX SDP = 7.0.0" >> ~/versions.txt
Remove-Item -Path $zip
Remove "$zip"

View File

@ -46,6 +46,6 @@ Verify-Checksum $virtualboxPackage $sha1
Run-Executable $virtualboxPackage "--silent"
Write-Output "Cleaning $virtualboxPackage.."
Remove-Item -Recurse -Force -Path "$virtualboxPackage"
Remove "$virtualboxPackage"
Write-Output "VirtualBox = $version" >> ~\versions.txt

View File

@ -41,4 +41,4 @@ $destination = "C:\Windows\temp\sign.zip"
Download $url $url $destination
Extract-7Zip "$destination" "C:\Utils"
Remove-Item -Path "$destination"
Remove "$destination"