From 982659b081c73d7ed373dd2845d2a926057b0f83 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 8 May 2017 12:15:40 +0200 Subject: Improve mysql installation * Instead of deleting the files from a previous installation, which will not actually release any disk space but just make the qcow2 file larger, let's just rename the directory the old files are in. That is a significantly faster operation. * When extracting the zip archive, only extract what we need for Qt: Libraries, binaries and headers. We can skip the installation of several thousand documentation files for example, which takes a long time. * Instead of downloading the zip archive via PowerShell's Invoke-WebRequest we can get the data much faster using CopyItem off the CIFS share. As a bonus this is also more robust against download failures. Change-Id: I9128bd70e5f4a4ebcdbf046765e76b63bad033a5 Reviewed-by: Frederik Gladhorn --- coin/provisioning/qtci-windows-10-x86_64/mysql.ps1 | 78 ++++++++++------------ 1 file changed, 34 insertions(+), 44 deletions(-) (limited to 'coin/provisioning/qtci-windows-10-x86_64') diff --git a/coin/provisioning/qtci-windows-10-x86_64/mysql.ps1 b/coin/provisioning/qtci-windows-10-x86_64/mysql.ps1 index 5e75f662..6f2c86a4 100644 --- a/coin/provisioning/qtci-windows-10-x86_64/mysql.ps1 +++ b/coin/provisioning/qtci-windows-10-x86_64/mysql.ps1 @@ -37,53 +37,51 @@ # Both x86 and x64 versions needed when x86 integrations are done on x64 machine $version = "5.6.11" -$packagex64 = "C:\Windows\temp\mysql-$version-win64.zip" +$packagex64 = "C:\Windows\temp\mysql-$version-winx64.zip" $packagex86 = "C:\Windows\temp\mysql-$version-win32.zip" -function CheckAndRemovePreviousInstallation -{ - Param ( - [string]$InstallFolder - ) - echo "Check for previous installation..." - $FolderExists = Test-Path $ExistingInstallation - If ($FolderExists -eq $True) { - echo "Removing previous installation ($ExistingInstallation)" - Remove-Item $ExistingInstallation -recurse - } -} - function DownloadAndInstall { Param ( - [string]$arch, - [string]$externalUrl, [string]$internalUrl, [string]$package, - [string]$sha1, [string]$installPath ) - echo "Fetching from URL ..." - Download $externalUrl $internalUrl $package - Verify-Checksum $package $sha1 - Extract-Zip $package $installPath + echo "Fetching from URL ..." + Copy-Item $internalUrl $package + + $shell = new-object -com shell.application + + echo "Extracting contents" + foreach ($subDir in "lib", "include", "bin") { + $zipDir = $shell.Namespace($package + "\" + [io.path]::GetFileNameWithoutExtension($package) + "\" + $subDir) + if ($zipDir) { + Write-Host "Extracting $subDir from zip archive" + } else { + Write-Host "$subDir is missing from zip archive - skipping" + continue + } + $destDir = $installPath + "\" + $subdir + New-Item $destDir -type directory + $destinationFolder = $shell.Namespace($destDir) + $destinationFolder.CopyHere($zipDir.Items(), 16) + } + + Remove-Item $package } +# Remove any leftovers +try { + Rename-Item -ErrorAction 'Stop' c:\utils\my_sql c:\utils\mysql_deleted +} catch {} + # Install x64 bit version $architecture = "x64" -$installFolder = "C:\Utils\my_sql" -$existingInstallation = "$installFolder\my_sql" -$internalUrl = "http://ci-files01-hki.ci.local/input/windows/mysql-$version-winx64" -$sha1 = "f4811512b5f3c8ad877ee4feba2062312a0acc38" - -echo "Check and remove previous installation ..." -CheckAndRemovePreviousInstallation $existingInstallation -DownloadAndInstall $architecture $internalUrl $internalUrl $packagex64 $sha1 $installFolder -Rename-Item -path $installFolder\mysql-$version-winx64 -newName $installFolder\my_sql +$installFolder = "C:\Utils\my_sql\my_sql" +$internalUrl = "\\ci-files01-hki.ci.local\provisioning\windows\mysql-$version-winx64.zip" -echo "Remove downloaded package ..." -Remove-Item $packagex64 +DownloadAndInstall $internalUrl $packagex64 $installFolder echo "Set environment variables ..." [Environment]::SetEnvironmentVariable("MYSQL_INCLUDE_x64", "$installFolder\my_sql\include", "Machine") @@ -91,18 +89,10 @@ echo "Set environment variables ..." # Install x86 bit version $architecture = "x86" -$installFolder = "C:\Utils\my_sql$architecture" -$existingInstallation = "$installFolder\my_sql" -$internalUrl = "http://ci-files01-hki.ci.local/input/windows/mysql-$version-win32" -$sha1 = "e0aa62d5c5d6c6ec28906a831752d04336562679" - -echo "Check and remove previous installation ..." -CheckAndRemovePreviousInstallation $existingInstallation -DownloadAndInstall $architecture $internalUrl $internalUrl $packagex86 $sha1 $installFolder -Rename-Item -path $installFolder\mysql-$version-win32 -newName $installFolder\my_sql - -echo "Remove downloaded package ..." -Remove-Item $packagex86 +$installFolder = "C:\Utils\my_sql\my_sql$architecture" +$internalUrl = "\\ci-files01-hki.ci.local\provisioning\windows\mysql-$version-win32.zip" + +DownloadAndInstall $internalUrl $packagex86 $installFolder echo "Set environment variables ..." [Environment]::SetEnvironmentVariable("MYSQL_INCLUDE_x86", "$installFolder\my_sql\include", "Machine") -- cgit v1.2.3