From 29ed3cb050137a27ebbd5b185f56a162b3fa9de9 Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Thu, 10 Nov 2022 14:38:29 +0800 Subject: [PATCH] builds(checkhashes): Use correct version number if `UseCache` (#5240) --- CHANGELOG.md | 1 + bin/checkhashes.ps1 | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db3574e275..860f28bc5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - **checkver:** Support XML default namespace ([#5191](https://github.com/ScoopInstaller/Scoop/issues/5191)) - **pssa:** Remove unused 'ExcludeRules' ([#5201](https://github.com/ScoopInstaller/Scoop/issues/5201)) - **schema:** Add 'installer' and 'shortcuts' to 'autoupdate' ([#5220](https://github.com/ScoopInstaller/Scoop/issues/5220)) +- **checkhashes:** Use correct version number if `UseCache` ([#5240](https://github.com/ScoopInstaller/Scoop/issues/5240)) ### Continuous Integration diff --git a/bin/checkhashes.ps1 b/bin/checkhashes.ps1 index d60d5ac627..f26839f7d8 100644 --- a/bin/checkhashes.ps1 +++ b/bin/checkhashes.ps1 @@ -114,8 +114,11 @@ foreach ($current in $MANIFESTS) { $current.urls | ForEach-Object { $algorithm, $expected = get_hash $current.hashes[$count] - $version = 'HASH_CHECK' - $tmp = $expected_hash -split ':' + if ($UseCache) { + $version = $current.manifest.version + } else { + $version = 'HASH_CHECK' + } Invoke-CachedDownload $current.app $version $_ $null $null -use_cache:$UseCache @@ -145,12 +148,12 @@ foreach ($current in $MANIFESTS) { Write-Host 'Mismatch found ' -ForegroundColor Red $mismatched | ForEach-Object { $file = fullpath (cache_path $current.app $version $current.urls[$_]) - Write-Host "`tURL:`t`t$($current.urls[$_])" + Write-Host "`tURL:`t`t$($current.urls[$_])" if (Test-Path $file) { - Write-Host "`tFirst bytes:`t$((get_magic_bytes_pretty $file ' ').ToUpper())" + Write-Host "`tFirst bytes:`t$((get_magic_bytes_pretty $file ' ').ToUpper())" } - Write-Host "`tExpected:`t$($current.hashes[$_])" -ForegroundColor Green - Write-Host "`tActual:`t`t$($actuals[$_])" -ForegroundColor Red + Write-Host "`tExpected:`t$($current.hashes[$_])" -ForegroundColor Green + Write-Host "`tActual:`t`t$($actuals[$_])" -ForegroundColor Red } }