Apply the same changes from #6066.
Also apply the same logics from `brew upgrade` to preserve
`installed_as_dependency`/`installed_on_request` settings
when reinstalling formulae.
- We've never supported `devel` bottles so don't bother outputting their
status to `brew info`
- Don't `brew upgrade` or `brew reinstall` bottles if they were
previously built as a bottle unless there's no bottles defined at all
(rather than there was no compatible bottles). Fixes#5532.
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.