mirror of
git://code.qt.io/qt/qt5.git
synced 2026-04-23 05:16:49 +08:00
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 <frederik.gladhorn@qt.io>
This commit is contained in:
@@ -37,53 +37,51 @@
|
|||||||
# Both x86 and x64 versions needed when x86 integrations are done on x64 machine
|
# Both x86 and x64 versions needed when x86 integrations are done on x64 machine
|
||||||
|
|
||||||
$version = "5.6.11"
|
$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"
|
$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
|
function DownloadAndInstall
|
||||||
{
|
{
|
||||||
Param (
|
Param (
|
||||||
[string]$arch,
|
|
||||||
[string]$externalUrl,
|
|
||||||
[string]$internalUrl,
|
[string]$internalUrl,
|
||||||
[string]$package,
|
[string]$package,
|
||||||
[string]$sha1,
|
|
||||||
[string]$installPath
|
[string]$installPath
|
||||||
)
|
)
|
||||||
|
|
||||||
echo "Fetching from URL ..."
|
echo "Fetching from URL ..."
|
||||||
Download $externalUrl $internalUrl $package
|
Copy-Item $internalUrl $package
|
||||||
Verify-Checksum $package $sha1
|
|
||||||
Extract-Zip $package $installPath
|
$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
|
# Install x64 bit version
|
||||||
$architecture = "x64"
|
$architecture = "x64"
|
||||||
$installFolder = "C:\Utils\my_sql"
|
$installFolder = "C:\Utils\my_sql\my_sql"
|
||||||
$existingInstallation = "$installFolder\my_sql"
|
$internalUrl = "\\ci-files01-hki.ci.local\provisioning\windows\mysql-$version-winx64.zip"
|
||||||
$internalUrl = "http://ci-files01-hki.ci.local/input/windows/mysql-$version-winx64"
|
|
||||||
$sha1 = "f4811512b5f3c8ad877ee4feba2062312a0acc38"
|
|
||||||
|
|
||||||
echo "Check and remove previous installation ..."
|
DownloadAndInstall $internalUrl $packagex64 $installFolder
|
||||||
CheckAndRemovePreviousInstallation $existingInstallation
|
|
||||||
DownloadAndInstall $architecture $internalUrl $internalUrl $packagex64 $sha1 $installFolder
|
|
||||||
Rename-Item -path $installFolder\mysql-$version-winx64 -newName $installFolder\my_sql
|
|
||||||
|
|
||||||
echo "Remove downloaded package ..."
|
|
||||||
Remove-Item $packagex64
|
|
||||||
|
|
||||||
echo "Set environment variables ..."
|
echo "Set environment variables ..."
|
||||||
[Environment]::SetEnvironmentVariable("MYSQL_INCLUDE_x64", "$installFolder\my_sql\include", "Machine")
|
[Environment]::SetEnvironmentVariable("MYSQL_INCLUDE_x64", "$installFolder\my_sql\include", "Machine")
|
||||||
@@ -91,18 +89,10 @@ echo "Set environment variables ..."
|
|||||||
|
|
||||||
# Install x86 bit version
|
# Install x86 bit version
|
||||||
$architecture = "x86"
|
$architecture = "x86"
|
||||||
$installFolder = "C:\Utils\my_sql$architecture"
|
$installFolder = "C:\Utils\my_sql\my_sql$architecture"
|
||||||
$existingInstallation = "$installFolder\my_sql"
|
$internalUrl = "\\ci-files01-hki.ci.local\provisioning\windows\mysql-$version-win32.zip"
|
||||||
$internalUrl = "http://ci-files01-hki.ci.local/input/windows/mysql-$version-win32"
|
|
||||||
$sha1 = "e0aa62d5c5d6c6ec28906a831752d04336562679"
|
|
||||||
|
|
||||||
echo "Check and remove previous installation ..."
|
DownloadAndInstall $internalUrl $packagex86 $installFolder
|
||||||
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
|
|
||||||
|
|
||||||
echo "Set environment variables ..."
|
echo "Set environment variables ..."
|
||||||
[Environment]::SetEnvironmentVariable("MYSQL_INCLUDE_x86", "$installFolder\my_sql\include", "Machine")
|
[Environment]::SetEnvironmentVariable("MYSQL_INCLUDE_x86", "$installFolder\my_sql\include", "Machine")
|
||||||
|
|||||||
Reference in New Issue
Block a user