154 Commits

Author SHA1 Message Date
William Woodruff
578c2bc9da
rubocop fixes
Signed-off-by: William Woodruff <william@yossarian.net>
2024-04-08 16:21:31 -04:00
William Woodruff
48e39bb51d
attestation: add initial attestation helpers
Adds the basic attestation verification APIs, as well
as a pre-pour check against `HOMEBREW_VERIFY_ATTESTATIONS`
that verifies the attestation (or backfill as necessary)
for bottles from homebrew-core.

Signed-off-by: William Woodruff <william@yossarian.net>
2024-04-08 16:18:15 -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
21d99c5e89
brew.rb: tell more people to not report issues.
- We should tell people to not report issues if they are running in an
  unsupported configuration.
- We should tell people to run `brew update` before reporting issues if
  they have `HOMEBREW_NO_AUTO_UPDATE` set.
- We should tell people to not report issues in more types of
  exceptions.
- Warn people in `HOMEBREW_NO_AUTO_UPDATE` documentation.
- DRY up `brew.rb` exception handling.

Co-authored-by: Colin Dean <colindean@users.noreply.github.com>
2024-04-03 08:16:01 +01:00
Eric Knibbe
e63b1f4da5
docs: monospace suggested values 2024-02-04 15:42:26 +01:00
Patrick Linnane
6c3eaf6832
Manpage: update GitHub rate limit link 2023-11-04 12:48:00 -07:00
Mike McQuaid
eb1355e624
Add HOMEBREW_SUDO_THROUGH_SUDO_USER
This environment variable allows telling Homebrew to use the `SUDO_USER`
variable to `sudo` through that user when Homebrew (Cask) attempts to
run `sudo`.

While we're here, clarify in some messaging that we're running `sudo`
and that that's the password we're asking for; the specific password is
configuration dependent and not the specific password for the user.

Similarly, remove the `Package installers may write to any location`
output; it's kinda spammy and doesn't feel like the right place.
2023-09-29 18:49:44 +01:00
Eric Knibbe
c493b5e680
cmd+dev-cmd: fixes for output formatting 2023-09-11 02:29:57 -04:00
Eric Knibbe
931f762598
docs+rubydoc: various grammar/wording fixes 2023-09-11 02:26:37 -04:00
Mike McQuaid
98c8dd01e4
Merge pull request #15868 from MikeMcQuaid/more_install_from_api_again
brew.sh: don't set `HOMEBREW_NO_INSTALL_FROM_API` automatically.
2023-08-15 14:27:06 +01:00
Mike McQuaid
1481eac57c
brew.sh: don't set HOMEBREW_NO_INSTALL_FROM_API automatically.
My understanding is that now https://github.com/Homebrew/brew/pull/15778
has been merged this should now work fine on both older macOS versions
and non-default prefixes so let's try this again.
2023-08-15 11:42:02 +01:00
Clint Harrison
4ade9351e4
Allow HOMEBREW_CURLRC to provide a path for curl --config
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2023-08-15 11:29:02 +01:00
eugenesvk
2c7c064040 Allow hiding new formula/cask sections on update 2023-08-07 20:38:54 +07:00
Mike McQuaid
375a7ee8dc
Allow configuring Homebrew with .env files
For a long time people have requested some sort of configuration files
for Homebrew. Now: here's the first version of that.

Similarly to how you can configure Git for a system, a repository or
a user: you can configure Homebrew for a system, a prefix or a user.

The system-wide configuration file is `/etc/homebrew/brew.env`, the
prefix-specific configuration file is
`$HOMEBREW_PREFIX/etc/homebrew/brew.env`
and the user-specific configuration file is `~/.homebrew/brew.env`.

As we need to read these files from Bash in `bin/brew` (so they can)
influence functionality ASAP: they are in a simple format that Bash
can read. It may be that we have more complex array or hash data in
future that's configured through JSON or YAML (most likely JSON as we
use it more) and stored in a `brew.json`/`brew.yaml` file in the same
directory.

As this is relying on `eval` in Bash which is fairly dangerous: we
filter the lines with a regex to ensure we're only permitting setting
`HOMEBREW_*` variables and nothing more.

To give a bit of power to system administrators, the
`HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY` variable can be set in
`/etc/homebrew/brew.env` to ensure that the system-wide configuration
file is loaded last and overrides any prefix or user settings.

Now that we have an actual location for configuration files, let's also
change the `brew livecheck` watchlist configuration file to be in this
directory and deprecate the existing location. As this is a developer
command and the mitigation is to just move the file: we don't need to
follow the normal deprecation process here.
2023-07-28 17:17:14 +01:00
Mike McQuaid
21d8f82056
Add/use HOMEBREW_INSTALL_FROM_API_UNSUPPORTED
When we're automatically setting `HOMEBREW_NO_INSTALL_FROM_API`
when on an old macOS version or with a non-default prefix (e.g. cases
where you're going to be mostly building from source).

My initial plan was to set
`HOMEBREW_AUTOMATICALLY_SET_NO_INSTALL_FROM_API` in these cases but
it's used differently enough it made sense to add another internal
variable instead: `HOMEBREW_INSTALL_FROM_API_UNSUPPORTED`.

At the moment this is only used to avoid printing the "You have set
`HOMEBREW_NO_INSTALL_FROM_API`" message inside `brew update` but may
make sense to use in other places over time.

Ideally, we'll get rid of these automatic sets of
`HOMEBREW_NO_INSTALL_FROM_API` and perhaps even the variable entirely.
2023-07-27 12:36:54 +01: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
0ae98a8a09
Enable HOMEBREW_SORBET_RUNTIME (sometimes)
Reverts #15385 with some tweaks.
2023-07-18 13:17:54 +01:00
Branch Vincent
6e6ec1b42a
man: fix a literal newline 2023-06-25 21:30:40 -07:00
Mike McQuaid
75dd070395
Remove Google Analytics
We are now entirely migrated to InfluxDB so can remove all GA code.
2023-06-16 10:33:15 +01:00
Patrick Linnane
7c7ddd82fe
Revert "Merge pull request #15377 from carlocab/sorbet-runtime-take2"
This reverts commit cca98d5637d847548791b5afb16a5c609de2cb58, reversing
changes made to c0f8068573bbf886fdc78d3f9daca54d53e7e49e.
2023-05-08 12:16:11 -07:00
Carlo Cabrera
84cb8a42f7
Revert "Revert "Merge pull request #15369 from carlocab/sorbet-runtime""
We need to exclude any command that might read `lsyncd` on Linux while
simulating macOS. This seems like all of them.

This reverts commit bcf94f6e27d26a6844ee1fa7af73333321015987.
2023-05-08 11:37:48 +08:00
Patrick Linnane
bcf94f6e27
Revert "Merge pull request #15369 from carlocab/sorbet-runtime"
This reverts commit 8c059bba279f4b72b783fca91746d14b6286e6fc, reversing
changes made to f71b3d37abcc9cd12b0c8a621bc3712c00db8ec1.
2023-05-05 09:38:02 -07:00
Carlo Cabrera
f68b635513
Revert "Revert "Enable Sorbet by default for Homebrew developers and developer commands.""
Along with some fixes for failures in Homebrew/core. See discussion at #15368.

This reverts commit e49cd331dba71b1ced341f1838c7651ecff46a38.
2023-05-05 21:40:51 +08:00
Dawid Dziurla
e49cd331db
Revert "Enable Sorbet by default for Homebrew developers and developer commands." 2023-05-05 13:58:58 +02:00
Mike McQuaid
6918fb94ce
Enable Sorbet by default for Homebrew developers and developer commands.
I've been doing this personally for a few months and not hit any bugs.
We already do this for `brew tests`.

It will allow us to:

- remove manual type checks from all developer commands (Sorbet does a
  better job with these)
- better surface bugs
- better surface type signatures
- get closer to being able to enable this by default for everyone
2023-05-05 08:56:53 +01:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Razvan Azamfirei
22eb43ca37
syntax fix 2023-04-05 20:07:58 -04:00
Razvan Azamfirei
acc598fdc9
Update env_config.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-04-05 19:29:57 -04:00
Razvan Azamfirei
87b4f1f396
Update env_config.rb 2023-04-05 19:26:20 -04:00
Razvan Azamfirei
28490626fd
style fixes 2023-04-05 09:44:32 -04:00
Razvan Azamfirei
183fad82a6
add greedy option 2023-04-05 09:28:15 -04:00
Razvan Azamfirei
540a5b9d30
temp 2023-03-31 18:01:34 -04:00
Mike McQuaid
6fd54eba5f
Merge pull request #14985 from dduugg/no-compat
Remove compatibility layer
2023-03-15 13:48:00 -04:00
Markus Reiter
7591175f93
Fix env_config generator. 2023-03-15 14:28:47 +01:00
Douglas Eichelberger
cc5b013cb9 Remove compatibility layer 2023-03-14 14:49:34 -07:00
Markus Reiter
fcca056f4c
Check CUSTOM_IMPLEMENTATIONS for all variables. 2023-03-12 05:24:40 +01:00
Mike McQuaid
26182fd67a
Note that brew update will only report all without API.
It's not worth supporting this option any longer given the API
constraints.
2023-03-03 08:51:58 +00:00
Bo Anderson
e86a8c2477
Move HOMEBREW_NO_INSTALL_FROM_API defaults to shell 2023-02-24 21:53:08 +00:00
Mike McQuaid
381238b545
Merge pull request #14646 from MikeMcQuaid/auto_update_secs
Further adjust `HOMEBREW_AUTO_UPDATE_SECS`
2023-02-15 18:08:27 +00:00
Mike McQuaid
98022b2061
Merge pull request #14644 from MikeMcQuaid/api_auto_update_secs
env_config: reduce api_auto_update_secs.
2023-02-15 17:50:51 +00:00
Mike McQuaid
f39ab585b9
Further adjust HOMEBREW_AUTO_UPDATE_SECS
Add another case to update once an hour when developer commands have
been run.
2023-02-15 17:37:12 +00:00
Mike McQuaid
a5c4ce59ff
env_config: reduce api_auto_update_secs.
We're reducing this in formulae.brew.sh too.
2023-02-15 17:17:51 +00:00
Mike McQuaid
c5252817c2
analytics: refactor InfluxDB/Google handling. 2023-02-15 16:34:50 +00:00
Mike McQuaid
4c8ed77302
Improve homebrew/{core,cask} autotapping.
Don't automatically tap these when running a developer command that's
not using the API.

Fixes #14606
2023-02-14 09:54:24 +00:00
Mike McQuaid
75a20689b1
Add HOMEBREW_API_AUTO_UPDATE_SECS
This sets the default and allows customising how often we try to
download files from the API.

This does not affect `brew update` as we want to always check every time
on an explicit call.
2023-02-11 07:22:50 +00:00
EricFromCanada
dfc9906184
internal messaging fixes 2023-02-10 23:17:16 -05:00
Daniel Bayley
2ff90c3232 Fix HOMEBREW_BAT_CONFIG_PATH hint
`HOMEBREW_BAT_CONFIG_PATH` should respect [`BAT_CONFIG_PATH`](https://github.com/sharkdp/bat#configuration-file), in the same way that `HOMEBREW_BAT_THEME` [reflects](https://github.com/Homebrew/brew/pull/13385/files#diff-a8ebbe0466e56bdb9c7ebc74d5ffbd383b8c0902fcb5146cb1960e3d69dadeb1R78) `BAT_THEME`.

Previous, for context:
https://github.com/Homebrew/brew/pull/7488
https://github.com/Homebrew/brew/pull/11975
https://github.com/Homebrew/brew/pull/13385
2023-02-09 19:24:31 +00:00
Mike McQuaid
2a5d41d41b
Revert "Merge pull request #14547 from Homebrew/revert-14412-homebrew_install_from_api_default"
This reverts commit f4e60482791d2ff628efadfdbf0d14d9237d2d29, reversing
changes made to e26784f424061ca16987afcb21e036c66a298492.
2023-02-07 19:25:40 +01:00
Mike McQuaid
0575903868
Revert "HOMEBREW_INSTALL_FROM_API: make the default for everyone." 2023-02-07 15:13:23 +01:00
Mike McQuaid
5f6c69bca2
HOMEBREW_INSTALL_FROM_API: make the default for everyone.
- remove all places we check the flag so it's a no-op now
- flip the messaging to refer to `HOMEBREW_NO_INSTALL_FROM_API` where
  relevant
- adjust the documentation
2023-02-05 18:13:08 +01:00