This is weird. We're seeing some installs where formulae
have no opt prefix and no linked keg record, *but* still
ended up linked into the prefix. Upgrades will blow up in
this case because the old symlinks won't get deleted and
Homebrew will report a nonsensical error message about
not being able to link over another link from the same
formula!
Since the optpath is either missing or pointing to the
wrong destination at this point, the checks for conflict
linking above will have failed. We should instead be safe
to simply blow away these conflicting symlinks and replace
them with the new targets.
Fixes https://github.com/Homebrew/homebrew-core/issues/68866.
- manually `raise Errno::ENOENT` to ensure that a keg that doesn't exist
isn't flagged as a system dependency.
- remove the inconsistent and incorrect summary messaging.
The way we currently handle @-versioned formulae linking is pretty
labourius:
- it requires extensive use of `link_overwrite` to avoid the `link`
stage failing on certain install/upgrade scenarios
- we teach people to use `brew link --force` whenever they wish to
link a versioned formulae when it's pretty obvious what's expected
in that situation
Instead, let's:
- automatically unlink other versioned formulae when linking a
versioned formula (either through `brew link` or `install`/`upgrade`
/`reinstall`)
- notify the user what we've done (with the same messaging as if
they had run `brew link` manually)
Anywhere we can use `blob/master` we can use `blob/HEAD` instead. This
will make life easier if we ever rename our default branch in future
(once/if Git and GitHub provides the necessary tooling to do so).
- This also required auto-fixes for Layout/EmptyLinesAroundBlockBody and
Layout/InconsistentIndentation once the auto-fixer had got rid of the
"redundant begin"s.
This makes use of both the existing interfaces and could use the
existing cache file but we'll create a new one and cleanup the old one
to avoid issues and use a more consistent name.
- ensure that `HOMEBREW_CELLAR` is always created on `install`.
- remove the need for a special `PRUNEABLE_DIRECTORIES` variable
- reuse values from existing variables and get `uniq`s.