271 Commits

Author SHA1 Message Date
Bo Anderson
98b7bc8d11
cmd/update: ensure local branch moves to main 2025-06-27 22:05:17 +01:00
Bo Anderson
7f3f3c2d55
cmd/update: ensure we update remote main ref 2025-06-27 17:45:04 +01:00
Mike McQuaid
aa596d3e6b
cmd/update: improve homebrew-core main migration.
Let's avoid people sticking on the master branch unnecessarily.
2025-06-26 12:13:48 +01:00
Mike McQuaid
f649587d51
cmd/update: improve Homebrew/brew main migration.
Let's avoid people sticking on the `master` branch unnecessarily.
2025-06-26 12:11:11 +01:00
Mike McQuaid
08eae94955
cmd/update*: more fixes to allow migration from master to main.
We're not migrating Homebrew/brew to `main` yet but this will allow us
to ensure we have a `brew update` ready in future when we're ready to do
this.
2025-06-13 17:13:51 +01:00
Mike McQuaid
837b28ba79
cmd/update: attempt migration from master to main branch.
This should allow any repositories that change from `master` to `main`
to be automatically migrated by `brew update` without requiring manual
intervention or displaying errors to the user.
2025-06-11 08:38:32 +01:00
Adrian Ho
85c9551cd3 update.sh: reject unknown long opts
I accidentally typed `brew update --greedy` instead of `brew upgrade --greedy` and got some strange output.

This fix causes unrecognized long options to throw a usage message and exit like all the other subcommands.

Before:
```
% brew update --greedy
==> Updating Homebrew...
Usage: brew update-report [--auto-update] [--force]

The Ruby implementation of brew update. Never called manually.
[...]
```

After:
```
% brew update --greedy
Error: Unrecognized option '--greedy'
Usage: brew update, up [options]

Fetch the newest version of Homebrew and all formulae from GitHub using git(1)
and perform any necessary migrations.
[...]
```
2025-01-13 09:41:09 +08:00
Carlo Cabrera
4029e3d7c1
cmd/update: avoid switching developers to stable branch
Checking for `HOMEBREW_NO_INSTALL_CLEANUP` was added in #18825, but this
breaks developers by switching them to the stable branch.

Setting `HOMEBREW_NO_UPDATE_CLEANUP` when `HOMEBREW_NO_INSTALL_CLEANUP`
is set seems like a relatively recent addition, so I don't think it
hurts to just remove it. We can add it back (correctly) if there are
users that need it.
2024-12-04 01:32:52 +08:00
Eric Knibbe
1ed026c91a
update.sh: fix unused environment variable 2024-11-25 22:43:48 -05:00
Mike McQuaid
94416e82f0
Add new odeprecated, odisabled, remove disabled code.
Prepare the usual deprecation cycle for Homebrew 4.4.0.
2024-09-24 10:15:34 +01:00
Bo Anderson
c3d9e8e6f1
cmd/update: make chown suggestion consistent 2024-08-06 21:42:50 +01:00
Bo Anderson
1ce88d4992
cmd/update: silence git advice where possible 2024-07-23 18:54:05 +01: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
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
9ac31827a0
Various brew update behaviour improvements
- Output a message every time auto-update is run rather than a 3 second
  timer. This makes it more obvious that Homebrew isn't just sitting
  doing nothing for 2.9 seconds.
- Output a message when running `brew update` so Homebrew doesn't just
  sit there silently doing nothing.
- Update all taps when `brew update` is run, not just those hosted on
  GitHub. This makes it more obvious that people don't need to explictly
  run `brew update` "just in case".
- As a result of this, remove `brew tap --force-auto-update` as it's no
  longer necessary.
2024-03-08 16:21:09 +00:00
Markus Reiter
b29a2cdff3
Add missing local variable.
Co-authored-by: Bo Anderson <mail@boanderson.me>
2024-02-23 17:09:42 +01:00
Markus Reiter
132a87aff5
Rename Tap#repo_var to Tap#repo_var_suffix. 2024-02-23 16:02:29 +01:00
Sharon Azriel
a1fbbc323a [update.sh] New test with protection of Homebrew directory 2024-02-13 10:02:18 +02:00
sazriel26
807b3e3394 Update Library/Homebrew/cmd/update.sh
https://github.com/Homebrew/brew/pull/16289#discussion_r1448765696

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-02-13 10:02:18 +02:00
Sharon Azriel
835762b289 Ready for review? 2024-02-13 10:02:18 +02:00
sazriel26
3d0f543b63 Update Library/Homebrew/cmd/update.sh
Remove one empty line?

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-02-13 10:02:18 +02:00
Sharon Azriel
d9a38e76a9 Brew style --fix (applied) 2024-02-13 10:02:18 +02:00
Sharon Azriel
4a37e81179 Rewrite of branching tests in parsing URL 2024-02-13 10:02:18 +02:00
Sharon Azriel
2833a217e9 [Library/Homebrew/cmd/update.sh] Add support for token provided w/o user in URL 2024-02-13 10:02:18 +02:00
Sharon Azriel
3619636f7f [Library/Homebrew/cmd/update.sh] Release Candidate for pull request 2024-02-13 10:02:18 +02:00
Sharon Azriel
53c261814e Fix brew style on update.sh (2) 2024-02-13 10:02:18 +02:00
Sharon Azriel
02a8de72d6 Fix brew style on update.sh 2024-02-13 10:02:17 +02:00
Sharon Azriel
07287982f2 Fix missing ; 2024-02-13 10:02:17 +02:00
Sharon Azriel
01d1e9b228 New implementation through BASH regexes match 2024-02-13 10:02:17 +02:00
sazriel26
a1e9e93902 Update Library/Homebrew/cmd/update.sh
better wording

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-02-13 10:02:17 +02:00
Sharon Azriel
154a8c398b Release Candidate 2 2024-02-13 10:02:17 +02:00
Sharon Azriel
e24027ea57 Release Candidate 1 2024-02-13 10:02:17 +02:00
Sharon Azriel
c83172c8f4 [update.sh] Parse local token in git remote.origin.url config 2024-02-13 10:02:17 +02:00
Bo Anderson
89531e9ff3
Update all dependencies 2023-12-15 16:24:46 +00:00
Bo Anderson
2a02038690
cmd/update.sh: don't switch to master when updating to a tag 2023-12-02 03:06:30 +00:00
Bo Anderson
e19c3e1f13
Unset HOMEBREW_RUBY3 after updates 2023-12-01 13:44:33 +00: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
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
c4f65f2eee
cmd/update: output more API information with --verbose.
Also, hide some spammy/unnecessary newline printing.
2023-07-27 15:20:59 +01:00
Bo Anderson
8f13cfc529
cmd/update: adjustments for setup-homebrew in brew CI 2023-07-07 19:53:50 +01:00
Mike McQuaid
27dda52a5d
Download tap_migrations.json files from the API
Download the previously stored tap migrations files for homebrew/core
and homebrew/cask from the formulae.brew.sh API.

This adds a much longer stale time (24 hours) to decide whether or not
the migrations files need downloaded from the API in Ruby land.
`brew update` will still update them every time.

Requires https://github.com/Homebrew/brew/pull/15628
Fixes https://github.com/Homebrew/brew/issues/14897
2023-07-05 17:18:12 +01:00
Mike McQuaid
93a6335c30
cmd/update: update homebrew/core and homebrew/cask with devcmdrun.
If those folks have this tapped and explicitly run `brew update`:
let's update it from them.
2023-07-04 15:50:59 +01:00
Bo Anderson
7e1efd61a5
cmd/update: don't fetch core taps on manual brew update 2023-07-03 20:03:17 +01:00
Mike McQuaid
20dfa3694b
cmd/update.sh: always move names*.txt files.
Move the `names*.txt` files even when the file size hasn't changed
(which can happen when the versions change in the API but the file
size doesn't change).

Fixes #15217

While we're here, also add some whitespace for easier reading.
2023-06-27 17:30:27 +01:00
Bo Anderson
4b48ea4509
cmd/update.sh: fix some fflags throwing errors on update report 2023-06-22 15:18:14 +01:00
Bo Anderson
55419bfd8b
Allow bump commands to auto-update core tap clones 2023-06-22 01:39:55 +01:00
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