Skip to content

Commit

Permalink
[macOS] Update SoftwareReport scripts (actions#9092)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-Ayupov authored Jan 4, 2024
1 parent 83fbf5a commit 9da2ec6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
1 change: 0 additions & 1 deletion images/macos/scripts/build/Install-Xcode.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ $xcodeVersions | ForEach-Object {
$xcodebuildPath = Get-XcodeToolPath -Version $_.link -ToolName 'xcodebuild'
Invoke-ValidateCommand "sudo $xcodebuildPath -downloadPlatform $runtime" | Out-Null
}

}

Invoke-XcodeRunFirstLaunch -Version $defaultXcode
Expand Down
18 changes: 9 additions & 9 deletions images/macos/scripts/docs-gen/SoftwareReport.Common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function Build-OSInfoSection {
)

$fieldsToInclude = @("System Version:", "Kernel Version:")
$rawSystemInfo = Invoke-Expression "system_profiler SPSoftwareDataType"
$rawSystemInfo = Run-Command "system_profiler SPSoftwareDataType"
$parsedSystemInfo = $rawSystemInfo | Where-Object { -not ($_ | Select-String -NotMatch $fieldsToInclude) } | ForEach-Object { $_.Trim() }
$parsedSystemInfo[0] -match "System Version: macOS (?<version>\d+)" | Out-Null
$version = $Matches.Version
Expand All @@ -169,12 +169,12 @@ function Build-OSInfoSection {
}

function Get-MonoVersion {
$monoVersion = mono --version | Out-String | Take-Part -Part 4
$monoVersion = Run-Command "mono --version" | Out-String | Take-Part -Part 4
return $monoVersion
}

function Get-MSBuildVersion {
$msbuildVersion = msbuild -version | Select-Object -Last 1
$msbuildVersion = Run-Command "msbuild -version" | Select-Object -Last 1
$monoVersion = Get-MonoVersion
return "$msbuildVersion (Mono $monoVersion)"
}
Expand Down Expand Up @@ -250,7 +250,7 @@ function Get-NuGetVersion {
}

function Get-CondaVersion {
$condaVersion = Invoke-Expression "conda --version"
$condaVersion = Run-Command "conda --version"
return ($condaVersion -replace "^conda").Trim()
}

Expand Down Expand Up @@ -312,7 +312,7 @@ function Get-SVNVersion {

function Get-PackerVersion {
# Packer 1.7.1 has a bug and outputs version to stderr instead of stdout https://github.com/hashicorp/packer/issues/10855
$result = Run-Command -Command "packer --version"
$result = Run-Command "packer --version"
$packerVersion = [regex]::matches($result, "(\d+.){2}\d+").Value
return $packerVersion
}
Expand Down Expand Up @@ -538,22 +538,22 @@ function Get-JazzyVersion {
}

function Get-ZlibVersion {
$zlibVersion = brew info --json zlib | jq -r '.[].installed[].version'
$zlibVersion = (Run-Command "brew info --json zlib" | ConvertFrom-Json).installed.version
return $zlibVersion
}

function Get-LibXftVersion {
$libXftVersion = brew info --json libxft | jq -r '.[].installed[].version'
$libXftVersion = (Run-Command "brew info --json libxft" | ConvertFrom-Json).installed.version
return $libXftVersion
}

function Get-LibXextVersion {
$libXextVersion = brew info --json libxext | jq -r '.[].installed[].version'
$libXextVersion = (Run-Command "brew info --json libxext" | ConvertFrom-Json).installed.version
return $libXextVersion
}

function Get-TclTkVersion {
$tcltkVersion = brew info --json tcl-tk | jq -r '.[].installed[].version'
$tcltkVersion = (Run-Command "brew info --json tcl-tk" | ConvertFrom-Json).installed.version
return $tcltkVersion
}

Expand Down
3 changes: 2 additions & 1 deletion images/macos/scripts/helpers/Xcode.Installer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Invoke-DownloadXcodeArchive {
if ($xcodeSha256 -ne $Sha256Sum) {
throw "Xcode $Version checksum mismatch. Expected: $Sha256Sum, Actual: $xcodeSha256"
}

return $tempXipDirectory
}

Expand All @@ -65,6 +65,7 @@ function Get-AvailableXcodeVersions {
$availableVersions = $rawVersionsList | ForEach-Object {
$partStable,$partMajor = $_.Split(" ", 2)
$semver = $stableSemver = [SemVer]::Parse($partStable)

if ($partMajor) {
# Convert 'beta 3' -> 'beta.3', 'Release Candidate' -> 'releasecandidate', 'GM Seed 2' -> 'gmseed.2'
$normalizedLabel = $partMajor.toLower() -replace " (\d)", '.$1' -replace " ([a-z])", '$1'
Expand Down

0 comments on commit 9da2ec6

Please sign in to comment.