Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure checksums are always defined when requested #61

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: Ensure checksums are always defined when requested
  • Loading branch information
Thilas committed May 23, 2024
commit 08ec8200d598f0d1c50014a641d55def87f59382
7 changes: 6 additions & 1 deletion src/Public/Update-Package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@ function Update-Package {
$Env:ChocolateyPackageVersion = $global:Latest.Version.ToString()
$Env:ChocolateyAllowEmptyChecksums = 'true'
foreach ($a in $arch) {
"Checking hash for $a bit version..." | result
$Env:chocolateyForceX86 = if ($a -eq '32') { 'true' } else { '' }
try {
#rm -force -recurse -ea ignore $pkg_path
.\tools\chocolateyInstall.ps1 | result
} catch {
if ( "$_" -notlike 'au_break: *') { throw $_ } else {
if ( "$_" -notlike 'au_break: *') { throw } else {
$filePath = "$_" -replace 'au_break: '
if (!(Test-Path $filePath)) { throw "Can't find file path to checksum" }

Expand All @@ -153,6 +154,10 @@ function Update-Package {
}
}
}
# Sanity check: ensure checksum is defined (rare bug!)
if (!$global:Latest.Item('Checksum' + $a)) {
throw "Hash for $a bit version is missing."
}
}
}

Expand Down