203 Commits

Author SHA1 Message Date
Eric Knibbe
3dc9e88542
parser: show related env var in switch description 2025-06-03 13:57:42 -04: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
Aman Verma
9c79c5b632
Change default temp on Linux to /var/tmp.
Previously, the default temporary directory was /tmp on Linux and
/private/tmp on macOS. On many Linux distros, including at least Fedora,
/tmp is stored in RAM. This diverges from the behavior on macOS and has
led to bugs, most notably the inability to install large bottles on
memory-limited machines.
2025-04-25 17:56:34 +01:00
Mike McQuaid
c9a7b62b1d
Homebrew 4.5 deprecations/disables/removals
The usual cycle of deprecating, disabling, and removing things in
Homebrew major/minor releases.
2025-04-22 17:15:23 +01:00
Mike McQuaid
9560c01453
Enable Bootsnap by default
- do some optimisation of `require`s before Bootsnap
- remove `HOMEBREW_BOOTSTRAP` environment variable as it's set by
  default
- add fast require in `bootsnap.rb` using logic from `ruby.sh`
- cleanup `bootsnap.rb` a bit
- remove setting `HOMEBREW_BOOTSNAP` in GitHub Actions
2025-03-31 17:55:07 +01:00
Mike McQuaid
61bb2f6225
cmd/*env-sync: add HOMEBREW_ENV_SYNC_STRICT mode.
If this variable is set, `brew *env-sync` will only sync the exact
installed versions of formulae rather than all the patch (or, for node,
minor and patch) versions.
2025-03-24 15:00:16 +00:00
thibhero
d7723fa6ed resolving conversations from pull request 2025-03-07 11:32:34 -05:00
thibhero
f0f2e59fb7 Merge branch 'master' into ask-test
# Conflicts:
#	Library/Homebrew/vendor/bundle/bundler/setup.rb
2025-03-06 00:12:32 -05:00
Mike McQuaid
b1559f38a0
Add HOMEBREW_UPGRADE_GREEDY_CASKS
A space-separated list of casks. Homebrew will act as if `--greedy`
was passed when upgrading any cask on this list.
2025-02-25 15:34:49 +00:00
thibhero
403887deb6 moving back to --ask option 2025-02-07 15:23:36 -05:00
thibhero
bebbd6274e corrected version for brew style 2025-02-07 15:10:27 -05:00
thibhero
f3c2d27cd0 Updating env and option, now using --install-ask 2025-02-07 13:57:51 -05:00
Thibaut Hérault
c575566928
Merge branch 'master' into install-size 2025-02-06 13:22:26 -05:00
thibhero
0cc688f843 resolving typecheck and final tests 2025-02-06 12:37:19 -05:00
thibhero
2c4d404cdb Reordering by alphabetic order 2025-02-06 09:26:52 -05:00
thibhero
c8a9cfa4d0 Add support for the HOMEBREW_ASK environment variable 2025-02-06 09:07:55 -05:00
Eric Knibbe
99de228fc2
docs: various manpage grammar fixes 2025-02-05 13:38:39 +01:00
Mike McQuaid
7ff99e2353
Use ~ instead of ${HOME}
Partial revert of Homebrew/brew#19153
See https://github.com/Homebrew/brew/pull/19153#discussion_r1930678587
2025-01-27 15:19:59 +00:00
Mike McQuaid
bbf5a9f479
env_config: use environment variables consistently
- use e.g. `$HOMEBREW_*` for cases where only the environment variable
  is the entire backtick-quoted string
- use e.g. `${HOMEBREW_*}` for cases where the environment variable is
  part of a backtick-quoted string to make clear what parts are variable
  and what parts are not
- use `export HOMEBREW_*=...` for cases where we're talking about
  setting the environment variable (because it likely needs to be
  exported to work how they want)

Inspired by https://github.com/Homebrew/homebrew-bundle/pull/1579 making
similar changes for Homebrew/homebrew-bundle.
2025-01-27 14:21:27 +00:00
Mike McQuaid
bb74d26a93
Fix HOMEBREW_*BREW_WRAPPER behaviour
- handle reading from variables that may not be defined yet
- avoid unnecessary handling of defined variables
- fix incorrect `env_config.rbi` file entry
- add `HOMEBREW_NO_FORCE_BREW_WRAPPER` to disable
  `HOMEBREW_FORCE_BREW_WRAPPER` functionality if needed
2025-01-08 14:10:55 +00:00
Mike McQuaid
e9b4979f40
Add support for Homebrew wrappers
Allow the ability for a system administrator to use
`HOMEBREW_BREW_WRAPPER` and `HOMEBREW_FORCE_BREW_WRAPPER` variables to
enforce the usage of a particular `brew` command for non-trivial (e.g.
`brew --prefix` is considered trivial, it doesn't need to write to the
prefix) Homebrew commands.

This also introduces a `HOMEBREW_ORIGINAL_BREW_FILE` variable for some
internal usage; `HOMEBREW_BREW_FILE` was being used internally for
both "how should we shell out to Homebrew" and "what should we use
to check permissions on Homebrew". `HOMEBREW_ORIGINAL_BREW_FILE` is
now used just for the latter case.

Inspired by conversation in
https://github.com/Homebrew/homebrew-bundle/pull/1551 which suggested
this was worth fixing in wider than just `brew bundle`.
2025-01-07 17:40:18 +00:00
Mike McQuaid
d87d336c82
Add HOMEBREW_FORCE_API_AUTO_UPDATE
If set, this will update the Homebrew API formula or cask data even if
`HOMEBREW_NO_AUTO_UPDATE` is set.

This is useful in cases where you want to update the cached API data but
don't want to update Homebrew itself.

Co-authored-by: Bo Anderson <mail@boanderson.me>
2025-01-07 16:27:44 +00:00
Issy Long
683f85f4b0
Merge pull request #18984 from Homebrew/livecheck-skip-autobumped-formulae
dev-cmd/livecheck: Skip autobumped formulae
2025-01-04 15:27:16 +00:00
Issy Long
ce562c312b
Alphabetical envvars; better variable names; just the one loop 2025-01-04 14:26:05 +00:00
Issy Long
a71786a332
Flag and envvar to include autobumped formulae
- This is useful for maintainers to check the full range of livecheck functionality.
2025-01-02 17:20:38 +00:00
Issy Long
ae952482a7
env_config: Improve the deprecated envvar message
Before:

```
❯ HOMEBREW_NO_ANALYTICS=0 brew formula-analytics --days-ago=2
Error: Calling HOMEBREW_NO_ANALYTICS=0 is deprecated! Use If you wish to enable HOMEBREW_NO_ANALYTICS, use HOMEBREW_NO_ANALYTICS=1
If you wish to disable HOMEBREW_NO_ANALYTICS, use HOMEBREW_NO_ANALYTICS= (an empty value). instead.
```

After:

```
❯ HOMEBREW_NO_ANALYTICS=0 brew formula-analytics --days-ago=2
Error: Calling HOMEBREW_NO_ANALYTICS=0 is deprecated! Use HOMEBREW_NO_ANALYTICS=1 to enable and HOMEBREW_NO_ANALYTICS= (an empty value) to disable instead.
```
2024-12-28 22:34:40 +00:00
Carlo Cabrera
1fbe4366a0
Support setting GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL
Our autobump workflow sets the author and committer to the user who
triggered the workflow, defaulting to @BrewTestBot for scheduled runs.

This can be confusing for maintainers when GitHub shows up as
"Unverified" because the commit is signed with @BrewTestBot's key.[^1]

Let's fix that by configuring our autobump workflow to always commit as
@BrewTestBot, so that the committer matches the GPG signature. To do
that, we need to add support for setting `GIT_COMMITTER_NAME` and
`GIT_COMMITTER_EMAIL`.

[^1]: See, for example, Homebrew/homebrew-core#197234.
2024-11-11 18:45:38 +08: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
78065c5781
env_config: deprecate setting boolean vars to falsy values
The way we handle boolean environment variables is a bit unfortunate.
For example, setting `HOMEBREW_EVAL_ALL=false` actually enables
`HOMEBREW_EVAL_ALL`.

Let's fix this by deprecating setting boolean environment variables to
common false-y values (`false`, `0`, `nil`, `no`, and `off`) so that we
can later ignore these false-y values when reading boolean environment
variables.
2024-09-25 21:15:53 +08:00
Mike McQuaid
e3a1a9dccf
Improve locking UX
My experience recently playing around with our locking behaviour is
that, while mostly seamless and not seen by users, it's leaks
implementation details a bit too heavily.

As a result, the following improvements are in this commit:
- Ensure that, whenever possible, we tell the user the actual command
  that is holding a given lock instead of the lock name (an internal
  implementation detail)
- Make the locking error output a little more consistent and user
  friendly
- Add a `DownloadLock` class to simplify locking downloads
- Add a `HOMEBREW_LOCK_CONTEXT` variable to allow adding additional
  context for logging error messages
- Lock paths and leave deciding how this translates to lock names up
  to the locking code itself
- Lock the Cellar/Caskroom paths explicitly rather than implicitly

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2024-07-30 17:51:02 +01:00
Bo Anderson
10cbf191dc
Add env to disable finding packages from paths 2024-07-25 11:37:44 +01:00
Bo Anderson
d39a3a3030
Merge pull request #17788 from Homebrew/more-sorbet-strict
sorbet: Bump more files to `typed: strict`
2024-07-25 02:23:23 +01:00
Issy Long
6ad0ebd5b4
env_config: Tighten hash types some more
Co-authored-by: Bo Anderson <mail@boanderson.me>
2024-07-24 23:16:58 +01:00
Bo Anderson
93dbb9593d
Add env to disable Debrew 2024-07-24 06:16:18 +01:00
Issy Long
3290b7e616
env_config: Bump to Sorbet typed: strict 2024-07-17 16:02:01 -04:00
Mike McQuaid
b8ff4b3d23
Widen attestation verification rollout
Take 2 of https://github.com/Homebrew/brew/pull/17692 but with:

- provide and document `HOMEBREW_NO_VERIFY_ATTESTATIONS`
- don't try to run unless there's GitHub credentials
- don't try to run unless `gh` is installed
- don't try to run in CI

While we're here:
- split out a `Homebrew::EnvConfig.devcmdrun?` helper method
- add some missing `Homebrew::EnvConfig.github_api_token` presence
  checks
2024-07-14 11:50:57 -04:00
Bo Anderson
2b454328ca
Remove non-Portable Ruby bootsnap support 2024-06-19 16:08:05 +01:00
Mike McQuaid
ba6ec7066b
Revert "Revert "Enable HOMEBREW_AUTOREMOVE by autoremove_default"" 2024-05-26 15:39:45 +01:00
Carlo Cabrera
ffd6c1f5c3
Revert "Enable HOMEBREW_AUTOREMOVE by autoremove_default"
`autoremove` is destructive, and it can be difficult for users to
recover from it occuring when they weren't expecting it.

Fixes #17363
Fixes Homebrew/discussions#5395

This reverts commit 3d114161b3c3f1a95b94e8530f5bc45bb44bbbd9.
This reverts commit efb14a0ec264c4ef408dbbd5330905dd230e979c.
2024-05-25 23:19:42 +08:00
Mike McQuaid
0c1766510a
env_config: add HOMEBREW_BUNDLE_USER_CACHE.
Used to configure `BUNDLE_USER_CACHE`.
2024-05-18 00:08:42 +09:00
Mike McQuaid
9586473f77
brew style --fix 2024-05-17 14:25:54 +09:00
Mike McQuaid
a37864da0f
Add HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK
This fits the use-case I've heard multiple times where people want to
rely exclusively on their artifact provider.

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2024-05-14 21:45:37 +09:00
Mike McQuaid
3d114161b3
Enable HOMEBREW_AUTOREMOVE by autoremove_default
Enabled `HOMEBREW_AUTOREMOVE` by default, and added
`HOMEBREW_NO_AUTOREMOVE` to disable it.

Co-authored-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2024-05-09 13:47:52 +01:00
Carlo Cabrera
071dd93ef2
env_config: add HOMEBREW_ALLOWED_TAPS
This is the inverse of `HOMEBREW_FORBIDDEN_TAPS`.
2024-05-03 14:44:05 +01:00
Mike McQuaid
b5f857b627
Merge pull request #17081 from alebcay/formula-offline-phases
Support for opt-in network isolation in build/test sandboxes
2024-04-23 08:30:10 +01:00
Caleb Xu
c938f89c28
env_config: new variables for allowing/denying network access 2024-04-22 22:36:00 -04:00
Markus Reiter
4b432c7ea4
Explicitly mark non-private APIs. 2024-04-22 21:16:49 +02:00
Mike McQuaid
c683e011b8
Merge pull request #17049 from trail-of-forks/ww/attestation
attestation: add initial attestation helpers, integrate into `brew install`
2024-04-12 15:52:51 +01:00
Issy Long
dd5ea99f58
Alphabetize EnvConfig::ENVS and regenerate docs 2024-04-11 17:58:08 +01:00
William Woodruff
578c2bc9da
rubocop fixes
Signed-off-by: William Woodruff <william@yossarian.net>
2024-04-08 16:21:31 -04:00