Skip to content

Commit 81efd40

Browse files
committed
write the release hashes with LF on every platform #328
1 parent a849af7 commit 81efd40

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

‎scripts/build-release.Tests.ps1‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,15 @@ Describe 'build-release.ps1' {
6262
$artifacts.Name | Should -HaveCount 6
6363
$artifacts | Where-Object { !(Test-Path "$($_.FullName).sha512") } | Should -BeNullOrEmpty
6464
}
65+
66+
It 'writes every hash as one LF-terminated line' {
67+
Invoke-InScratchTree -Root $script:Root -Script 'build-release.ps1' | Out-Null
68+
69+
$hashes = Get-ChildItem (Join-Path $script:Root 'build' 'artifacts') -Filter '*.sha512'
70+
$hashes | Should -HaveCount 6
71+
foreach ($hash in $hashes)
72+
{
73+
[System.IO.File]::ReadAllText($hash.FullName) | Should -MatchExactly '^[0-9a-f]{128} \*\./\S+\n\z'
74+
}
75+
}
6576
}

‎scripts/build-release.ps1‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ function Write-HashAndSignature
2121
$File.FullName
2222
$ComputedHash = (Get-FileHash -Algorithm 'SHA512' $File).Hash.ToLowerInvariant()
2323
$ComputedHash
24-
Set-Content -Path "$($File.FullName).sha512" -Value "$ComputedHash *./$($File.Name)"
24+
# LF on every platform: the macOS sha512sum reads a CR from a Windows build as part of the file name.
25+
Set-Content -NoNewline -Path "$($File.FullName).sha512" -Value "$ComputedHash *./$($File.Name)`n"
2526
gpg --armor --output "$($File.FullName).asc" --detach-sig $File.FullName
2627
}
2728

0 commit comments

Comments
 (0)