1042 Commits

Author SHA1 Message Date
Douglas Eichelberger
b827a1337a
Enable strict typing in Utils::Bottles 2025-09-08 10:48:23 -07:00
Mike McQuaid
a1f112f3fe
Move o* output methods to Utils::Output
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.
2025-08-20 19:20:19 +01:00
Bo Anderson
4d43063060
Fix formula installs without a tab 2025-08-18 20:23:19 +01:00
Mike McQuaid
22fdb11e00
**/keg_relocate.rb: add set Sorbet typed: strict
Other files have been changed where required.
2025-08-18 15:02:15 +01:00
Eric Knibbe
827480f06b
messages/comments: wording fixes 2025-08-16 00:57:59 -04:00
Eric Knibbe
e021953db4
messages/comments: formatting fixes 2025-08-16 00:54:50 -04:00
Eric Knibbe
6255263b51
output: express environment variables consistently 2025-08-04 09:50:06 -04:00
Mike McQuaid
5d01b22d38
formula*: add source download support for download queue.
This should allow downloading the formula files from GitHub in
parallel too.
2025-07-29 13:48:43 +01:00
Mike McQuaid
0c09ed71d4
formula_installer: fix fetch deps and local pour for download queue. 2025-07-29 12:19:39 +01:00
Bo Anderson
406b9c029b
Fix forbidding special license refs 2025-07-24 23:37:31 +01:00
Mike McQuaid
e10d4c43c2
Optionally use DownloadQueue for reinstall, upgrade.
Follow up on `DownloadQueue` for download concurrency on `brew fetch`
and `brew install` to also add support for `brew reinstall` and
`brew upgrade`.

This required a fair bit of refactoring to make this work so I've also
made `install.rb`, `reinstall.rb` and `upgrade.rb` `typed: strict` to
add some extra guardrails from Sorbet here.

Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-07-24 15:41:03 +01:00
Bo Anderson
65853d9bab
formula_installer: ignore bottle_tab_runtime_dependencies errors 2025-07-20 16:02:43 +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
Patrick Linnane
4513a43d53
Fix RuboCop failures.
Co-authored-by: Patrick Linnane <patrick@linnane.io>
Co-authored-by: Carlo Cabrera <github@carlo.cab>
Co-authored-by: Thierry Moisan <thierry.moisan@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-07-14 19:12:38 +01:00
Mike McQuaid
b87d2887fe
Merge pull request #20033 from tyuwags/master
Refine ask‐option dependency resolution and strengthen tests
2025-06-26 10:52:46 +00:00
Mike McQuaid
05c7b65f54
tab, cask/tab: add more Sorbet types and signatures.
I bailed before going all the way to `typed: strict` but this should at
least improve things and fix:

`Library/Homebrew/tab.rb:111: warning: The class Tab reached 8 shape variations, instance variables accesses will be slower and memory usage increased.`
2025-06-24 12:06:55 +01:00
thibhero
052c0ae2cd adding parameter to fetch quietly if wanted 2025-06-20 12:25:12 -04:00
Mike McQuaid
e9f55a8f71
tests: default to API mode enabled.
While we're here, also add `brew tests --no-parallel` which I relied
on during testing.

Pretty much anywhere we rely on a stubbed formula on disk to work: we
need to disable the API.
2025-06-10 15:53:27 +01:00
Mike McQuaid
ff710f8191
Improve completions (and elisp) output in caveats
Instead of repeatedly outputting the same identical messages across
multiple packages and repeating them all for every package after they
were all installed: just output the identical messages in the final
caveats output instead.
2025-06-06 17:09:28 +01:00
Bo Anderson
9ae847dcae
formula_installer: always output errors with fixing linkage 2025-04-24 17:20:35 +01:00
Mike McQuaid
d899f00c4b
Link to Support Tiers in diagnostic/error messages
Now that we have this nice URL let's reference it to allow our other
messages to be a bit shorter/kinder.
2025-04-01 11:35:27 +01:00
Douglas Eichelberger
fcf18912fe
Inline use of attr_predicate 2025-03-02 21:36:03 -08:00
Mike McQuaid
7a5d4256e5
Fix Rubocop warnings (without brew style --fix) 2025-02-28 09:59:32 +00:00
Douglas Eichelberger
a81239ec2d
Enable strict typing in Formula 2025-02-24 10:23:42 -08:00
Mike McQuaid
b49625a7dc
Add brew install --skip-link
We already have `--skip-post-install` and this adds similar behaviour
for e.g. `brew bundle` (and other users) to be able to install a
formula but skip the `brew link` stage afterwards.
2025-01-23 14:42:03 +00:00
Mike McQuaid
e6b8ed8940
formula_installer: improve quiet output.
Quieten a few warnings, messages and caveats if we're passing `--quiet`
to `brew install`.

This also quiets an incorrect "Fetching" message that was being shown
when installing from a local bottle.
2025-01-23 14:06:39 +00:00
Issy Long
4c9de7d31c
Merge pull request #19084 from Homebrew/add-comments-to-rubocop-disables
Add clarifying comments to `rubocop:disable`s
2025-01-13 11:32:31 +00:00
Mike McQuaid
0940fb78dc
Fix usage of Tab#installed_(on_request|as_dependency)
These can return `true`, `false` or `nil` so adjust the signature to
note this and fix the call sites to ensure we don't accidentally pass
through `nil` values when we shouldn't.

While we're here, make a `TODO` to fix this bad API up in future.

Fixes https://github.com/Homebrew/brew/issues/19076
2025-01-13 09:24:42 +00: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
Patrick Linnane
ba8d449073
formula_installer: allow installing/upgrading disabled formulae
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-11-25 08:57:31 -08:00
Eric Knibbe
86ada937cb
formula_installer: re-enable mirror usage when installing via API 2024-11-21 16:55:19 -05:00
Mike McQuaid
4d4531c19d
Revamp installed_on_request handling
- `reinstall` and `upgrade` no longer mark as installed on request,
  with or without names specified, but preserve the version from the
  tab instead
- default `install_on_request` to `false` rather than `true`
- only set installed in request in a tab if it's missing rather than
  false

Co-authored-by: Michael Cho <michael@michaelcho.dev>
2024-11-19 08:39:55 +00:00
Muneeb Ahmed
d33c5b31bf filter pinned test dependencies 2024-10-21 02:41:07 -07:00
Mike McQuaid
dd7d91bc6f
Improve/fix HOMEBREW_FORBIDDEN_LICENSES handling
`HOMEBREW_FORBIDDEN_LICENSES` now actually checks for valid SPDX license
identifiers rather than requiring the user to guess.

When an identifier is invalid, it will be ignore and warned about
instead.
2024-10-17 08:34:03 +01:00
Carlo Cabrera
aedbf7ac43
formula_installer: verify attestations at bottle fetch time
See discussion at #18544.
2024-10-14 14:08:54 +08:00
William Woodruff
0613050d59
attestation: specialize error on incompatible gh
Signed-off-by: William Woodruff <william@yossarian.net>
2024-10-10 12:06:09 +01:00
Douglas Eichelberger
2d16333bbc Replace removable constants with overridable methods 2024-10-07 18:33:03 -07:00
Patrick Linnane
c2e2b23c50
brew style --fix
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-10-02 10:03:12 -07:00
Mike McQuaid
94416e82f0
Add new odeprecated, odisabled, remove disabled code.
Prepare the usual deprecation cycle for Homebrew 4.4.0.
2024-09-24 10:15:34 +01:00
Bo Anderson
ca26080ef4
formula_installer: fix manifest error handling 2024-09-19 15:26:14 +01:00
Bo Anderson
a434e516cd
formula_installer: fix fetch call 2024-09-16 15:03:58 +01:00
Douglas Eichelberger
44970f728b clean up fetch_bottle_tab 2024-09-10 10:11:33 -07:00
Douglas Eichelberger
17b6948933 Update Library/Homebrew/formula_installer.rb
Co-authored-by: Markus Reiter <me@reitermark.us>
2024-09-10 10:11:33 -07:00
Douglas Eichelberger
c2b9555d0b convert @etc_var_postinstall to an lvar 2024-09-10 10:11:33 -07:00
Douglas Eichelberger
416ebda538 one line per param 2024-09-10 10:11:33 -07:00
Douglas Eichelberger
ef33b35262 constantify @etc_var_dirs 2024-09-10 10:11:33 -07:00
Douglas Eichelberger
0d44b110f9 fix regressions 2024-09-10 10:11:33 -07:00
Douglas Eichelberger
659dd59234 Resolve runtime errors 2024-09-10 10:11:33 -07:00
Douglas Eichelberger
8a3f82158c Strict type FormulaInstaller 2024-09-10 10:11:33 -07:00
Mike McQuaid
c8e8aa5600
Merge pull request #17756 from reitermarkus/concurrent-downloads
Implement concurrent downloads in `brew fetch`.
2024-09-09 08:41:11 +01:00