diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 89a07dcf..55062b38 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -20,19 +20,36 @@ function Get-FortranVersions { return "GNU Fortran " + ($fortranVersions -Join ", ") } -function Get-ClangVersions { - $clangVersions = @() +function Get-ClangToolVersions { + param ( + [Parameter(Mandatory = $true)] + [string] $ToolName, + [string] $VersionPattern = "\d+\.\d+\.\d+)-" + ) + $result = Get-CommandResult "apt list --installed" -Multiline - $clangVersions = $result.Output | Where-Object { $_ -match "^clang-\d+"} | ForEach-Object { + $toolVersions = $result.Output | Where-Object { $_ -match "^${ToolName}-\d+"} | ForEach-Object { $clangCommand = ($_ -Split "/")[0] - Invoke-Expression "$clangCommand --version" | Where-Object { $_ -match "clang version" } | ForEach-Object { - $_ -match "clang version (?\d+\.\d+\.\d+)-" | Out-Null + Invoke-Expression "$clangCommand --version" | Where-Object { $_ -match "${ToolName} version" } | ForEach-Object { + $_ -match "${ToolName} version (?${VersionPattern}" | Out-Null $Matches.version - } - } | Sort-Object {[Version]$_} - return "Clang " + ($clangVersions -Join ", ") + } + } | Sort-Object {[Version]$_} + + return $toolVersions -Join ", " } +function Get-ClangVersions { + $clangVersions = Get-ClangToolVersions -ToolName "clang" + return "Clang " + $clangVersions +} + +function Get-ClangFormatVersions { + $clangFormatVersions = Get-ClangToolVersions -ToolName "clang-format" + return "Clang-format " + $clangFormatVersions +} + + function Get-ErlangVersion { $erlangVersion = (erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), ''OTP_VERSION''])), io:fwrite(Version), halt().' -noshell) $shellVersion = (erl -eval 'erlang:display(erlang:system_info(version)), halt().' -noshell).Trim('"') diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 2559ebc0..1af99554 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -40,6 +40,7 @@ $markdown += New-MDList -Style Unordered -Lines (@( (Get-CPPVersions), (Get-FortranVersions), (Get-ClangVersions), + (Get-ClangFormatVersions), (Get-ErlangVersion), (Get-MonoVersion), (Get-NodeVersion),