Fix computation of SHA512 checksum (#15736)

This commit is contained in:
Aditya Patwardhan
2021-07-07 13:17:45 -07:00
committed by GitHub
parent 996d830de2
commit 03c0933092
2 changed files with 17 additions and 11 deletions
+7 -3
View File
@@ -2204,10 +2204,14 @@ function New-ReferenceAssembly
$sourceProjectRoot = Join-Path $PSScriptRoot "projects/reference/$assemblyName"
$sourceProjectFile = Join-Path $sourceProjectRoot "$assemblyName.csproj"
Copy-Item -Path $sourceProjectFile -Destination "$projectFolder/$assemblyName.csproj" -Force
Copy-Item -Path (Join-Path -Path $PSScriptRoot -ChildPath "../../nuget.config") -Destination $projectFolder
Write-Host "##vso[artifact.upload containerfolder=artifact;artifactname=artifact]$projectFolder/$assemblyName.csproj"
$destProjectFile = Join-Path $projectFolder "$assemblyName.csproj"
$nugetConfigFile = Join-Path $PSScriptRoot "../../nuget.config"
Copy-Item -Path $sourceProjectFile -Destination $destProjectFile -Force -Verbose
Copy-Item -Path $nugetConfigFile -Destination $projectFolder -Verbose
Write-Host "##vso[artifact.upload containerfolder=artifact;artifactname=artifact]$destProjectFile"
Write-Host "##vso[artifact.upload containerfolder=artifact;artifactname=artifact]$generatedSource"
$arguments = GenerateBuildArguments -AssemblyName $assemblyName -RefAssemblyVersion $RefAssemblyVersion -SnkFilePath $SnkFilePath -SMAReferencePath $SMAReferenceAssembly
@@ -201,16 +201,18 @@ jobs:
$packagePathList = Get-ChildItem $packagePath -Recurse | Select-Object -ExpandProperty FullName | Out-String
Write-Verbose -Verbose $packagePathList
Get-ChildItem -Path $packagePath |
$checksums = Get-ChildItem -Path $packagePath |
ForEach-Object {
Write-Verbose -Verbose "Generating checksum file for $($_.FullName)"
$packageName = $_.Name
$hash = (Get-FileHash -Path $_.FullName -Algorithm SHA512).Hash.ToLower()
Write-Verbose -Verbose "Generating checksum file for $($_.FullName)"
$packageName = $_.Name
$hash = (Get-FileHash -Path $_.FullName -Algorithm SHA512).Hash.ToLower()
# the '*' before the packagename signifies it is a binary
"$hash *$packageName"
}
$checksums | Out-File -FilePath "$packagePath\SHA512SUMS" -Force
# the '*' before the packagename signifies it is a binary
"$hash *$packageName"
} |
Out-File -FilePath "$packagePath\SHA512SUMS" -Force
$fileContent = Get-Content -Path "$packagePath\SHA512SUMS" -Raw | Out-String
Write-Verbose -Verbose -Message $fileContent