225 Commits

Author SHA1 Message Date
Mike McQuaid
9de0b619f3
More update tweaks
- Make copying to `*_names.before.txt` the responsibility of `update.sh`
  (unless the file doesn't exist at all). This provides the added
  benefit of allowing the inspection of the before/after state after
  running a `brew update` rather than both files always being identical
  at this point.
- State `No changes to formulae or casks.` on macOS.
- Rename and flip `updated_formula_report` to `auto_update`; this naming
  was confusing every time.
- Only display the `You can upgrade with...` messaging if we're not
  auto-updating as sometimes it will be displayed before the commands it
  references (e.g. `upgrade`, `outdated` or an `install` that proceeds
  to upgrade these formulae).

Fixes https://github.com/Homebrew/brew/issues/15065
2023-03-27 17:24:32 +01:00
Adrian Ho
ff42a4e3b7 update*: check shim output
The shims _Should Not Fail_, but [when bugs happen](https://github.com/orgs/Homebrew/discussions/4331), they just cause confusing errors.
2023-03-22 18:03:47 +08:00
Carlo Cabrera
a29939e8ed
cmd/update.sh: limit setting core.fsmonitor to false
We set `core.fsmonitor` to `false` in #13586 because Git's fsmonitor
daemon prevented the release of our locks, resulting in errors for some
users reported in #13521.

However, the fix from #13586 set `core.fsmonitor` to `false` too often.
This is not needed for taps, or when `HOMEBREW_REPOSITORY` is different
from `HOMEBREW_PREFIX`. The issue in #13521 stems from the fsmonitor
daemon preventing the release of our locks, so there is no need to
prevent the daemon from monitoring repositories that don't contain our
lock files.
2023-03-02 14:04:31 +08:00
Mike McQuaid
c209c0403d
Fix references to formula.json and cask.json
These would be stranded after `formula.jws.json`.
2023-02-24 16:46:15 +00:00
Bo Anderson
b7d6d00c34
api: use signed endpoint 2023-02-22 21:53:32 +00:00
Bo Anderson
c2342eca91
Further improvements to API handling in shell 2023-02-19 05:38:13 +00:00
Mike McQuaid
aa2c2982a0
cmd/update.sh: provide full JSON URL.
This makes it clearer what site cannot be accessed.
2023-02-16 16:03:22 +00:00
EricFromCanada
dfc9906184
internal messaging fixes 2023-02-10 23:17:16 -05:00
Mike McQuaid
e301fe8fd8
brew.sh: move shared curl speed limit settings here.
This avoids duplication and potentially allows it to be used for various
other `curl` calls.
2023-02-10 17:27:10 +00:00
Bo Anderson
51d63ee484
cmd/update.sh: fix API download reporting 2023-02-09 18:27:37 +00:00
Bo Anderson
a26a2d71a8
Use --speed-time over --max-time for API downloads 2023-02-09 18:25:52 +00:00
Flier Lu
f08c1e836d increase JSON_API_MAX_TIME 2023-02-09 21:06:46 +08:00
Mike McQuaid
2a5d41d41b
Revert "Merge pull request #14547 from Homebrew/revert-14412-homebrew_install_from_api_default"
This reverts commit f4e60482791d2ff628efadfdbf0d14d9237d2d29, reversing
changes made to e26784f424061ca16987afcb21e036c66a298492.
2023-02-07 19:25:40 +01:00
Mike McQuaid
0575903868
Revert "HOMEBREW_INSTALL_FROM_API: make the default for everyone." 2023-02-07 15:13:23 +01:00
Mike McQuaid
5f6c69bca2
HOMEBREW_INSTALL_FROM_API: make the default for everyone.
- remove all places we check the flag so it's a no-op now
- flip the messaging to refer to `HOMEBREW_NO_INSTALL_FROM_API` where
  relevant
- adjust the documentation
2023-02-05 18:13:08 +01:00
Xuehai Pan
ba3bccf9ed api: download from HOMEBREW_API_DOMAIN 2023-02-04 13:05:20 +00:00
Rylan Polster
9e280f2c44
update: increase max time for API JSON updates 2023-02-03 19:16:30 +01:00
Mike McQuaid
91884e0837
cmd/update: tweak API update behaviour.
- Use `HOMEBREW_CASK_REPOSITORY` more consistently
- Skip auto-updating homebrew-core for `HOMEBREW_DEVELOPER` too (without
  explicit `brew update`)
- Also skip auto-updating homebrew-cask
2023-01-26 10:58:21 +00:00
Mike McQuaid
4a03603f68
Add HOMEBREW_NO_INSTALL_FROM_API
This allows HOMEBREW_INSTALL_FROM_API functionality to be disabled and will stick around once
HOMEBREW_INSTALL_FROM_API is made the default behaviour.

Co-authored-by: Eric Knibbe <enk3@outlook.com>
2023-01-18 15:50:13 +00:00
Mike McQuaid
f788765876
cmd/update.sh: use GitHub API token if available.
Fixes https://github.com/Homebrew/brew/issues/14335
2023-01-10 16:13:47 +00:00
Rylan Polster
374b61584b
Load casks from the JSON API with HOMEBREW_INSTALL_FROM_API 2023-01-06 02:46:21 -05:00
Mike McQuaid
e554f51454
cmd/update: tweak error message.
Co-authored-by: Bo Anderson <mail@boanderson.me>
2022-10-14 17:10:50 +01:00
hyuraku
4bc5f48654 compare bytesize instead of shasum256 2022-10-15 00:22:10 +09:00
hyuraku
dc37364248 use ruby script instead of shasum command 2022-10-13 23:46:41 +09:00
hyuraku
f4156378d8 compare formula.json shasum to check brew updated 2022-10-13 23:16:28 +09:00
hyuraku
8843364123 add error log of download formula.json 2022-10-12 22:35:08 +09:00
Adrian Ho
5155c9073b update*: enforce sane symlinks setting
Otherwise, a global `core.symlinks = false` setting, likely in a WSL context, breaks Aliases and any other places that use symlinks.

Also enforce consistency in `git config` settings across instances.

Ref: https://github.com/Homebrew/homebrew-core/issues/112539
2022-10-08 22:03:37 +08:00
Rylan Polster
bfbb7a79bd
Improve brew update with HOMEBREW_INSTALL_FROM_API 2022-09-02 02:10:12 -04:00
Carlo Cabrera
72880dea35
Merge pull request #13586 from carlocab/git-fsmonitor 2022-07-29 04:28:15 +08:00
Carlo Cabrera
5e60d54e70
update: disable Git fsmonitor for all Homebrew repositories
Stopping the fsmonitor doesn't seem to work, so let's just prevent the
fsmonitor from watching our repositories.
2022-07-28 22:20:07 +08:00
Carlo Cabrera
c42169249e
cmd/update: stop fsmonitor after all Git operations complete
Also, skip the status check, as that doesn't really help us.
2022-07-28 22:02:31 +08:00
Alexander Bayandin
4e8cc524c5 Clean up GitHub headers 2022-07-24 11:44:16 +00:00
Carlo Cabrera
f9e8531924
cmd/update: stop Git's fsmonitor when needed
Git's fsmonitor daemon will prevent our update lock file from being
released if it is running before a `brew update`.

Let's fix that by stopping it whenever necessary so our update lock is
released upon completion.

Fixes #13521.
2022-07-20 18:18:12 +08:00
Bo Anderson
7390022b0e
cmd/update.sh: fix race condition reporting fetch failures 2022-07-01 17:35:34 +01:00
Rylan Polster
b63474398e
Always prefer loading from API when HOMEBREW_INSTALL_FROM_API is set 2022-06-17 13:54:05 -04:00
Rylan Polster
f724dde6bb
Fix style 2022-06-16 15:37:33 -04:00
Rylan Polster
98f8a86af3
Clarify TODO in brew update
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2022-06-16 15:34:04 -04:00
Rylan Polster
43f7fa4162
Update cached formula json file when needed 2022-06-14 16:11:23 -04:00
Bo Anderson
1d36c42fb7
Support offline usage under HOMEBREW_INSTALL_FROM_API 2022-06-14 16:06:05 -04:00
Mike McQuaid
fb4c9353bb
Improve updating behaviour
- Rename use of "preinstall" to "auto update". The original "preinstall"
  naming came from the fact that we used to only auto-update before
  `brew install` but now that it's many commands: this is more confusing
  than useful.
- Add `HOMEBREW_NO_UPDATE_REPORT_ONLY_INSTALLED` and remove
  `HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED`; the latter is now the default
  and the prior provides an opt-out for better output, performance and
  avoiding reading potentially untrusted formulae.
- Add `HOMEBREW_UPDATE_FORMULA_VERSION_CHECKS` and don't check formula
  versions by default for better performance by default.

Co-authored-by: Eric Knibbe <3324775+EricFromCanada@users.noreply.github.com>
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
2022-05-19 11:04:20 -04:00
Bob Lail
c715ea7fd1 Document the --quiet flag on brew update 2022-05-04 10:52:19 -05:00
Maxim Belkin
13735bc780
Apply Mike's suggestions from code review
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2022-04-26 08:35:28 -07:00
Maxim Belkin
27a2dba340
update/update-reset: warn when no origin remote
Current situation with update.sh & update-reset.sh:

Upon creating a new tap and before adding remote 'origin' to it,
running `brew update` produces multiple cryptic error messages.
This change converts these cryptic Git messages into clear warnings
about absent remote 'origin'.

How to test:
1. Create a new tap using `brew tap-new`
2. Run `brew update`
2022-04-26 08:35:27 -07:00
Rylan Polster
feb93167ad
Rename and fix Formatter:wrap to Formatter.format_help_text 2022-01-08 23:13:08 -05:00
XuehaiPan
cf7def0c68
style: apply shellcheck autofix 2021-11-08 03:07:25 +00:00
Michka Popoff
1cc7ca33c0
update: migrate everyone from linuxbrew-core to homebrew-core
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2021-10-20 11:01:38 +01:00
Bob Lail
c3e48b004d
Add HOMEBREW_SSH_CONFIG_PATH
This allows specifying the path of an SSH config file that Homebrew should use instead of the default, `~/.ssh/config`, when fetching Git repos over SSH.
2021-10-20 09:01:57 +01:00
Michka Popoff
e8ee5b05f9
Migrate linuxbrew-core to homebrew-core on update.
- Only for HOMEBREW_DEVELOPER
- Except for HOMEBREW_CORE_MERGE_MAINTAINER
- Except for GitHub Actions CI

Co-authored-by: Rylan Polster <rslpolster@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2021-10-11 21:04:58 +02:00
Bo Anderson
6145036525
Redetermine curl and git paths where necessary 2021-10-05 17:13:47 +01:00
Bo Anderson
0ba222ccf2
cmd/update.sh: don't absorb ca-certificates installation failure 2021-10-04 14:26:49 +01:00