From b63669c92b6731504c1fb1fba6baee26da9d6684 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 29 Jul 2025 12:42:13 +0100 Subject: [PATCH] download_queue: fix bottle manifest handling. These should be ignored upon failures. --- Library/Homebrew/download_queue.rb | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/download_queue.rb b/Library/Homebrew/download_queue.rb index 7e372f8a91..05dceb0d40 100644 --- a/Library/Homebrew/download_queue.rb +++ b/Library/Homebrew/download_queue.rb @@ -38,6 +38,8 @@ module Homebrew rescue ChecksumMismatchError => e opoo "#{downloadable.download_type} reports different checksum: #{e.expected}" Homebrew.failed = true if downloadable.is_a?(Resource::Patch) + rescue => e + raise e unless bottle_manifest_error?(downloadable, e) end else spinner = Spinner.new @@ -68,6 +70,9 @@ module Homebrew raise future.state.to_s end + exception = future.reason if future.rejected? + next 1 if bottle_manifest_error?(downloadable, exception) + message = "#{downloadable.download_type} #{downloadable.name}" if tty stdout_print_and_flush "#{status} #{message}#{"\n" unless last}" @@ -76,14 +81,13 @@ module Homebrew end if future.rejected? - if (e = future.reason).is_a?(ChecksumMismatchError) - opoo "#{downloadable.download_type} reports different checksum: #{e.expected}" + if exception.is_a?(ChecksumMismatchError) + opoo "#{downloadable.download_type} reports different checksum: #{exception.expected}" Homebrew.failed = true if downloadable.is_a?(Resource::Patch) next 2 else message = future.reason.to_s - onoe message - Homebrew.failed = true + ofail message next message.count("\n") end end @@ -165,6 +169,13 @@ module Homebrew private + sig { params(downloadable: Downloadable, exception: T.nilable(Exception)).returns(T::Boolean) } + def bottle_manifest_error?(downloadable, exception) + return false if exception.nil? + + downloadable.is_a?(Resource::BottleManifest) || exception.is_a?(Resource::BottleManifest::Error) + end + sig { void } def cancel # FIXME: Implement graceful cancellation of running downloads based on