From f12c22646336893c6db5e8117498395baa0c3230 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Wed, 24 Jul 2019 14:04:08 +0300 Subject: [PATCH] Provisioning: install-msys2.ps1 must run its commands synchronously MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [*] Using bash instead of msys2_shell.cmd allows Start-Process to actually wait for the end of command execution. [*] cpan requires "yes" to be typed by user when it's run first time, otherwise it hangs indefinitely waiting for input. [*] Stop gpg-agent and dirmngr started in the background to prevent CI session from hanging. Change-Id: I4d4c1f36d215cb7578d1e7059217e34375de96c6 Reviewed-by: MÃ¥rten Nordheim --- coin/provisioning/common/windows/install-msys2.ps1 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/coin/provisioning/common/windows/install-msys2.ps1 b/coin/provisioning/common/windows/install-msys2.ps1 index 0c4a9680..e88c8f07 100644 --- a/coin/provisioning/common/windows/install-msys2.ps1 +++ b/coin/provisioning/common/windows/install-msys2.ps1 @@ -33,8 +33,6 @@ . "$PSScriptRoot\helpers.ps1" -# This script installs 7-Zip - $version = "20181211" $prog = "msys2" if (Is64BitWinHost) { @@ -58,13 +56,17 @@ $TargetLocation = "C:\Utils" Download $url_official $url_cache $PackagePath Verify-Checksum $PackagePath $sha1 Extract-tar_gz $PackagePath $TargetLocation -$msys = "$TargetLocation\$folder\msys2_shell.cmd" +$bash = "$TargetLocation\$folder\usr\bin\bash" # install perl -Run-Executable "$msys" "`"-l`" `"-c`" `"rm -rf /etc/pacman.d/gnupg;pacman-key --init;pacman-key --populate msys2;pacman -S --noconfirm perl make`"" -Run-Executable "$msys" "`"-l`" `"-c`" `"cpan -i Text::Template Test::More`"" +Run-Executable "$bash" "`"-l`" `"-c`" `"rm -rf /etc/pacman.d/gnupg;pacman-key --init;pacman-key --populate msys2;pacman -S --noconfirm perl make`"" +Run-Executable "$bash" "`"-l`" `"-c`" `"yes | cpan -i Text::Template Test::More`"" Write-Host "Cleaning $PackagePath.." Remove-Item -Recurse -Force -Path "$PackagePath" -Write-Output "7-Zip = $version" >> ~\versions.txt +# pacman-key launches gpg-agent and dirmngr in the background, see https://github.com/Alexpux/MSYS2-pacman/issues/56 +Stop-Process -Name "gpg-agent" -ErrorAction Ignore +Stop-Process -Name "dirmngr" -ErrorAction Ignore + +Write-Output "MSYS2 = $version" >> ~\versions.txt