Reworked validation

This commit is contained in:
Vladimir Safonkin
2020-03-24 14:29:50 +03:00
parent de434649ee
commit 303d675ea2
@@ -3,55 +3,44 @@
## Desc: Validate Msys2 ## Desc: Validate Msys2
################################################################################ ################################################################################
if (Get-Command -Name 'gcc') $msys2BinDir = "C:\msys64\usr\bin"
{ $msys2mingwDir = "C:\msys64\mingw64\bin"
Write-Host "gcc is successfully installed:"
gcc --version | Write-Host $installedTools = @(
} "bash",
else "tar",
{ "make"
Write-Host "gcc is not on PATH" )
Write-Host "Check installed tools in msys2/usr/bin directory"
$installedTools | ForEach-Object {
$toolName = $_
try {
Invoke-Expression "$msys2BinDir\$_ --version"
} catch {
Write-Host "$toolName was not installed in MSYS2 bin directory"
Write-Error $_
exit 1 exit 1
} }
if (Get-Command -Name 'g++')
{
Write-Host "g++ is successfully installed:"
g++ --version | Write-Host
}
else
{
Write-Host "g++ is not on PATH"
exit 1
} }
if (Get-Command -Name 'make') Write-Host "Check gcc in msys2/mingw64/bin directory"
{ try {
Write-Host "make is successfully installed:" Invoke-Expression "$msys2mingwDir\gcc --version"
make --version | Write-Host } catch {
} Write-Host "gcc was not installed in MSYS2 bin directory"
else Write-Error $_
{
Write-Host "make is not on PATH"
exit 1 exit 1
} }
# Adding description of the software to Markdown # Adding description of the software to Markdown
# `gcc --version` gives output like: # $SoftwareName = "MSYS2"
# gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 5.3.0 # $(pacman.exe --version).Split([System.Environment]::NewLine)[1] -match "v\d+\.\d+\.\d+"
# Copyright (C) 2015 Free Software Foundation, Inc. # $pacmanVersion = $matches[0]
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$SoftwareName = "MinGW" # $Description = @"
$(gcc --version).Split([System.Environment]::NewLine)[0] -match "\d+\.\d+\.\d+$" # _Pacman version:_ $pacmanVersion<br/>
$minGwVersion = $matches[0] # "@
$Description = @" # Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
_Version:_ $minGwVersion<br/>
_Environment:_
* PATH: contains location of the MinGW 'bin' directory
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description