After upgrading existing kegs, we now search and upgrade their
dependents as well. If any are detected that have broken linkage, they
are reinstalled from source.
If there are any formulae in the dependents tree that are pinned, they
are only reinstalled if they're not outdated; in all cases, a suitable
message is printed detailing the kegs that will be acted upon.
I received the following error when attempting to use the `upgrade`
command on a tap:
$ brew tap teddywing/passextract https://github.com/teddywing/Passextract.git
$ brew upgrade --verbose teddywing/passextract/passextract
Updating Homebrew...
==> Upgrading 1 outdated package, with result:
teddywing/passextract/passextract 0.4.0
Error: Calling build.build_bottle? is disabled!
Use build.bottle? instead.
/usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:121:in `upgrade_formula'
Or, even better, submit a PR to fix it!
Change the method call to use the (presumably) newer version.
It's not possible to determine the difference between a non-keg-only
keg that failed to link and one that wasn't linked by us intentionally.
To avoid additional complexity of storing this logic in another place
let's back out this relatively new functionality; sticky keg-only links
is a better and more desirable behaviour anyway.
Rather than blocking the rest of the formulae from being installed by
`brew upgrade` print the requirement failure messages (already done) and
an error stating requirements weren't satisfied and then continue to
upgrade the rest of the formulae.
Treat a `brew install` command as normal i.e. link by default unless
keg-only and only specify whether a keg should be linked when upgrading
or reinstalling. Also, adjust the naming accordingly so it's more
obvious that this is the case.
This means if a user has manually `brew unlink` or `brew link --force`d
something then that status will be preserved after they `brew upgrade`
or `brew reinstall` that formula.
This generally should make things that are keg-only by default easier
to swallow.
Avoids unnecessary conflicts when a previously non-keg_only formula is
in the way by prioritizing keg_only before non-keg_only formulae.
This change is motivated by the upgrade of gnupg 2.0 to 2.1, since the
latter no longer depends on the gpg-agent formula, which, even if made
keg_only, still causes the link step to fail for 2.1, as gpg-agent's
non-keg version won't have been upgraded to the keg_only version at that
point (alphabetically gnupg precedes gpg-agent).
If `--with-foo` is provided to a formula through a tab or through
another formula depending on it and this option does not exist it
should be filtered. If it is not (the prior behaviour) then this can
prevent bottles being used unnecessarily.
Fixes#1399.
Introduce `--fetch-HEAD` option. Without this option upgrade and
outdated never fetch latest upstream commit to detect if HEAD is
outdated -- tabs are used instead. However, if option is passed,
we fetch commit from upstream, which is more time consuming,
but we can be sure that version is up-to-date or outdated.
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)).