5399 Commits

Author SHA1 Message Date
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
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
Darren Kavanagh
85cd2f075e
cmd/update.sh: check initial branch is not master
Check that the initial branch is not 'master' before doing a forced update on 'master'. Git will fail with fatal error otherwise.
2024-05-08 14:44:59 -07:00
Mike McQuaid
222fe8ef0b
Homebrew 4.3.0 deprecation/disable/removals.
The usual pass of deprecating/disabling/removing code for the next
minor Homebrew release.
2024-05-07 12:18:04 +01:00
Mike McQuaid
b5b37d8c80
Merge pull request #17204 from Homebrew/ruby_scripts_to_utils_files
Library/Homebrew: move stdin ruby scripts to files under `utils`.
2024-05-02 10:44:00 +01:00
Mike McQuaid
bc0f5ee62a
Library/Homebrew: move stdin ruby scripts to files under utils.
This avoids can avoid UID/EUID related issues with Ruby scripts passed
over `stdin` clashing with Ruby security features.

It's also just a bit nicer to have Ruby scripts in files instead.

While we're here:
- refactor some shared logic into a new `setup-gem-home-bundle-gemfile`
  function in `ruby.sh`
- do some general cleanup of `lock.sh`
- prioritise `flock` over `python` in `lock.sh`
2024-05-02 10:33:42 +01:00
Ruoyu Zhong
0b668797ec
cmd/leaves: fix an undefined method error
Follow-up to #17168.

Fixes #17199.
2024-05-02 01:07:29 +08:00
Markus Reiter
480e264d9a
Lint Ruby docs. 2024-05-01 11:35:21 +02:00
Markus Reiter
caf87c0336
Warn about undocumented non-private APIs. 2024-05-01 11:35:20 +02:00
Mike McQuaid
97ad3567d1
Optimise more command handling/speed
- in `brew.sh` split the `case` into those cases that take a single or
  no arguments and those that take multiple arguments or handle
  multiple commands. This considerably speeds up the
  `brew shellenv bash` case that wasn't being handled here before.
- add `setup-ruby` to the list of commands that can be called quickly
  by `brew.sh` without additional setup. This speeds up the
  `brew setup-ruby` no-op case by ~10x.
- add a parameter to `setup-ruby` to avoid running Bundler if the
  command doesn't need it. This makes many more cases for
  `brew setup-ruby` to be no-op cases.
- Remove the (now) unused `HOMEBREW_RUBY3` check in `setup-ruby`.
- Improve argument handling in `command_path.sh` to allow it to be
  used as a function in `setup-ruby.sh`.
- Add a new RuboCop to check usage of `install_bundler_gems!` is only
  inside `dev-cmd` (or a few other acceptable places).
- Use new `processed_source.file_path` API in `formula_cop.rb`
2024-04-30 12:48:29 +01:00
Mike McQuaid
4ffcd8a110
Various improvements for brew command
- Add a (large) speedup by moving some logic to Bash for the typical
  case of a normal or dev-cmd, Bash or Ruby command.
- Make `brew command` a non-developer command, I don't think it makes
  sense to consider it something needed for developing Homebrew.
- Update the manpage/tests/RBI accordingly.

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2024-04-30 11:38:19 +01:00
Markus Reiter
0b56d0be4a
Document Tab.for_keg and use Keg#tab where possible. 2024-04-28 20:50:13 +02:00
Carlo Cabrera
dde493c6e9
cmd/*-sync: avoid clobbering existing user installations
If a user already has an existing version installed, let's avoid
deleting it.
2024-04-26 18:32:54 +08:00
Mike McQuaid
966454c97d
Merge pull request #17125 from Homebrew/brew-list-manual-auto
cmd/list: support listing formulae installed on request or automatically
2024-04-23 09:10:37 +01:00
Ruoyu Zhong
ba85f92df2
cmd/list: update switches and logic 2024-04-23 15:55:06 +08:00
Ruoyu Zhong
7cf6cb2624
cmd/list: tweak wording 2024-04-23 15:51:16 +08:00
Ruoyu Zhong
a1a0cbbf0a
cmd/list: update description for --installed-as-dependency
Co-authored-by: Kevin <apainintheneck@gmail.com>
2024-04-23 15:41:11 +08:00
Mike McQuaid
2b09fcd6e4
cmd/list: more consistent switches. 2024-04-23 08:35:10 +01:00
Ruoyu Zhong
868c15fe4f
cmd/list: support listing formulae installed on request or automatically
Sample usage:

    $ brew ls --manual
    gcc
    llvm
    [...]
    $ brew ls --auto
    grpc
    protobuf
    [...]
    $ brew ls --manual --auto
    gcc: manual
    grpc: auto
    llvm: manual
    protobuf: auto
    [...]

Resolves #17117.
2024-04-22 12:00:22 +08:00
Michael Cho
77a16c2e15
cmd/deps: add --os and --arch
Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-04-21 17:56:59 -04:00
Issy Long
69c31d275f
Only brew desc --search needs --eval-all
- It was suggested in https://github.com/Homebrew/brew/issues/ 16733 that
  `brew desc <formula_or_cask>` should work like `brew info <formula_or_cask>`
  and print the description of the package without needing `--eval-all`.
- Looking at the code, it seems like it's only searching that needs
  `--eval-all`, so limit the check to that.

Before:

```shell
$ brew desc hello
Error: `brew desc` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!
```

After:

```shell
$ brew desc hello
hello: Program providing model for GNU coding standards and practices

$ brew desc --search hello
Error: Invalid usage: `brew desc --search` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!

$ brew desc --search --eval-all hello
==> Formulae
dsh: Dancer's shell, or distributed shell
hello: Program providing model for GNU coding standards and practices
```
2024-04-17 23:54:45 +01:00
Will Faught
29c561eb59 Use newlines in package info 2024-04-12 09:52:37 -07:00
Will Faught
661f78e9c1
Update Library/Homebrew/cmd/tap-info.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-04-12 09:49:33 -07:00
Will Faught
4e7d128604 cmd, cask: info prints whether installed 2024-04-10 19:02:09 -07:00
Mike McQuaid
a21c71fa97
Merge pull request #17056 from Homebrew/fix_brew_log
cmd/log: various fixes.
2024-04-09 10:55:52 +01:00
Mike McQuaid
7bfe859473
cmd/log: various fixes.
- Don't pass through `args:` when called with no arguments; these don'T
  need to be passed and end up breaking things instead.
- Make `T.must` as early as possible.
- Add a type signature to `git_log` to enable `typed: strict` and catch
  these sorts of bugs earlier next time.
- `--follow` only works with a single file so check if the path is a
  file before adding it to the arguments.
2024-04-09 10:42:08 +01: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
Todd Schulman
18e2a37d14 cmd: allow --display-times with --cask 2024-04-09 01:50:29 -04:00
Mike McQuaid
56fc9a1fb2
Merge pull request #17047 from Homebrew/block-params
Prefer numbered block params over proc conversion, cont'd
2024-04-08 19:13:01 +01:00
Douglas Eichelberger
c59d9fa833 Prefer numbered block params over proc conversion, cont'd 2024-04-08 09:47:27 -07:00
Mike McQuaid
5c48226018
cmd/help: add description and arguments.
This allows an accurate manpage description of `brew help`.

Also commit the various other required changes to completions and
manpage.
2024-04-08 13:35:25 +01:00
apainintheneck
2d47193d22 cmd/untap: move module methods back into the cmd
The extra module was their to facilitate testing but now that
everything is properly namespaced and each command is an instance
we can just move the methods into the command. Since it's an
instance now we don't need to be as careful about caching either.
2024-04-03 22:06:19 -07:00
Douglas Eichelberger
3f856f6516 Port Homebrew::Cmd::Repository 2024-04-01 16:02:41 -07:00
Douglas Eichelberger
6a1d43337c Port Homebrew::Cmd::Prefix 2024-04-01 16:00:47 -07:00