Skip to content

Commit d90a421

Browse files
authored
Merge pull request #20297 from Homebrew/test_bot_download_concurrency
workflows/tests: set HOMEBREW_DOWNLOAD_CONCURRENCY for test-bot tests.
2 parents 3b61b44 + b63669c commit d90a421

File tree

4 files changed

+35
-8
lines changed

4 files changed

+35
-8
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ jobs:
368368
env:
369369
HOMEBREW_TEST_BOT_ANALYTICS: 1
370370
HOMEBREW_ENFORCE_SBOM: 1
371+
HOMEBREW_DOWNLOAD_CONCURRENCY: 4
371372
steps:
372373
- name: Install Homebrew and Homebrew's dependencies
373374
# All other images are built from our Homebrew Dockerfile.

Library/Homebrew/download_queue.rb

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ def fetch
3838
rescue ChecksumMismatchError => e
3939
opoo "#{downloadable.download_type} reports different checksum: #{e.expected}"
4040
Homebrew.failed = true if downloadable.is_a?(Resource::Patch)
41+
rescue => e
42+
raise e unless bottle_manifest_error?(downloadable, e)
4143
end
4244
else
4345
spinner = Spinner.new
@@ -68,6 +70,9 @@ def fetch
6870
raise future.state.to_s
6971
end
7072

73+
exception = future.reason if future.rejected?
74+
next 1 if bottle_manifest_error?(downloadable, exception)
75+
7176
message = "#{downloadable.download_type} #{downloadable.name}"
7277
if tty
7378
stdout_print_and_flush "#{status} #{message}#{"\n" unless last}"
@@ -76,14 +81,13 @@ def fetch
7681
end
7782

7883
if future.rejected?
79-
if (e = future.reason).is_a?(ChecksumMismatchError)
80-
opoo "#{downloadable.download_type} reports different checksum: #{e.expected}"
84+
if exception.is_a?(ChecksumMismatchError)
85+
opoo "#{downloadable.download_type} reports different checksum: #{exception.expected}"
8186
Homebrew.failed = true if downloadable.is_a?(Resource::Patch)
8287
next 2
8388
else
8489
message = future.reason.to_s
85-
onoe message
86-
Homebrew.failed = true
90+
ofail message
8791
next message.count("\n")
8892
end
8993
end
@@ -165,6 +169,13 @@ def shutdown
165169

166170
private
167171

172+
sig { params(downloadable: Downloadable, exception: T.nilable(Exception)).returns(T::Boolean) }
173+
def bottle_manifest_error?(downloadable, exception)
174+
return false if exception.nil?
175+
176+
downloadable.is_a?(Resource::BottleManifest) || exception.is_a?(Resource::BottleManifest::Error)
177+
end
178+
168179
sig { void }
169180
def cancel
170181
# FIXME: Implement graceful cancellation of running downloads based on

Library/Homebrew/formula_installer.rb

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ def prelude_fetch
320320
# Needs to be done before expand_dependencies for compute_dependencies
321321
fetch_bottle_tab if pour_bottle?
322322

323+
fetch_fetch_deps unless ignore_deps?
324+
323325
@ran_prelude_fetch = true
324326
end
325327

@@ -346,7 +348,9 @@ def prelude
346348
forbidden_formula_check
347349

348350
check_install_sanity
349-
install_fetch_deps unless ignore_deps?
351+
352+
# with the download queue: these should have already been installed
353+
install_fetch_deps if !ignore_deps? && download_queue.nil?
350354
end
351355

352356
sig { void }
@@ -475,6 +479,18 @@ def check_install_sanity
475479
sig { params(_formula: Formula).returns(T.nilable(T::Boolean)) }
476480
def fresh_install?(_formula) = false
477481

482+
sig { void }
483+
def fetch_fetch_deps
484+
return if @compute_dependencies.blank?
485+
486+
compute_dependencies(use_cache: false) if @compute_dependencies.any? do |dep,|
487+
next false unless dep.implicit?
488+
489+
fetch_dependencies
490+
true
491+
end
492+
end
493+
478494
sig { void }
479495
def install_fetch_deps
480496
return if @compute_dependencies.blank?
@@ -1455,8 +1471,6 @@ def fetch
14551471
# We also skip bottle installs from local bottle paths, as these are done in CI
14561472
# as part of the build lifecycle before attestations are produced.
14571473
if check_attestation &&
1458-
# TODO: support this for download queues at some point
1459-
download_queue.nil? &&
14601474
Homebrew::Attestation.enabled? &&
14611475
formula.tap&.core_tap? &&
14621476
formula.name != "gh"
@@ -1545,7 +1559,7 @@ def pour
15451559
# download queue has already done the actual staging but we'll lie about
15461560
# pouring now for nicer output
15471561
ohai "Pouring #{downloadable.downloader.basename}"
1548-
downloadable.downloader.stage unless download_queue
1562+
downloadable.downloader.stage if download_queue.nil? || !formula.prefix.exist?
15491563
end
15501564

15511565
Tab.clear_cache

Library/Homebrew/retryable_download.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def fetch(verify_download_integrity: true, timeout: nil, quiet: false)
7373
downloadable.verify_download_integrity(download) if verify_download_integrity && !json_download
7474

7575
if pour && downloadable.is_a?(Bottle)
76+
HOMEBREW_CELLAR.mkpath
7677
UnpackStrategy.detect(download, prioritize_extension: true)
7778
.extract_nestedly(to: HOMEBREW_CELLAR)
7879
elsif json_download

0 commit comments

Comments
 (0)