34 Commits

Author SHA1 Message Date
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
Douglas Eichelberger
1ca5299f40
refactor: Enable strict typing in download_strategy 2025-03-12 15:15:20 -07:00
Sam Ford
cf22382921
Curl: use typed: strict
This upgrades `utils/curl.rb` to `typed: strict`, which requires
a number of changes to pass `brew typecheck`. The most
straightforward are adding type signatures to methods, adding type
annotations (e.g., `T.let`) to variables that need them, and ensuring
that methods always use the expected return type.

I had to refactor areas where we call a `Utils::Curl` method and use
array destructuring on a `SystemCommand::Result` return value
(e.g., `output, errors, status = curl_output(...)`), as Sorbet
doesn't understand implicit array conversion. As suggested by Markus,
I've switched these areas to use `#stdout`, `#stderr`, and `#status`.
This requires the use of an intermediate variable (`result`) in some
cases but this was a fairly straightforward substitution.

I also had to refactor how `Cask::URL::BlockDSL::PageWithURL` works.
It currently uses `page.extend PageWithURL` to add a `url` attribute
but this reworks it to subclass `SimpleDelegator` and use an
`initialize` method instead. This achieves the same goal but in a way
that Sorbet can understand.
2025-01-14 08:14:39 -05:00
Michael Cho
c8d0a1904d
test/download_strategies/abstract_spec: fix test 2024-12-19 15:27:14 -05:00
Michael Cho
43ee408793
utils/curl: workaround curl bug for --head --request GET
The `curl --head --request GET` causes a full download to happen on
`curl` from 8.7.0 to 8.9.1[^1] which causes poor UX due to slow
Cask downloads that can take almost twice as long as they should.

[^1]: https://github.com/Homebrew/brew/issues/18213
2024-10-05 14:05:59 -04:00
John Bampton
f6ee19239d Fix spelling; Github -> GitHub 2024-06-15 19:08:53 +10:00
Daeho Ro
5680ffe2e6 add ssh://git scheme for git download strategy 2024-04-21 18:57:04 +09:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Douglas Eichelberger
26eda5a303
git grep -l '^describe' | xargs gsed -i 's|^describe|RSpec.describe|g' 2024-02-19 13:57:27 +00:00
Mike McQuaid
4436a663f2
download_strategies/curl_spec: fix test. 2023-10-21 09:41:35 +01:00
Rui Chen
4232cb6c90
curl_spec: update test
Signed-off-by: Rui Chen <rui@chenrui.dev>
2023-10-20 20:46:22 -04:00
Rui Chen
d31f4e4697
fix: update UA regex
Signed-off-by: Rui Chen <rui@chenrui.dev>
2023-09-09 22:47:47 -04:00
Mike McQuaid
7da934f7e2
Deprecate/disable/delete code.
The next release after this is merged will be 4.1.0.

Co-authored-by: Markus Reiter <me@reitermark.us>
2023-07-06 16:56:20 +01:00
Bo Anderson
6d8b033eff
Significantly improve fetch speed of bottles 2023-06-22 15:08:16 +01:00
Markus Reiter
9885fbc129
Fix failing test. 2023-05-19 14:07:06 +02:00
Markus Reiter
353818f508
Rename curl_head to curl_headers. 2023-05-06 03:41:35 +02:00
Douglas Eichelberger
9075cbae62 brew style --fix 2023-04-21 09:58:50 -07:00
Douglas Eichelberger
ac1e6ded9a git grep -l '# typed: false' | xargs gsed -i 's|# typed: false||g' 2023-04-21 09:57:47 -07:00
Markus Reiter
fbf474a3fd
Add curl_head method. 2023-04-06 10:22:24 +02:00
Issy Long
3a83b5492c
rubocop: Clean up Style/BlockDelimiters excludes and autofix offenses
- The defaults of using "do ... end" for multi-line blocks everywhere is
  good, better than switching everything to braces everywhere.
2023-03-08 23:54:22 +00:00
Issy Long
734a651f93
rubocop: Enable Layout/MultilineMethodCallIndentation & fix offenses
- Part of trying to reduce the number of `Excludes:` we have in our
  RuboCop configs.
- The fixes here all seemed reasonable, with some minimal tweaks for
  line length and less floatiness. Apart from `test/dev-cmd/bottle_spec.rb`
  where RuboCop wanted to do some ridiculously floaty indentation and there
  wasn't an obvious alternative place to break the lines, so I opted for
  in-line disables instead.
2023-03-03 22:18:51 +00:00
Mike McQuaid
c3294f9356
test: add instance variable comments. 2023-01-24 10:15:25 +00:00
Douglas Eichelberger
49ca993074 git grep -l rubocop:todo test/ | xargs gsed -i 's|rubocop:todo|rubocop:disable|g' 2023-01-23 11:51:12 -08:00
Douglas Eichelberger
c45efc6eff rubocop --autocorrect --disable-uncorrectable 2023-01-23 11:49:04 -08:00
Bo Anderson
af234779af
test: support non-master init.defaultbranch 2022-10-07 18:44:03 +01:00
Mike McQuaid
7349c2b996
brew style --fix 2022-09-13 09:43:09 +01:00
Gordon Bleux
bcfd20e1b9 change cURL download behaviour for HOMEBREW_ARTIFACT_DOMAIN.
instead of prefixing and/or replacing data in URLs, the
*HOMEBREW_ARTIFACT_DOMAIN* environment variable only replaces
the bottle base URL. this causes URLs from Casks and other assets
to be no longer affected by this feature.

closes #13226
closes #13222
closes #13227
2022-06-11 08:24:50 +02:00
Bo Anderson
5e6d5f68ca
test/download_strategies/curl_github_packages: fix bad const override 2022-05-24 22:50:22 +01:00
Mike McQuaid
7a79da2668
Merge pull request #13227 from UiP9AV6Y/bugfix_artifact_domain_manpage
docs: clarify application of HOMEBREW_ARTIFACT_DOMAIN
2022-05-23 07:47:41 -04:00
Gordon Bleux
9cbaf97069 decouple authentication information from HOMEBREW_ARTIFACT_DOMAIN
add support for credentials usage in combination with other mirroring
features. previously `HOMEBREW_DOCKER_REGISTRY_TOKEN` and
`HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN` where only used in combination
with `HOMEBREW_ARTIFACT_DOMAIN` which affects *all* curl download strategies.
`HOMEBREW_BOTTLE_DOMAIN` is only used for bottle artifacts, whose mirror might
also require credentials.
this change removes the requirement of using `HOMEBREW_ARTIFACT_DOMAIN`.

related to #13226
2022-05-23 10:38:52 +02:00
Gordon Bleux
b2796ec7fb docs: clarify application of HOMEBREW_ARTIFACT_DOMAIN
bottle URLs are treated differently than any other URL.
this change clarifies the resulting URLs in the manpage.

closes #13222
2022-05-23 09:20:16 +02:00
cnnrmnn
8ef2d2ecc4 Update tests 2021-05-13 12:54:17 -04:00
Issy Long
ead84825a6
test: Fix all RSpec/RepeatedExampleGroupDescription offenses 2021-02-21 14:06:24 +00:00
Rylan Polster
d5d7b6c3db
style: remove RSpec/MultipleDescribes violations
Co-authored-by: Nanda H Krishna <nanda.harishankar@gmail.com>
2021-02-01 20:30:51 -05:00