aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-05-08 14:28:56 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-06-06 20:15:28 +0000
commitce47238ed94f3a989c13fef93b037904589910cf (patch)
tree5f16dc99871dd87585441f0c2174667222f05a3b
parent982659b081c73d7ed373dd2845d2a926057b0f83 (diff)
Improve Postgresql installation on Windows
Similar to the mysql change (parent commit) it's faster to rename any older artifacts and install only what we need. This also generalizes the zip archive extraction code for "dev" packages. Change-Id: I3ad1f23efaed80fab3e0778a3e8c46317138f1ad Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
-rw-r--r--coin/provisioning/common/helpers.ps132
-rw-r--r--coin/provisioning/qtci-windows-10-x86_64/mysql.ps118
-rw-r--r--coin/provisioning/qtci-windows-10-x86_64/postgresql.ps117
3 files changed, 44 insertions, 23 deletions
diff --git a/coin/provisioning/common/helpers.ps1 b/coin/provisioning/common/helpers.ps1
index 0e684452..132fcdd3 100644
--- a/coin/provisioning/common/helpers.ps1
+++ b/coin/provisioning/common/helpers.ps1
@@ -30,6 +30,32 @@ function Extract-Zip
$destinationFolder.CopyHere($zipfile.Items(), 16)
}
+function Extract-Dev-Folders-From-Zip
+{
+ Param (
+ [string]$package,
+ [string]$zipDir,
+ [string]$installPath
+ )
+
+ $shell = new-object -com shell.application
+
+ echo "Extracting contents of $package"
+ foreach ($subDir in "lib", "include", "bin", "share") {
+ $zip = $shell.Namespace($package + "\" + $zipDir + "\" + $subDir)
+ if ($zip) {
+ 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($zip.Items(), 16)
+ }
+}
+
function BadParam
{
Param ([string]$Description)
@@ -44,7 +70,11 @@ function Download
[string] $Destination = $(BadParam("a download target location"))
)
try {
- Invoke-WebRequest -UseBasicParsing $CachedUrl -OutFile $Destination
+ if ($CachedUrl.StartsWith("http")) {
+ Invoke-WebRequest -UseBasicParsing $CachedUrl -OutFile $Destination
+ } else {
+ Copy-Item $CachedUrl $Destination
+ }
} catch {
Invoke-WebRequest -UseBasicParsing $OfficialUrl -OutFile $Destination
}
diff --git a/coin/provisioning/qtci-windows-10-x86_64/mysql.ps1 b/coin/provisioning/qtci-windows-10-x86_64/mysql.ps1
index 6f2c86a4..ce1d2be0 100644
--- a/coin/provisioning/qtci-windows-10-x86_64/mysql.ps1
+++ b/coin/provisioning/qtci-windows-10-x86_64/mysql.ps1
@@ -51,22 +51,8 @@ function DownloadAndInstall
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)
- }
+ $zipDir = [io.path]::GetFileNameWithoutExtension($package)
+ Extract-Dev-Folders-From-Zip $package $zipDir $installPath
Remove-Item $package
}
diff --git a/coin/provisioning/qtci-windows-10-x86_64/postgresql.ps1 b/coin/provisioning/qtci-windows-10-x86_64/postgresql.ps1
index 9b1d5d4e..e2edadf0 100644
--- a/coin/provisioning/qtci-windows-10-x86_64/postgresql.ps1
+++ b/coin/provisioning/qtci-windows-10-x86_64/postgresql.ps1
@@ -42,16 +42,21 @@ $packagex86 = "C:\Windows\temp\postgresql-$version-windows-binaries.zip"
# Install x64 bit versions
$architecture = "x64"
-$installFolder = "C:\Utils\postgresql"
+$installFolder = "C:\Utils\postgresql\pgsql"
$externalUrl = "http://get.enterprisedb.com/postgresql/postgresql-$version-windows-x64-binaries.zip"
-$internalUrl = "http://ci-files01-hki.ci.local/input/windows/postgresql-$version-windows-x64-binaries.zip"
+$internalUrl = "\\ci-files01-hki.ci.local\provisioning\windows\postgresql-$version-windows-x64-binaries.zip"
$sha1 = "4da0453cdfda335e064d4437cf5bb9d356054cfd"
+# Delete any leftovers
+try {
+ Rename-Item -ErrorAction 'Stop' c:\utils\postgresql c:\utils\postgresql-deleted
+} catch {}
+
echo "Fetching from URL ..."
Download $externalUrl $internalUrl $packagex64
Verify-Checksum $packagex64 $sha1
echo "Installing $packagex64 ..."
-Extract-Zip $packagex64 $installFolder
+Extract-Dev-Folders-From-Zip $packagex64 "pgsql" $installFolder
echo "Remove downloaded $packagex64 ..."
Remove-Item $packagex64
@@ -62,16 +67,16 @@ echo "Set $architecture environment variables ..."
# Install x86 bit version
$architecture = "x86"
-$installFolder = "C:\Utils\postgresql$architecture"
+$installFolder = "C:\Utils\postgresql$architecture\pgsql"
$externalUrl = "http://get.enterprisedb.com/postgresql/postgresql-$version-windows-binaries.zip"
-$internalUrl = "http://ci-files01-hki.ci.local/input/windows/postgresql-$version-windows-binaries.zip"
+$internalUrl = "\\ci-files01-hki.ci.local\provisioning\windows\postgresql-$version-windows-binaries.zip"
$sha1 = "eb4f01845e1592800edbb74f60944b6c0aca51a9"
echo "Fetching from URL..."
Download $externalUrl $internalUrl $packagex86
Verify-Checksum $packagex86 $sha1
echo "Installing $packagex86 ..."
-Extract-Zip $packagex86 $installFolder
+Extract-Dev-Folders-From-Zip $packagex86 "pgsql" $installFolder
echo "Remove downloaded $packagex86 ..."
Remove-Item $packagex86