Skip to content

Commit 9f52a57

Browse files
authored
Merge pull request #20390 from Homebrew/show-rejected-hash
download_queue: display hash of rejected download
2 parents 696910c + 0675ddc commit 9f52a57

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

Library/Homebrew/download_queue.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ def fetch
8282

8383
if future.rejected?
8484
if exception.is_a?(ChecksumMismatchError)
85+
actual = Digest::SHA256.file(downloadable.cached_download).hexdigest
8586
opoo "#{downloadable.download_queue_type} reports different checksum: #{exception.expected}"
87+
puts (" " * downloadable.download_queue_type.size) + " SHA-256 checksum of downloaded file: #{actual}"
8688
Homebrew.failed = true if downloadable.is_a?(Resource::Patch)
8789
next 2
8890
else

Library/Homebrew/exceptions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ def initialize(path, expected, actual)
735735
@expected = expected
736736

737737
super <<~EOS
738-
SHA256 mismatch
738+
SHA-256 mismatch
739739
Expected: #{Formatter.success(expected.to_s)}
740740
Actual: #{Formatter.error(actual.to_s)}
741741
File: #{path}

Library/Homebrew/retryable_download.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def fetch(verify_download_integrity: true, timeout: nil, quiet: false)
7070

7171
unless quiet
7272
puts "Downloaded to: #{download}" unless already_downloaded
73-
puts "SHA256: #{download.sha256}"
73+
puts "SHA-256: #{download.sha256}"
7474
end
7575

7676
json_download = downloadable.is_a?(API::JSONDownload)

Library/Homebrew/test/exceptions_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class Baz < Formula; end
217217
let(:expected_checksum) { instance_double(Checksum, to_s: "deadbeef") }
218218
let(:actual_checksum) { instance_double(Checksum, to_s: "deadcafe") }
219219

220-
it(:to_s) { expect(error.to_s).to match(/SHA256 mismatch/) }
220+
it(:to_s) { expect(error.to_s).to match(/SHA-256 mismatch/) }
221221
end
222222

223223
describe ResourceMissingError do

0 commit comments

Comments
 (0)