5232 Commits

Author SHA1 Message Date
Patrick Linnane
4b749546aa
cmd/tap: add missing require
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-07-14 23:20:50 -04:00
Ruoyu Zhong
e806870f85
cmd/update-reset.rb: the named args are repos not taps 2024-07-14 23:12:53 -04:00
Mike McQuaid
5987c5c1d0
Add stub Ruby commands for all Bash commands.
This gets us pretty similar (but easier to manage) manpage output but
much nicer completions etc. for all these commands.
2024-07-14 23:12:53 -04:00
Mike McQuaid
fd62a158f2
Merge pull request #17728 from Homebrew/sponsors-maintainers-man-completions 2024-07-14 15:00:20 -04:00
Mike McQuaid
8ae18f463e
cmd/--repository.rb: tweak error message. 2024-07-14 14:46:59 -04:00
Ruoyu Zhong
3bc01a4d31
Fix completion generation for --repository 2024-07-14 14:46:59 -04:00
Rylan Polster
5030ad6f28
Require utils/backtrace when install fails 2024-07-14 14:37:30 -04:00
Mike McQuaid
4d1e601ecb
Merge pull request #17721 from Homebrew/deprecated_packages_disable_date 2024-07-14 14:15:05 -04:00
Ruoyu Zhong
64838db963
cmd/--repository: improve tap name error checking
Before:

    $ brew --repo core
    /usr/local/Homebrew/Library/Taps/core/homebrew-core

After:

    $ brew --repo core
    Error: Invalid tap name: core
2024-07-14 13:17:26 -04:00
Mike McQuaid
2d26c89e81
Merge pull request #17726 from Homebrew/brew-repository-speedup 2024-07-14 12:57:52 -04:00
Ruoyu Zhong
96cf5513c8
Port brew --repository to Bash
This provides a significant speedup:

    $ hyperfine 'git checkout master; brew --repo homebrew/core' 'git checkout brew-repository-speedup; brew --repo homebrew/core'
    Benchmark 1: git checkout master; brew --repo homebrew/core
      Time (mean ± σ):      1.737 s ±  0.388 s    [User: 0.743 s, System: 0.323 s]
      Range (min … max):    1.336 s …  2.438 s    10 runs

    Benchmark 2: git checkout brew-repository-speedup; brew --repo homebrew/core
      Time (mean ± σ):     459.1 ms ±  91.9 ms    [User: 100.5 ms, System: 142.1 ms]
      Range (min … max):   366.5 ms … 594.0 ms    10 runs

    Summary
      git checkout brew-repository-speedup; brew --repo homebrew/core ran
        3.78 ± 1.13 times faster than git checkout master; brew --repo homebrew/core
2024-07-14 12:07:11 -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
Mike McQuaid
15f162c6ab
Output disable date for deprecated packages
Let's use the disable date, if provided, and use 1 year after the
deprecation date otherwise, to display a better message for the
various outputs of deprecated package messages.

Also, provide an internal API for this that can be used by
Homebrew/actions.
2024-07-14 11:49:44 -04:00
Mike McQuaid
c5dbd3ca24
Rearrange requires
This improves the load time of most brew commands. For an example of
one of the simplest commands this speeds up:

Without Bootsnap:
```
$ hyperfine 'git checkout master; brew help' 'git checkout optimise_requires; brew help'
Benchmark 1: git checkout master; brew help
  Time (mean ± σ):     525.0 ms ±  35.8 ms    [User: 229.9 ms, System: 113.1 ms]
  Range (min … max):   465.3 ms … 576.6 ms    10 runs

Benchmark 2: git checkout optimise_requires; brew help
  Time (mean ± σ):     383.3 ms ±  25.1 ms    [User: 133.0 ms, System: 72.1 ms]
  Range (min … max):   353.0 ms … 443.6 ms    10 runs

Summary
  git checkout optimise_requires; brew help ran
    1.37 ± 0.13 times faster than git checkout master; brew help
```

With Bootsnap:
```
$ hyperfine 'git checkout master; brew help' 'git checkout optimise_requires; brew help'
Benchmark 1: git checkout master; brew help
  Time (mean ± σ):     386.0 ms ±  30.9 ms    [User: 130.2 ms, System: 93.8 ms]
  Range (min … max):   359.5 ms … 469.3 ms    10 runs

Benchmark 2: git checkout optimise_requires; brew help
  Time (mean ± σ):     330.2 ms ±  32.4 ms    [User: 93.4 ms, System: 73.0 ms]
  Range (min … max):   302.9 ms … 413.9 ms    10 runs

Summary
  git checkout optimise_requires; brew help ran
    1.17 ± 0.15 times faster than git checkout master; brew help
```
2024-07-14 08:49:39 -04:00
Mike McQuaid
6abdbd1fe0
vendor-install: cleanup bootsnap. 2024-07-13 11:57:37 -04:00
Mike McQuaid
f39b5c1426
Merge pull request #17554 from Homebrew/cask-install-receipt 2024-07-13 10:55:06 -04:00
Mike McQuaid
2aa86d8fd5
Merge pull request #17674 from Homebrew/shellenv_eu 2024-07-11 12:13:00 +01:00
Mike McQuaid
d187f2d6cc
cmd/shellenv.sh: handle undefined MANPATH and set -eu.
See https://github.com/Homebrew/brew/pull/17633#issuecomment-2218657931
2024-07-11 08:17:11 +01:00
Andrew Braxton
0e0e3a4d0a Use env argument to switch() 2024-07-10 23:41:18 -07:00
Andrew Braxton
23dd14d1c4 greedy outdated 2024-07-09 20:59:12 -07:00
Mike McQuaid
07b6b71340
Merge pull request #17633 from gromgit/shellenv/fix_manpath 2024-07-08 08:42:47 +01:00
Adrian Ho
4ff36552f6 shellenv: prepend colon to MANPATH if set
The current appended colon means system man pages always shadow
Homebrew's. There's also no point adding Homebrew's man dir, nor
filling out an empty MANPATH, since `man` and friends will add the
necessary dirs according to PATH.

Closes https://github.com/Homebrew/homebrew-core/issues/176037.

Also fixed a syntax error in the `*csh` INFOPATH setting.
2024-07-06 01:46:22 +08:00
Mike McQuaid
8c4c7319fc
Merge pull request #17634 from Homebrew/unknown_brew_command 2024-07-05 10:08:33 +01:00
Mike McQuaid
45b66870bb
Improve "unknown command" error
Clarify it is a `brew` command.

Fixes #17627
2024-07-05 08:20:28 +01:00
Rylan Polster
6ecdad7379
Fix brew info --github 2024-07-04 12:07:53 -04:00
Rylan Polster
673b171b10
Update commands to use cask install receipts 2024-07-04 01:47:13 -04:00
Ryan Rotter
99486c8107 Use API for description searches
Both `brew search --desc` and `brew desc --search` use API for cask and
formula searches unless `--eval-all` or `HOMEBREW_EVAL_ALL` set.
Description searches do not use the description cache or eval any
formulas/casks.

- With `--eval-all`, description search reverts to the old behavior.
- Warn if description search exludes any formulae/casks (because
  `--eval-all` not set).
- Enforce `--eval-all` requirement if NO_INSTALL_FROM_API set.
2024-06-30 23:05:29 -04:00
Mike McQuaid
1124ab315c
cmd/vendor-install: add extra read check.
Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2024-06-25 08:53:46 +01:00
Caleb Xu
c214952e2b
cmd/vendor-install: extract portable-ruby download info 2024-06-24 13:15:54 -04:00
Mike McQuaid
b38e14bce7
Further Portable Ruby cleanup
- Use the `HOMEBREW_PORTABLE_RUBY_VERSION` environment variable to
  determine the version of the Portable Ruby to use in
  `vendor-install.sh` and `ruby.sh`.
- Replace the `docs/.ruby-version` file with a symlink to
 `Library/Homebrew/.ruby-version`.
- Fix an incorrect `HOMEBREW_LIBRARY` comment.
- Use a simpler `HOMEBREW_USING_PORTABLE_RUBY` definition.
2024-06-14 12:22:02 +01:00
Mike McQuaid
4bfdbe20b9
vendor-install: fix incorrect portable Ruby version reference. 2024-06-14 12:05:01 +01:00
Bo Anderson
24f74c0528
Merge pull request #17501 from Homebrew/portable-ruby-3.3.3
Portable Ruby 3.3.3
2024-06-14 04:34:01 +01:00
Bo Anderson
fa91edadfd
Portable Ruby 3.3.3 2024-06-14 03:32:38 +01:00
Bo Anderson
fa2731d0c7
cmd/setup-ruby: fix Portable Ruby install failing 2024-06-14 02:26:16 +01:00
Ruoyu Zhong
9cd5078efb
cmd/tab: new command
Add `brew tab`, a new command to edit tab information, as previously
discussed in https://github.com/Homebrew/brew/pull/17125#issuecomment-2068473483.
Currently, this supports marking or unmarking formulae as installed on
request.

Sample usage:

    $ brew tab --installed-on-request curl
    ==> curl is now marked as installed on request.
    $ brew autoremove --dry-run
    [no output]
    $ brew tab --no-installed-on-request curl
    ==> curl is now marked as not installed on request.
    $ brew autoremove --dry-run
    ==> Would autoremove 2 unneeded formulae:
    curl
    rtmpdump

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-06-13 11:44:14 +08:00
Bo Anderson
617a8d1627
cmd/list: fix exit code when supplied both a cask and formula 2024-06-11 03:31:05 +01:00
Bo Anderson
4d12dafeb7
Revert "cmd/list: fix exit codes."
This reverts commit cec4e3fcb7ec15efa30d3d76dd910ff98dc5e890.
2024-06-11 03:20:09 +01:00
Mike McQuaid
c13700af00
Use repository consistently instead of repo
The documentation linting job doesn't like `repo` so let's fix this
globally rather than naming it differently in documentation and code.
2024-06-10 09:31:53 +01:00
Mike McQuaid
cec4e3fcb7
cmd/list: fix exit codes.
Fix exit codes when providing formulae and casks.

Fixes #17434
2024-06-06 19:34:17 +01:00
Mike McQuaid
2c1bf79c67
cmd/vendor-install: handle broken shasum.
If `shasum` is broken and doesn't produce a valid checksum: we were
just doing the checksum comparison with an empty checksum.

Instead, let's treat an empty checksum as a failure condition, rather
than just the executable bit being present for the relevant binary, and
iterate through the available tools to try and get a non-empty checksum.

If they all produce an empty checksum: provide a different error to make
it a bit more obvious what's happening here.
2024-06-04 13:49:32 +01:00
Mike McQuaid
753add2cc7
cmd/setup-ruby: handle empty command path.
If this is empty: don't try to `grep` it.
2024-06-03 13:35:37 +01:00
Garrit Franke
a4e10d9e1c
GH-17413: Add --scrub flag alias to cleanup command 2024-06-03 10:49:23 +02:00
Issy Long
509fffab2b
Make more files Sorbet typed: strict
- According to Spoom, these could be bumped automatically with no errors.
2024-06-02 15:15:24 +01:00
Mike McQuaid
b70b501b17
Portable Ruby 3.3.2
Update to the latest Ruby.
2024-05-31 15:38:04 +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
bde9afa70e
Portable Ruby 3.3.1
Use the latest version of Portable Ruby.
2024-05-17 00:23:36 +01: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
50384591c7
extend/kernel: add sigs to opoo/onoe/ofail
Add these and correctly pass through a string to
`GitHub::Actions.puts_annotation_if_env_set`.

Also, fix some call sites to not rely on the `void` return.
2024-05-10 14:12:19 +01:00
apainintheneck
efb14a0ec2 fix no autoremove suggestion typo
This suggests setting an environment variable that is different
than the one we end up checking so I've updated the warning so
now things match. If the goal was to have the name in the warning,
the environment variable checking logic could be updated. I have
no personal preference.

```console
$ brew irb
==> Interactive Homebrew Shell
Example commands available with: `brew irb --examples`
brew(main):001:0> ENV["HOMEBREW_NO_AUTO_REMOVE"] = "1"
=> "1"
brew(main):002:0> Homebrew::EnvConfig.no_autoremove?
=> false
brew(main):003:0> ENV["HOMEBREW_NO_AUTOREMOVE"] = "1"
=> "1"
brew(main):004:0> Homebrew::EnvConfig.no_autoremove?
=> true
```
2024-05-09 20:14:16 -07:00