Merge pull request #20297 from Homebrew/test_bot_download_concurrency

workflows/tests: set HOMEBREW_DOWNLOAD_CONCURRENCY for test-bot tests.
This commit is contained in:
Mike McQuaid 2025-07-29 13:32:57 +00:00 committed by GitHub
commit d90a421467
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 35 additions and 8 deletions

View File

@ -368,6 +368,7 @@ jobs:
env: env:
HOMEBREW_TEST_BOT_ANALYTICS: 1 HOMEBREW_TEST_BOT_ANALYTICS: 1
HOMEBREW_ENFORCE_SBOM: 1 HOMEBREW_ENFORCE_SBOM: 1
HOMEBREW_DOWNLOAD_CONCURRENCY: 4
steps: steps:
- name: Install Homebrew and Homebrew's dependencies - name: Install Homebrew and Homebrew's dependencies
# All other images are built from our Homebrew Dockerfile. # All other images are built from our Homebrew Dockerfile.

View File

@ -38,6 +38,8 @@ module Homebrew
rescue ChecksumMismatchError => e rescue ChecksumMismatchError => e
opoo "#{downloadable.download_type} reports different checksum: #{e.expected}" opoo "#{downloadable.download_type} reports different checksum: #{e.expected}"
Homebrew.failed = true if downloadable.is_a?(Resource::Patch) Homebrew.failed = true if downloadable.is_a?(Resource::Patch)
rescue => e
raise e unless bottle_manifest_error?(downloadable, e)
end end
else else
spinner = Spinner.new spinner = Spinner.new
@ -68,6 +70,9 @@ module Homebrew
raise future.state.to_s raise future.state.to_s
end end
exception = future.reason if future.rejected?
next 1 if bottle_manifest_error?(downloadable, exception)
message = "#{downloadable.download_type} #{downloadable.name}" message = "#{downloadable.download_type} #{downloadable.name}"
if tty if tty
stdout_print_and_flush "#{status} #{message}#{"\n" unless last}" stdout_print_and_flush "#{status} #{message}#{"\n" unless last}"
@ -76,14 +81,13 @@ module Homebrew
end end
if future.rejected? if future.rejected?
if (e = future.reason).is_a?(ChecksumMismatchError) if exception.is_a?(ChecksumMismatchError)
opoo "#{downloadable.download_type} reports different checksum: #{e.expected}" opoo "#{downloadable.download_type} reports different checksum: #{exception.expected}"
Homebrew.failed = true if downloadable.is_a?(Resource::Patch) Homebrew.failed = true if downloadable.is_a?(Resource::Patch)
next 2 next 2
else else
message = future.reason.to_s message = future.reason.to_s
onoe message ofail message
Homebrew.failed = true
next message.count("\n") next message.count("\n")
end end
end end
@ -165,6 +169,13 @@ module Homebrew
private 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 } sig { void }
def cancel def cancel
# FIXME: Implement graceful cancellation of running downloads based on # FIXME: Implement graceful cancellation of running downloads based on

View File

@ -320,6 +320,8 @@ class FormulaInstaller
# Needs to be done before expand_dependencies for compute_dependencies # Needs to be done before expand_dependencies for compute_dependencies
fetch_bottle_tab if pour_bottle? fetch_bottle_tab if pour_bottle?
fetch_fetch_deps unless ignore_deps?
@ran_prelude_fetch = true @ran_prelude_fetch = true
end end
@ -346,7 +348,9 @@ class FormulaInstaller
forbidden_formula_check forbidden_formula_check
check_install_sanity check_install_sanity
install_fetch_deps unless ignore_deps?
# with the download queue: these should have already been installed
install_fetch_deps if !ignore_deps? && download_queue.nil?
end end
sig { void } sig { void }
@ -475,6 +479,18 @@ class FormulaInstaller
sig { params(_formula: Formula).returns(T.nilable(T::Boolean)) } sig { params(_formula: Formula).returns(T.nilable(T::Boolean)) }
def fresh_install?(_formula) = false def fresh_install?(_formula) = false
sig { void }
def fetch_fetch_deps
return if @compute_dependencies.blank?
compute_dependencies(use_cache: false) if @compute_dependencies.any? do |dep,|
next false unless dep.implicit?
fetch_dependencies
true
end
end
sig { void } sig { void }
def install_fetch_deps def install_fetch_deps
return if @compute_dependencies.blank? return if @compute_dependencies.blank?
@ -1455,8 +1471,6 @@ on_request: installed_on_request?, options:)
# We also skip bottle installs from local bottle paths, as these are done in CI # We also skip bottle installs from local bottle paths, as these are done in CI
# as part of the build lifecycle before attestations are produced. # as part of the build lifecycle before attestations are produced.
if check_attestation && if check_attestation &&
# TODO: support this for download queues at some point
download_queue.nil? &&
Homebrew::Attestation.enabled? && Homebrew::Attestation.enabled? &&
formula.tap&.core_tap? && formula.tap&.core_tap? &&
formula.name != "gh" formula.name != "gh"
@ -1545,7 +1559,7 @@ on_request: installed_on_request?, options:)
# download queue has already done the actual staging but we'll lie about # download queue has already done the actual staging but we'll lie about
# pouring now for nicer output # pouring now for nicer output
ohai "Pouring #{downloadable.downloader.basename}" ohai "Pouring #{downloadable.downloader.basename}"
downloadable.downloader.stage unless download_queue downloadable.downloader.stage if download_queue.nil? || !formula.prefix.exist?
end end
Tab.clear_cache Tab.clear_cache

View File

@ -73,6 +73,7 @@ module Homebrew
downloadable.verify_download_integrity(download) if verify_download_integrity && !json_download downloadable.verify_download_integrity(download) if verify_download_integrity && !json_download
if pour && downloadable.is_a?(Bottle) if pour && downloadable.is_a?(Bottle)
HOMEBREW_CELLAR.mkpath
UnpackStrategy.detect(download, prioritize_extension: true) UnpackStrategy.detect(download, prioritize_extension: true)
.extract_nestedly(to: HOMEBREW_CELLAR) .extract_nestedly(to: HOMEBREW_CELLAR)
elsif json_download elsif json_download