4907 Commits

Author SHA1 Message Date
Mike McQuaid
affc4c01aa
Merge pull request #16068 from J-M0/fish-shellenv
fix `eval (brew shellenv)` from exiting with status 1 in fish
2023-10-01 18:58:57 +01:00
Mike McQuaid
a0805d8678
Merge pull request #16059 from MikeMcQuaid/whoami
Improve use of `whoami`
2023-10-01 16:04:00 +01:00
James Morris
793831cb93 fix eval (brew shellenv) from exiting with status 1 in fish
fish's `set` doesn't modify the exit status when assigning a variable.
This means that `set -q VAR; or set VAR ...` will return an exit status
of 1 even if the variable is suceessfully set. By switching the commands
to `! set -q VAR; and set VAR ...`, this prevents the 1 from propogating
when running `eval (brew shellenv)`.
2023-09-30 17:39:39 -04:00
Mike McQuaid
39bbc33a27
Improve use of whoami
If you're e.g. running Homebrew over `sudo`: shelling out to `whoami`
is less effective than just telling people which user you're running
as when we run the check.
2023-09-29 12:32:22 +01:00
Bo Anderson
af7d744af0
Fixes for Ruby 3 2023-09-29 05:25:48 +01:00
Mike McQuaid
073a4bb925
Merge pull request #16014 from apainintheneck/scrub-sorbet-runtime-from-backtrace
utils/backtrace: scrub sorbet-runtime from backtrace
2023-09-22 09:53:10 +01:00
apainintheneck
85bd4c7e1f utils/backtrace: scrub sorbet-runtime from backtrace
Ever since we started using this at runtime it's been polluting
the backtrace output. This makes it harder to debug errors and
increases the amount of info users have to paste into the box
when filing an issue.

This is a very direct approach. Essentially, we strip out
everything related to the `sorbet-runtime` gem whenever the top
line in the backtrace is unrelated to sorbet-runtime.

The hope is that this will allow errors related to sorbet to
be diagnosed easily while also reducing the backtrace size
for all other types of errors.

Sometimes it is useful to see the full backtrace though.
For those cases, we include the full backtrace when
`--verbose` is passed in and print a warning that the
Sorbet lines have been removed from the backtrace the
first time they are removed.

Note: This requires gems to be set up so that the call to
`Gem.paths.home` works correctly. For that reason, it must
be included after `utils/gems` which is included in
`standalone/load_path` already.
2023-09-21 21:07:22 -07:00
apainintheneck
5760ae4fb2 cmd/readall: Cleanup todos
- keep running the command against all os/arch combinations
  as the default
- remove todos and deprecations related to changing the behavior
- create constants for os/arch combinations
2023-09-19 21:33:13 -07:00
Eric Knibbe
c493b5e680
cmd+dev-cmd: fixes for output formatting 2023-09-11 02:29:57 -04:00
Eric Knibbe
4662678b3b
cmd+dev-cmd: adjust description line breaks
Use to distinguish additional notes from initial explanation and usage info
2023-09-11 02:29:21 -04:00
Eric Knibbe
931f762598
docs+rubydoc: various grammar/wording fixes 2023-09-11 02:26:37 -04:00
Eric Knibbe
beafe82096
cmd/deps: explain runtime dependencies mode 2023-09-09 12:11:12 -04:00
apainintheneck
1dc9274f62 Improve cask audit
- check for cask.url in audit steps
- check for cask.version in audit steps
- check for cask.sha256 in fetch command
- stop omitting casks based on nil url in audit command

It would be nice to be able to omit casks from the audit
if the os is not supported but there is not easy way to
do that without updating the SimulateSystem code or
refactoring how MacOSRequirement's are defined in the DSL.
2023-09-07 20:38:17 -07:00
apainintheneck
f4b15e95ac cmd/fetch & cmd/audit: handle unsupported os/arch combos
It's possible for casks to only run on certain os/arch
combinations but we don't check for them in the fetch and
audit commands.

At first, I tried to check if the macos version was satisfied
in a previous PR but that doesn't work correctly because
MacOSRequirement and ArchRequirement don't respect SimulateSystem.

Instead I'm just checking to see if the url stanza is defined
for each os/arch combination and skipping those casks where
it ends up being nil. This is kind of brute forcing it but
should work.
2023-09-04 15:00:31 -07:00
Mike McQuaid
4ad5321d03
Merge pull request #15937 from MikeMcQuaid/cleanup_todo
Cleanup various TODOs
2023-09-03 09:29:03 -04:00
Mike McQuaid
db1267bdff
Merge pull request #15943 from apainintheneck/handle-nil-urls-in-cask-installer
Handle nil cask urls caused by unsupported macOS version
2023-09-03 09:23:08 -04:00
Mike McQuaid
f73607553c
Cleanup various TODOs
These were also easily fixed, already fixed or incorrect and
non-controversial.

Co-authored-by: Issy Long <issyl0@github.com>
2023-09-03 09:12:41 -04:00
apainintheneck
8c2f101138 cmd/fetch: handle nil cask urls
These urls can be nil if there is an unsatisfied macos version
requirement. We check for false here because either the macos
requirement can be satisfied and return true or can not be
specified and return nil. If it's not specified, it means it
can run on any macos version.

The change in Cask::Download should provide better error messages
in Downloadable but honestly we're better off just checking for
the missing url higher up the call stack which is why I made
the changes in the fetch command. Either way it seemed like
a good idea while I'm here.
2023-09-02 20:56:55 -07:00
hyuraku
adc2a2fea1 remove ARGV from Formula#all 2023-09-02 19:35:22 +09:00
Mike McQuaid
9863d555a8
cmd/deps: fix documentation and handling of formula_options.
https://github.com/Homebrew/brew/pull/15892#issuecomment-1698659908
2023-08-30 08:46:59 +01:00
Mike McQuaid
851df262a0
Merge pull request #15892 from apainintheneck/rework-recursive-dependency-resolution
dependency_helpers: rework recursive dependency resolution
2023-08-30 08:29:24 +01:00
apainintheneck
b2b8f0ea86 cmd/uses & cmd/deps: update help/man pages
- add clarification about precedence of command options
- reword some options for readability
- clarify the defaults in `brew deps`
2023-08-28 22:14:26 -07:00
apainintheneck
72152c09c7 cmd/uses: handle --missing
Ignore all dependencies that are already installed before
checking if they use the dependency in question. Remove
the :satisfied? criteria before checking used dependents.
2023-08-27 13:50:53 -07:00
apainintheneck
e314a43754 dependency_helpers: include required & use public_send
- Use .required? instead of .tags.empty?
- use .public_send
- modify .reject_ignores to be .select_includes
  - checks ignores first now
- Don't use runtime deps with --missing in `brew deps` command
2023-08-25 00:25:14 -07:00
Clint Harrison
e75a72dcb5 Use HOMEBREW_CURLRC in vendor-install 2023-08-22 17:21:37 -04:00
Mike McQuaid
2d133ba1a6
cmd/update-report: improve tap/untap behaviour.
- unify core tapping/untapping behaviour (so we can never tap and then
  immediately untap)
- automatically untap homebrew-core or homebrew-cask if it's old, on
  the default branch and it doesn't seem to be needed
- if we think it's unneeded but it's too new: output a message instead

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2023-08-16 14:06:26 +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
Mike McQuaid
38f00671c4
cmd/update-report: correctly handle added/deleted formulae/casks.
If a formulae or cask is marked as both added and deleted, we've just
incorrectly detected it. Remove it from the report.

This can happen when a formula or cask is moved around in the repository
e.g. with sharding.
2023-08-14 19:28:56 +01:00
Douglas Eichelberger
d01cda2815 Turn up the types 2023-08-12 22:01:22 -07:00
Mike McQuaid
22553cd34a
Fix cask sharding issues
- Fix cask info output being incorrect
- Improve some code referring to casks as formulae
- Move livecheck cask fixtures to not shadow existing names
- Adjust the cask tap symlinking logic to make handling outdated
  shadowed casks significantly easier
- Fix various flaky tests caused by casks sharding logic
- Prefer longer paths when there's multiple formulae or casks in a tap
  with the same name rather than always using the first
2023-08-10 16:08:47 +01:00
Mike McQuaid
565eb363ea
update_report: show "Delete and Installed" header.
Clarify that the deleted formulae/casks when not using `report_all`
are only those that have been deleted _and_ the user has them
installed. This should avoid users glossing over this information as
it is pretty relevant to them.

While we're here, refactor some of the `report_all` logic to make it
easier to remove it all on the next Homebrew major/minor version.
2023-08-08 16:57:03 +01:00
eugenesvk
2c7c064040 Allow hiding new formula/cask sections on update 2023-08-07 20:38:54 +07:00
Mike McQuaid
b3c33d34ab
Various sharding fixes
- Load paths with no API when needed (e.g. for `brew edit`)
- Use no API mode for `brew log` as it's needed there
- Define sharding format for homebrew-cask and homebrew-core inside
  `Tap` methods
- Create new formulae/casks in location defined by these `Tap` methods
- Fix a bug in Formulary that made sharded formulae lookup less
  efficient (and possibly broke it for core and some API usage)
- Fix various other hardcoded Formula/Cask directory assumptions

Co-authored-by: Bo Anderson <mail@boanderson.me>
2023-08-04 16:43:13 +01:00
Mike McQuaid
04e07dc0db
Deprecate postgresql-upgrade-database
This is an out-of-band deprecation but this command is broken and we're
not going to fix it so it's not really worth a deprecation cycle.

See https://github.com/orgs/Homebrew/discussions/4685
2023-08-01 12:00:30 +01:00
Mike McQuaid
389bcf4eb4
Merge pull request #15781 from MikeMcQuaid/post_install_improvements_fixes
post_install: improvements and fixes.
2023-07-28 12:06:05 +01:00
Mike McQuaid
7801878c74
post_install: improvements and fixes.
- warn if running `brew postinstall` explicitly and there's no
  `post_install` defined in the formula
- add a `post_install` alias for `brew postinstall` to make life
  easier for those jumping between `postinstall` and `post_install` in
  e.g. Homebrew development
- refactor `post_install` formula path logic into a new method for
  improved readability
- handle the JSON API `post_install` formula path case
2023-07-28 11:26:09 +01:00
Mike McQuaid
2c300cfbe9
brew update core/homebrew-cask taps properly
The existing logic in `update.sh` was both a bit hard to follow and
had some edge cases. Fix this up for improving #15775.
2023-07-28 10:13:57 +01:00
Mike McQuaid
f4760edfbf
Merge pull request #15774 from MikeMcQuaid/update_verboser
cmd/update: output more API information with `--verbose`.
2023-07-27 15:46:53 +01:00
Mike McQuaid
c4f65f2eee
cmd/update: output more API information with --verbose.
Also, hide some spammy/unnecessary newline printing.
2023-07-27 15:20:59 +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
Mike McQuaid
71a4421c6c
cmd/install: add missing require.
Fixes #15748
2023-07-25 10:08:49 +01:00
Mike McQuaid
a78173b419
Merge pull request #15746 from apainintheneck/install-cmd-should-upgrade-existing-casks
cmd/install: upgrade already installed casks
2023-07-25 08:21:52 +01:00
Douglas Eichelberger
08e46c18cd Add type to Formula attrs 2023-07-24 14:12:36 -07: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
21f586c4bf
cmd/{casks,formulae}: handle sharding.
- Allow subdirectories inside `Casks`/`Formula` directories.
- DRY up repeated code with some variables.
2023-07-18 12:57:54 +01:00
Mike McQuaid
a1c9a21548
cmd/tap: remove --list-pinned option.
Not deprecating as it's broken and has been for several major versions.
2023-07-18 10:23:52 +01:00
Mike McQuaid
77061817f7
Fix (again) InfluxDB analytics messaging
Address https://github.com/Homebrew/brew/pull/15688#issuecomment-1638725595

Fixes https://github.com/Homebrew/brew/issues/15678
2023-07-18 08:03:57 +01:00
Mike McQuaid
fb35578c54
Merge pull request #15676 from Bo98/tap-fixes
Introduce CoreCaskTap class and fix cases of core taps were being unnecessarily installed
2023-07-17 19:22:22 +01:00
Bo Anderson
beaa6c32a0
Fix cases of core taps being unnecessarily installed 2023-07-13 20:33:31 +01:00
Bo Anderson
ba02c669e1
Introduce CoreCaskTap class 2023-07-13 20:33:26 +01:00