Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve MSYS2 installation #3652

Merged
merged 9 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions images/win/scripts/Installers/Install-Msys2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,12 @@ foreach ($arch in $archs)
Write-Host "`n$dash Clean packages"
pacman.exe -Scc --noconfirm

Write-Host "`n$dash Installed msys2 packages"
pacman.exe -Q | grep -v ^mingw-w64-
$pkgs = pacman.exe -Q
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some enhancements such as this one, which don't imply changes in the functionality, might be worth being cherry-picked.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eine thanks a lot for detailed explanation! I'll keep only minor script improvements and remove ucrt installation.


foreach ($arch in $archs)
{
Write-Host "`n$dash Installed $arch packages"
pacman.exe -Q | grep ^${arch}-
$pkgs | grep ^${arch}-
}

$env:PATH = $origPath
Expand Down
29 changes: 9 additions & 20 deletions images/win/scripts/Tests/MSYS2.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
$toolsetContent = (Get-ToolsetContent).MsysPackages
$archs = $toolsetContent.mingw.arch

BeforeAll {
$msys2Dir = "C:\msys64\usr\bin"
$originalPath = $env:PATH
Expand Down Expand Up @@ -34,31 +31,23 @@ Describe "MSYS2 packages" {
}
}

foreach ($arch in $archs) {
Describe "$arch arch packages" {
$archPackages = $toolsetContent.mingw | Where-Object { $_.arch -eq $arch }
$tools = $archPackages.runtime_packages.name

if ($arch -eq "mingw-w64-i686")
{
$ExecDir = "C:\msys64\mingw32\bin"
}
else
{
$ExecDir = "C:\msys64\mingw64\bin"
}
$mingwTypes = (Get-ToolsetContent).MsysPackages.mingw
foreach ($mingwType in $mingwTypes) {
Describe "$($mingwType.arch) packages" {
$tools = $mingwType.runtime_packages
$execDir = Join-Path "C:\msys64" $mingwType.exec_dir | Join-Path -ChildPath "bin"

foreach ($tool in $tools) {
Context "$tool package"{
$executables = ($archPackages.runtime_packages | Where-Object { $_.name -eq $tool }).executables | ForEach-Object {
Context "$($tool.name) package"{
$executables = $tool.executables | ForEach-Object {
@{
ExecName = $_
ExecDir = $ExecDir
ExecDir = $execDir
LeonidLapshin marked this conversation as resolved.
Show resolved Hide resolved
}
}

BeforeEach {
$env:PATH = "$ExecDir;$env:PATH"
$env:PATH = "$execDir;$env:PATH"
}

It "<ExecName> is installed in <ExecDir>" -TestCases $executables {
Expand Down
2 changes: 2 additions & 0 deletions images/win/toolsets/toolset-2016.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
"mingw": [
{
"arch": "mingw-w64-x86_64",
"exec_dir": "mingw64",
"runtime_packages": [
{
"name": "clang",
Expand Down Expand Up @@ -214,6 +215,7 @@
},
{
"arch": "mingw-w64-i686",
"exec_dir": "mingw32",
"runtime_packages": [
{
"name": "clang",
Expand Down
2 changes: 2 additions & 0 deletions images/win/toolsets/toolset-2019.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
"mingw": [
{
"arch": "mingw-w64-x86_64",
"exec_dir": "mingw64",
"runtime_packages": [
{
"name": "clang",
Expand Down Expand Up @@ -214,6 +215,7 @@
},
{
"arch": "mingw-w64-i686",
"exec_dir": "mingw32",
"runtime_packages": [
{
"name": "clang",
Expand Down