From dadd0b04a94be8bd1b3f3dba1ce378bcdadbd2f9 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 8 Oct 2021 23:29:08 -0700
Subject: [PATCH v3 03/17] fixup! ci: Add CI for FreeBSD, Linux, MacOS and
 Windows, utilizing cirrus-ci.

---
 ci/docker/windows_vs_2019 | 62 +++++++++++++++++++++------------------
 1 file changed, 34 insertions(+), 28 deletions(-)

diff --git a/ci/docker/windows_vs_2019 b/ci/docker/windows_vs_2019
index e09ca0d5825..a4fcaceae96 100644
--- a/ci/docker/windows_vs_2019
+++ b/ci/docker/windows_vs_2019
@@ -6,12 +6,6 @@ FROM cirrusci/windowsservercore:2019
 SHELL ["powershell", "-NoLogo", "-NoProfile", "-Command"]
 
 
-RUN `
-    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\VisualStudio' ; `
-    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\VisualStudio\Setup' ; `
-    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\VisualStudio\Setup' -Name KeepDownloadedPayloads -Value 0 -PropertyType DWord
-
-
 # Install commandline debugger and log all crashes to c:\cirrus\crashlog.txt
 #
 # Done manually as doing this via chocolatey / the installer directly, ends up
@@ -19,7 +13,11 @@ RUN `
 RUN `
     mkdir c:\t ; `
     cd c:\t ; `
+    `
+    setx PATH \"C:\Windows Kits\10\Debuggers\x64;$Env:PATH\" /m ; `
+    `
     curl.exe -sSL -o 'windsdksetup.exe' https://download.microsoft.com/download/9/7/9/97982c1d-d687-41be-9dd3-6d01e52ceb68/windowssdk/winsdksetup.exe ; `
+    echo 'starting sdk installation (for debugger)' ; `
     Start-Process -Wait -FilePath ".\windsdksetup.exe" `
       -ArgumentList '/Features OptionId.WindowsDesktopDebuggers /layout c:\t\sdk /quiet /norestart /log c:\t\sdk.log' `
       ; `
@@ -29,13 +27,12 @@ RUN `
     ; `
     C:\Windows` Kits\10\Debuggers\x64\cdb.exe -version ; `
     `
-    cd c:\ ; `
-    Remove-Item C:\t\* -Force -Recurse ; `
-    Remove-Item C:\t -Force -Recurse ; `
     Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug' -Name 'Debugger' -Value '\"C:\Windows Kits\10\Debuggers\x64\cdb.exe\" -p %ld -e %ld -g -kqm -c \".lines -e; .symfix+ ;.logappend c:\cirrus\crashlog.txt ; !peb; ~*kP ; .logclose ; q \"' ; `
     New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug' -Name 'Auto' -Value 1 -PropertyType DWord ; `
-    Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug' -Name Debugger; `
-    setx PATH \"C:\Windows Kits\10\Debuggers\x64;$Env:PATH\" /m
+    Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug' -Name Debugger ; `
+    `
+    cd c:\ ; `
+    Remove-Item C:\t -Force -Recurse
 
 
 # Install perl, python, flex and bison.
@@ -48,11 +45,16 @@ RUN `
     mkdir c:\t ; `
     cd c:\t ; `
     `
+    echo 'adding to path, before setup below, so changes are not overwritten' ; `
+    setx PATH \"C:\strawberry\perl\bin;C:\winflexbison;C:\Program Files\Git\usr\bin;$Env:PATH\" /m ; `
+    `
     curl.exe -sSL -o perl.zip `
         https://strawberryperl.com/download/5.26.3.1/strawberry-perl-5.26.3.1-64bit-portable.zip ; `
+    echo 'installing perl' ; `
     7z.exe x .\perl.zip -xr!c -oc:\strawberry ; `
     `
     curl.exe -sSL -o python.exe https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe ; `
+    echo 'installing python' ; `
     Start-Process -Wait -FilePath ".\python.exe" `
       -ArgumentList `
         '/quiet', 'SimpleInstall=1', 'PrependPath=1', 'CompileAll=1', `
@@ -62,13 +64,27 @@ RUN `
     `
     curl.exe -sSL -o winflexbison.zip `
         https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip ; `
+    echo 'installing winflexbison' ; `
     7z.exe x .\winflexbison.zip -oc:\winflexbison ; `
     Rename-Item -Path c:\winflexbison\win_flex.exe c:\winflexbison\flex.exe ; `
     Rename-Item -Path c:\winflexbison\win_bison.exe c:\winflexbison\bison.exe ; `
     `
     cd c:\ ; `
-    Remove-Item C:\t -Force -Recurse ; `
-    setx PATH \"C:\strawberry\perl\bin;C:\winflexbison;C:\Program Files\Git\usr\bin;$Env:PATH\" /m
+    Remove-Item C:\t -Force -Recurse
+
+
+# Install openssl
+RUN `
+    mkdir c:\t ; `
+    cd c:\t ; `
+    `
+    curl.exe -o openssl-setup.exe -sSL https://slproweb.com/download/Win64OpenSSL-1_1_1L.exe ; `
+    echo 'staring openssl installation' ; `
+    Start-Process -Wait -FilePath ".\openssl-setup.exe" `
+      -ArgumentList '/DIR=c:\openssl\1.1.1l\ /VERYSILENT /SP- /SUPPRESSMSGBOXES' ; `
+    `
+    cd c:\ ; `
+    Remove-Item C:\t -Force -Recurse
 
 
 # Install visual studio
@@ -77,7 +93,10 @@ RUN `
 RUN `
     mkdir c:\t ; `
     cd c:\t ; `
+    setx PATH \"c:\BuildTools\VC\Auxiliary\Build;$Env:PATH\" /m ; `
+    `
     curl.exe -sSL -o c:\t\vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe ; `
+    echo 'starting visual studio installation' ; `
     Start-Process -Wait `
         -FilePath c:\t\vs_buildtools.exe `
         -ArgumentList `
@@ -85,21 +104,8 @@ RUN `
           '--installPath', 'c:\BuildTools', `
           '--add', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', `
           '--add', 'Microsoft.VisualStudio.Component.Windows10SDK.20348'  ; `
+    `
     cd c:\ ; `
     Remove-Item C:\t -Force -Recurse ; `
     Remove-Item -Force -Recurse ${Env:TEMP}\*; `
-    Remove-Item -Force -Recurse \"${Env:ProgramData}\Package Cache\"  ; `
-    setx PATH \"c:\BuildTools\VC\Auxiliary\Build;$Env:PATH\" /m
-
-
-# Install openssl
-RUN `
-    mkdir c:\t ; `
-    cd c:\t ; `
-    `
-    curl.exe -o openssl-setup.exe -sSL https://slproweb.com/download/Win64OpenSSL-1_1_1L.exe ; `
-    Start-Process -Wait -FilePath ".\openssl-setup.exe" `
-      -ArgumentList '/DIR=c:\openssl\1.1.1l\ /VERYSILENT /SP- /SUPPRESSMSGBOXES' ; `
-    `
-    cd c:\ ; `
-    Remove-Item C:\t -Force -Recurse
+    Remove-Item -Force -Recurse \"${Env:ProgramData}\Package Cache\"
-- 
2.23.0.385.gbc12974a89

