167 Commits

Author SHA1 Message Date
Eric Knibbe
29122c0008
cask/installer: remove migration symlinks on uninstall 2025-06-26 10:37:52 -04:00
Patrick Linnane
7da83ee19c
cask/installer: remove confusing zap messaging
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2025-06-17 21:15:47 -07:00
Mike McQuaid
35407ab556
cask: move some files to strict Sorbet sigil. 2025-06-17 14:56:10 +01:00
Rylan Polster
e5495d097e
Add missing require 2025-06-11 19:56:37 -04:00
Mike McQuaid
cc03340af3
Reduce Homebrew/brew CI warnings
- Remove a bunch of non-actionable/unnecessary noise in GitHub Actions
  CI.
- Limit number of threads used to generate analytics API data to avoid
  reproducible failures producing errors and requiring retries.
- Move to Debian Old Stable for testing non-system `glibc`.
- Remove unneeded core taps/updates.
- Improve naming of CI jobs to clarify purpose i.e. we're testing
  things work on Linux, not Ubuntu specifically.
- Remove dedicated non-online/non-generic Linux `brew tests` jobs from
  3 to 1.

Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2025-06-09 12:47:22 +01:00
Bo Anderson
923be69785
Phase out using cgi library 2025-05-13 01:33:14 +01:00
Mike McQuaid
eae31bacdc
cask/installer: output the correct environment variable.
We previously would output `HOMEBREW_FORBIDDEN_CASKS` for both when it
was used and when `HOMEBREW_FORBID_CASKS` was set.
2025-05-02 14:38:26 +01:00
Mike McQuaid
30d9ea24c5
Add HOMEBREW_FORBID_CASKS to allow forbidding all casks.
`HOMEBREW_FORBIDDEN_CASKS` allows forbidding specific casks but, in some
cases, you may wish to forbid all casks from installation.
2025-05-01 09:48:53 +01:00
Douglas Eichelberger
e49a69679d
Enable strict typing in TopologicalHash 2025-03-12 19:09:52 -07:00
Eric Knibbe
c5ec1fa61b
cask/installer: pass more options to cask dependencies 2025-03-06 14:10:37 -05:00
Douglas Eichelberger
fcf18912fe
Inline use of attr_predicate 2025-03-02 21:36:03 -08:00
Sean Molenaar
c34b71655c feat: allow font install on linux
Apply suggestions from code review

Co-authored-by: Douglas Eichelberger <697964+dduugg@users.noreply.github.com>

feat: add linux appdir

Apply suggestions from code review

Co-authored-by: Douglas Eichelberger <697964+dduugg@users.noreply.github.com>
2025-01-19 11:14:24 +01:00
Mike McQuaid
d490692b26
cask: fewer GitHub Actions warnings.
- don't care about no checksums being defined for official casks
- don't complain about Gatekeeper being disabled on GitHub Actions as
  it's been globally disabled for the team
2024-12-30 12:55:30 +00:00
Michael Cho
21f35368eb
deprecate_disable: typed: strict 2024-12-20 13:33:16 -05:00
Sean Molenaar
cb23433612
feat: only block cask install on Linux 2024-12-14 15:49:09 +01:00
Bo Anderson
97866f8adf
Perform preinstall checks when a formula is installed via a cask 2024-10-11 16:57:47 +01:00
Patrick Linnane
c2e2b23c50
brew style --fix
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-10-02 10:03:12 -07:00
Case Taintor
31c560e578 Improve cask --adopt to only care about the installed version if auto_update is false 2024-09-26 11:59:40 +02: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
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Mike McQuaid
7abc6f4349
cask/installer: improve *_FORBIDDEN_* env handling.
- Improve the error message when a cask or formula is forbidden by an
  environment variable (fixes #17880)
- Move the `forbidden_tap_check` and `forbidden_cask_and_formula_check`
  methods to the top of the `install` method, so that they are checked
  before the main cask is downloaded.
2024-07-27 16:13:51 +01:00
Rylan Polster
119e02ceb0
Cleanup tap_git_head and uninstall_flight_blocks?
Co-authored-by: Kevin <apainintheneck@gmail.com>
2024-07-09 13:22:00 -04:00
Rylan Polster
acd60181c2
Add cask install receipts 2024-07-04 01:47:13 -04:00
Mike McQuaid
16901a674f
extend/kernel: make opoo/odie/etc. print GitHub Actions notes.
We already do this for deprecations but these may make warnings
and errors from Homebrew easier to spot in GitHub Actions logs.

While we're here, cleanup other cases that should have used
`GitHub::Actions::Annotation` but didn't and provide some helpers and
tweaks there necessary for our use case here.
2024-05-09 14:43:53 +01:00
Carlo Cabrera
34387bfc8a
cask/installer: update to match formula_installer 2024-05-05 14:00:02 +01:00
Carlo Cabrera
5222c9e32d
Improve error message for allowed and forbidden taps 2024-05-03 16:15:37 +01:00
Carlo Cabrera
34e2c4ee97
cask/installer: support HOMEBREW_ALLOWED_TAPS 2024-05-03 14:50:49 +01:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Todd Schulman
827f475851 fix: dependencies message; empty formulae return
- All dependencies satisfied message applies to both formulae and casks.
- Trigger the empty formulae return condition only if formulae are present.
2024-04-09 01:50:29 -04:00
Mike McQuaid
1474806527
Add more HOMEBREW_FORBIDDEN_* configuration
We already had `HOMEBREW_FORBIDDEN_LICENSES` but this commit adds
`HOMEBREW_FORBIDDEN_CASKS`, `HOMEBREW_FORBIDDEN_FORMULAE` and
`HOMEBREW_FORBIDDEN_TAPS` for also forbidding those.

Relatedly, add `HOMEBREW_FORBIDDEN_OWNER` and
`HOMEBREW_FORBIDDEN_OWNER_CONTACT` to allow customising these
messages.

There were no existing tests for `HOMEBREW_FORBIDDEN_LICENSES` so have
added more tests for all of these checks.

Co-authored-by: Bo Anderson <mail@boanderson.me>
2024-04-08 16:38:32 +01:00
Mike McQuaid
f086138043
Fix GitHub Actions annotation format.
Co-authored-by: Bo Anderson <mail@boanderson.me>
2024-03-14 14:09:11 +00:00
Mike McQuaid
dcaa69a2dc
Add GitHub Actions warning/error annotations for deprecations/disables.
This should make these messages, particular warnings, more obvious to
GitHub Actions users.

There's an argument perhaps we should do this more broadly for all
warning/error messages but: this feels like a good start.
2024-03-14 09:49:12 +00:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Mike McQuaid
9259c345cc
utils/analytics: general cleanup.
We have plans to add analytics for commands and `brew test-bot`

This requires a certain amount of refactoring which I've done here.

There was also a bunch of legacy `*_influx_?` usage from when we used
both InfluxDB and Google Analytics that made sense to clean up and
excessive indirection.
2024-03-07 15:19:04 +00:00
Markus Reiter
3da0f8c4a6
Fix loading casks/formulae from relative paths. 2024-03-01 04:05:15 +01:00
Bo Anderson
1d7101d8a3
Use HOMEBREW_TEMP more universally 2024-02-26 16:58:53 +00:00
Bevan Kay
bd6ab1d2b8
cask/uninstall: skip quit and signal directives when upgrading or reinstalling 2024-01-19 23:30:25 +11:00
Douglas Eichelberger
ffd761d2e9 Create dedicated Attrable mixin for attr_ methods 2023-12-28 11:46:27 -08:00
Rylan Polster
6431822e7b
Apply feedback 2023-12-16 20:18:35 -05:00
Rylan Polster
641a80475e
Update cask logic to handle deprecations and disables 2023-12-16 20:01:47 -05:00
Douglas Eichelberger
00ba09d73d Remove use of ActiveSupport try 2023-11-05 09:28:19 -08:00
Mike McQuaid
daa175e760
cask/installer: remove outdated comment. 2023-09-03 09:09:14 -04:00
apainintheneck
51387287f7 Handle nil urls in cask installer and API cask loader
The goal here is to handle the case where a cask might have a nil
url stanza because that cask is not available on the current version
of macOS or the given architecture. This just moves those checks
from the end of the `Cask::Installer#fetch` method to the beginning
so that we don't try and download casks that are missing urls.

This will now provide a helpful error message like so:
```
Error: This software does not run on macOS versions older than Big Sur.
```

Beyond that it no longer tries to run the url stanza with a nil value
when loading casks from the API.
2023-09-02 20:56:36 -07:00
apainintheneck
c9dea04bd4 cmd/install: upgrade already installed casks
Previously, the behavior was to warn users that a cask was already
installed and then skip modifying the installed version. This is
different to how we handled things with formulas. For them we would
upgrade any already installed formulas. This just brings casks in line
with what we already do with formulas.

Changes:
- cmd/install: Upgrade already installed casks if HOMEBREW_NO_INSTALL_UPGRADE
  is not set
- env_config: Update wording of HOMEBREW_NO_INSTALL_UPGRADE to include casks
- remove error that was only used to alert about already installed casks

Note:
- The upgrade command for casks defaults to --greedy when you pass named casks
  to the command which means that this will always default to that behavior
  since you must specify the name of the cask when installing.
2023-07-23 18:50:39 -07:00
Mike McQuaid
3dabf504bd
Merge pull request #15176 from reitermarkus/cask-renames
Implement cask renames.
2023-05-14 19:46:56 +01:00
JBYoshi
ad8ce82673
Fix typing on revert_upgrade().
Also adds several type signature checks to test for these errors.
2023-05-12 14:53:27 -05:00
Markus Reiter
a3231a03fa
Implement cask renames. 2023-05-12 21:17:30 +02:00
Mike McQuaid
0e387fee8c
Merge pull request #15138 from JBYoshi/cask-move-contents
Don't remove cask directories when upgrading.
2023-05-04 11:43:44 +01:00
JBYoshi
3e249a9428
Improve styling. 2023-05-03 11:29:01 -05:00
Bo Anderson
44f058edb5
Refactor formula, cask and Ruby source downloads to use shared code 2023-04-27 23:23:07 +01:00