5401 Commits

Author SHA1 Message Date
Markus Reiter
6434533ff5
Remove Whirly and show concurrent downloads. 2024-09-04 22:54:24 +02:00
Markus Reiter
3a51f55572
Move require. 2024-09-04 22:54:23 +02:00
Markus Reiter
601134b047
Fix --force flag. 2024-09-04 22:54:22 +02:00
Markus Reiter
b55528b825
Color status. 2024-09-04 22:54:21 +02:00
Markus Reiter
b297be77a1
Implement concurrent downloads. 2024-09-04 22:54:20 +02:00
Bo Anderson
99ce3094e9
Invalidate Bootsnap cache on Gemfile.lock changes 2024-09-04 04:05:10 +01:00
Carlo Cabrera
1981abd959
Merge pull request #18225 from Homebrew/revert-18224-revert-18188-better-shellenv 2024-09-03 16:03:22 +08:00
Michael Cho
a548a81040
docs: remove references to deprecated/disabled GCC formulae 2024-09-02 12:03:06 -04:00
Carlo Cabrera
9d60472090
shellenv: retain user PATH
This is filtered in `brew`, so we need to manually set this to
`HOMEBREW_PATH`.
2024-09-02 21:12:36 +08:00
Carlo Cabrera
c9ca7e3257
cmd/shellenv: output the result of path_helper instead
This will save the indirection of `eval`.
2024-09-02 17:36:17 +08:00
Carlo Cabrera
43d10940b9
Revert "Revert "cmd/shellenv: improve for newer macOS using /usr/libexec/path_helper"" 2024-09-02 17:32:05 +08:00
Carlo Cabrera
121624e0c2
Revert "cmd/shellenv: improve for newer macOS using /usr/libexec/path_helper" 2024-09-02 17:02:08 +08:00
Carlo Cabrera
6cd74705cb
shellenv: silence errors from writing to etc/paths file
Users don't need to see this error. We can just fall back silently
instead.
2024-08-29 19:12:23 +08:00
Carlo Cabrera
04088b3e3c
shellenv: extract paths file to a variable
Let's follow the Rule of Three here.
2024-08-29 17:36:50 +08:00
Carlo Cabrera
6dc90cbf83
cmd/shellenv: improve for newer macOS using /usr/libexec/path_helper
On macOS 14 and newer, `/usr/libexec/path_helper` supports setting a
`PATH_HELPER_ROOT` environment variable.

With this set, `path_helper` checks `$PATH_HELPER_ROOT/etc/paths` and
`$PATH_HELPER_ROOT/etc/paths.d` in the same way it checks `/etc/paths`
and `/etc/paths.d`.

We can use this to simplify management of the user's `PATH` variable
when they do `brew shellenv`. In particular, if their system supports
it, we delegate setting the `PATH` environment variable to `path_helper`
instead of our own code. We also write a default `etc/paths` file if one
is not already present.

This is nicer because it simplifies management of the user's `PATH`
variable. For example, if a user wants a keg-only formula to be in their
`PATH`, they can simply add the necessary path to `/etc/paths` or
`/etc/paths.d` without having to do something like `brew link --force`
or adding to `PATH` themselves.

When `/usr/libexec/path_helper` is not available, we just fall back to
the existing code.
2024-08-29 17:00:43 +08:00
Mike McQuaid
9ee471d42c
Merge pull request #18133 from FnControlOption/ls 2024-08-23 08:06:49 +01:00
Bo Anderson
98fb5f9dea
Don't assume ENV is a superenv in RBI 2024-08-23 05:59:00 +01:00
fn ⌃ ⌥
6287607ac5 cmd/list: add --poured-from-bottle and --built-from-source 2024-08-22 21:26:16 -07:00
Bo Anderson
77204e01da
reinstall: move to submodule 2024-08-20 03:58:01 +01:00
Douglas Eichelberger
fb2fdc5249 Minor type safety improvements 2024-08-18 18:16:39 -07:00
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Mike McQuaid
c8732c6a94
Merge pull request #18001 from smsearcy/fix-fish-shellenv 2024-08-12 14:23:05 +01:00
Mike McQuaid
fd14deaebd
Merge pull request #18011 from Homebrew/more-srb-strict-cmd 2024-08-12 14:21:18 +01:00
Mike McQuaid
e3f8081f0a
Merge pull request #18010 from apainintheneck/refactor-method-to-remove-extra-tap-requires 2024-08-12 14:21:04 +01:00
Bevan Kay
0a9883a8dc
cmd/update-report: don't output cask updates on linux 2024-08-12 17:12:19 +10:00
Issy Long
2ec30c5973
cmd/search: Bump to Sorbet typed: strict 2024-08-11 20:51:04 +01:00
Issy Long
3433c938b7
cmd/gist-logs: Bump to Sorbet typed: strict 2024-08-11 00:09:14 +01:00
Issy Long
0272c6efb2
cmd/link: Bump to Sorbet typed: strict 2024-08-10 23:58:53 +01:00
Issy Long
e42863fc4a
cmd/home: Bump to Sorbet typed: strict 2024-08-10 23:55:14 +01:00
Issy Long
69aadd7e49
cmd/options: Bump to Sorbet typed: strict 2024-08-10 23:55:14 +01:00
Issy Long
b0154f36a5
cmd/uses: Bump to Sorbet typed: strict 2024-08-10 23:55:14 +01:00
Issy Long
10dc874b1e
cmd/tap-info: Bump to Sorbet typed: strict 2024-08-10 23:55:14 +01:00
Issy Long
4ff3e370e0
cmd/outdated: Bump to Sorbet typed: strict 2024-08-10 23:55:13 +01:00
Issy Long
6d8c21bd7a
cmd/leaves: Bump to Sorbet typed: strict 2024-08-10 23:55:13 +01:00
Issy Long
686b5afa05
cmd/list: Bump to Sorbet typed: strict 2024-08-10 23:55:13 +01:00
Scott Searcy
17855638c2 Update Fish shell environment script
Fish didn't support `$(...)` substitution until v3.4.0, but the command
didn't work with just parenthesis, so rewrite the test to prepend an
empty string if MANPATH is non-empty (to trigger a leading colon).
Only manipulate INFOPATH in Fish if Homebrew not in path already.
2024-08-10 14:34:59 -07:00
Issy Long
6cc4d6dacb
cmd/--prefix: Bump to Sorbet typed: strict 2024-08-10 22:17:05 +01:00
apainintheneck
a3e917afe1 Refactor method to remove extra tap requires
We were selectively requiring the tap.rb file in a few places for
performance reasons. The main method we were referencing was the
`Tap.cmd_directories` method which uses `Pathname` and the `TAP_DIRECTORY`
constant internally. `Tap.cmd_directories` is mostly used in the `Commands`
module and that is loaded very early on in the program so it made sense
to move that command to that module. To facilitate that I moved the
`TAP_DIRECTORY` constant to the top-level and renamed it to
`HOMEBREW_TAP_DIRECTORY`. It now lies in the tap_constants.rb file.

A nice bonus of this refactor is that it speeds up loading external
commands since the tap.rb file is no longer required by default in
those cases.
2024-08-10 13:49:10 -07:00
Bo Anderson
c3d9e8e6f1
cmd/update: make chown suggestion consistent 2024-08-06 21:42:50 +01:00
Carlo Cabrera
3fec77e72a
shellenv: fix MANPATH and INFOPATH handling for [t]csh
It turns out that control flow in csh is a pain. But we can rely on
`test`, which is thankfully POSIX.

Closes #17949.
2024-08-04 02:52:14 +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
Ruoyu Zhong
fa63211acf
Merge pull request #17850 from Homebrew/repository-prefix-fix
cmd/--repository: fix homebrew- prefix handling
2024-07-25 09:54:37 +08: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
Bo Anderson
38987be01f
cmd/--repository: fix homebrew- prefix handling 2024-07-25 01:42:53 +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
1ce88d4992
cmd/update: silence git advice where possible 2024-07-23 18:54:05 +01:00
Kevin
d686be67c6
Merge pull request #17761 from eaze/cask-quiet-upgrade
Add better "--quiet" support to cask upgrade
2024-07-19 22:54:51 -07:00
Eric Sampson
8bb1ba13be silence no-op upgrade warning in upgrade.rb 2024-07-19 09:26:05 -05:00
apainintheneck
52cf4e30fc Share attestation formula sorting and gh exe checking logic
This adds a new method to either move the `gh` formula to the front
of the formula list to be installed or checks that the `gh` formula
is already installed some other way.
2024-07-18 21:32:50 -07:00
apainintheneck
75cfa21068 Avoid frozen array errors in brew upgrade
The `Homebrew::CLI::NamedArgs` class often returns frozen arrays so this one cannot
be easily modified in-place here. We just overwrite it instead.

I also updated the `brew reinstall` command logic to match for consistency.

```console
$ brew upgrade gh --verbose --debug
...
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading gh
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading gh
Error: can't modify frozen Array: [#<Formula gh (stable) /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/g/gh.rb>]
/usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:139:in `delete'
/usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:139:in `run'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11481/lib/types/private/methods/call_validation.rb:270:in `bind_call'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11481/lib/types/private/methods/call_validation.rb:270:in `validate_call'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11481/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
/usr/local/Homebrew/Library/Homebrew/brew.rb:95:in `<main>'
```
2024-07-17 23:54:50 -07:00