18 Commits

Author SHA1 Message Date
Mike McQuaid
7df24d03f2
download_queue: add missing require.
We use `Resource` in a few places here so need to require it.
2025-08-08 08:33:26 +01:00
Eric Knibbe
0675ddc876
download_queue: display hash of rejected download 2025-08-06 23:02:18 -04:00
Mike McQuaid
774ef54981
Improve Download Queue output
Update the naming, presence and values for various download queue
methods to improve the output for users while making the internal code
a little easier to follow.

While we're here, also ensure that a single formula download still
displays the download queue output and indirectly fix an issue with
bottle manifests being named incorrectly.
2025-08-04 15:51:02 +01:00
Mike McQuaid
b63669c92b
download_queue: fix bottle manifest handling.
These should be ignored upon failures.
2025-07-29 12:42:13 +01:00
Mike McQuaid
332527f16f
download_queue: improve non-TTY output.
Print simpler output when not running in a TTY.
2025-07-25 16:00:45 +00:00
Mike McQuaid
ed5805e50c
Add JSON API download strategy for download queue
This fixes the weird/broken existing behaviour which was incorrectly
creating symlinks at download time. It also defers much more logic to
the original code.

For clarity, rename the existing `API::Download` class to
`API::SourceDownload`.

While we're here:
- add a/improve the `download_type` method on all `Downloadable`
  subclasses to improve download queue output format
- move some logic to `RetryDownload`
2025-07-22 17:48:32 +01:00
Mike McQuaid
e5d940fdaa
Improve Download Queue behaviour
- ensure that the `brew.rb` downloads of the API files only happens
  when they are more stale (>1 day) and using the API is not disabled
- default `brew fetch` and `brew install` to a single download retry

Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-07-21 09:10:06 +01:00
Rylan Polster
df3b3ce19c
Skip concurrent fetch with fewer than 2 downloads 2025-07-20 17:12:43 -04:00
Mike McQuaid
36c7f4950c
Optionally parallelise API file downloads
This assumes that all should be downloaded (at least once) on `brew`
commands being run.

Requires a certain amount of cleanup and refactoring around our API
handling and Tap migration methods (which were both weirdly placed and
in some cases broken).

Behaviour without `HOMEBREW_DOWNLOAD_CONCURRENCY` set should
be unchanged.
2025-07-18 15:01:34 +01:00
Mike McQuaid
5cc6722372
Optionally use DownloadQueue for brew install
Allowing using `HOMEBREW_DOWNLOAD_CONCURRENCY` to use the
`DownloadQueue` for `brew install` by downloading and extracting
bottles in parallel.

This requires some fixes in e.g. `Dependency` and `FormulaInstaller`
to be able to front-load all downloads and handle parallelisation of
bottle pouring.

Behaviour without `HOMEBREW_DOWNLOAD_CONCURRENCY` set should be
unchanged.

Attestations are not handled for now and the UI should be improved
before we roll this out to users.

Post-install upgrades are not yet parallelised.

Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-07-18 15:00:23 +01:00
Mike McQuaid
a3d6ee1d2a
Refactor DownloadQueue handling
- Use undocumented (for now) `HOMEBREW_DOWNLOAD_CONCURRENCY` instead
  of `--concurrency` flag and avoid passing around `concurrency`
- Create and use `Formula#enqueue_resources_and_patches` helper method
- Rename some method calls to be more obvious
- Use `Downloadable` type to simplify type checks
- General refactoring
2025-07-17 17:49:53 +01:00
Mike McQuaid
f4e629331f
Move more logic from cmd/fetch to download_queue
This is the first step towards using the download queue for all
download operations e.g. `brew install`, `brew upgrade`,
`brew reinstall` etc.

While we're here, do some API cleanup and Sorbet type improvements.
2025-07-11 16:57:41 +01:00
Mike McQuaid
d661cffc1f
Switch to using main as the default branch
Homebrew/brew has moved to a `main` default branch so we can more move
references from `master` to `main`.
2025-06-24 11:14:57 +01:00
Issy Long
6ada9a9665
Add clarifying comments to rubocop:disables
- Needed for PR 18842 that adds a `DisableComment` RuboCop to ensure that all RuboCop disables have comments.
2025-01-12 16:59:07 +00:00
Markus Reiter
b68ee4142f
Ensure thread-pool shutdown. 2024-09-07 14:45:30 +02:00
Markus Reiter
e7c9049a3c
Use futures instead of promises. 2024-09-04 22:54:27 +02:00
Markus Reiter
b353e9cbf2
Don't require everything. 2024-09-04 22:54:22 +02:00
Markus Reiter
b297be77a1
Implement concurrent downloads. 2024-09-04 22:54:20 +02:00