5401 Commits

Author SHA1 Message Date
Nanda H Krishna
8839ccfe72
Fix tests for attestations 2024-07-17 14:48:53 -04:00
Nanda H Krishna
81e606007f
Fix type errors 2024-07-17 14:48:52 -04:00
Nanda H Krishna
d2d814414e
cmd/{install,reinstall,upgrade}: ensure that gh is installed 2024-07-17 14:48:52 -04:00
Nanda H Krishna
51ec743d6f
Remove ensure_gh_installed!
Co-authored-by: William Woodruff <william@yossarian.net>
2024-07-17 14:48:52 -04:00
Nanda H Krishna
4d387d285e
Fix type and style errors 2024-07-17 14:46:59 -04:00
Nanda H Krishna
3bb91601fb
Ensure early installation of gh for attestations 2024-07-17 14:46:58 -04:00
Rylan Polster
9538f424b5
Merge pull request #17762 from samford/formula-require-utils-backtrace 2024-07-16 12:41:19 -04:00
Sam Ford
11d6785bea
Add utils/backtrace requires
This is primarily intended to resolve the `uninitialized constant
Utils::Backtrace` error in `formula_versions.rb:60` but I expanded it
to try to cover all existing usage of `Utils::Backtrace`.

I've followed the existing pattern, where `utils/backtrace` is
required in the context of where it's used. Many of these cases use
`Backtrace` in a conditional manner, so I've tried to ensure that the
`require` follows suit.
2024-07-15 17:48:47 -04:00
Ruoyu Zhong
0e111e39a9
cmd/vendor-install: use ShellCommand 2024-07-15 14:48:37 -04:00
Ruoyu Zhong
1b62371455
cmd/update: use ShellCommand 2024-07-15 14:48:37 -04:00
Ruoyu Zhong
fdeb61094c
cmd/update-reset: use ShellCommand 2024-07-15 14:48:36 -04:00
Ruoyu Zhong
02aaf67d55
cmd/shellenv: use ShellCommand 2024-07-15 14:48:36 -04:00
Ruoyu Zhong
f7e3873ecd
cmd/setup-ruby: use ShellCommand 2024-07-15 14:48:36 -04:00
Ruoyu Zhong
e0db9061d1
cmd/formulae: use ShellCommand 2024-07-15 14:48:36 -04:00
Ruoyu Zhong
2ef745445b
cmd/casks: use ShellCommand 2024-07-15 14:48:36 -04:00
Ruoyu Zhong
06610bf807
cmd/--version: use ShellCommand 2024-07-15 14:48:36 -04:00
Ruoyu Zhong
23db47dba5
cmd/--repository: use ShellCommand 2024-07-15 14:48:36 -04:00
Eric Sampson
d40ab11784 Add "-quiet" support to cask updgrade 2024-07-15 11:50:37 -05:00
Mike McQuaid
835c2f2e2b
Merge pull request #17742 from Homebrew/ruby_bash_commands_integrations 2024-07-15 16:10:31 +02:00
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