This reduces the surface area of our `Kernel` monkeypatch and removes
the need to `include Kernel` in a bunch of modules.
While we're here, also move `Kernel#require?` to `Homebrew` and fully
scope the calls to it.
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.
These were being downloaded twice simultaneously which causes a locking
race condition.
While we're here, also improve the output of bottle manifests and
patches in the 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`
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.
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>
- 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
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.