Also:
- when `brew test` or `brew postinstall` is run allow `Resource#stage`
to fetch the resource.
- make `Formula#fetch` and `Resource#fetch` fetch external patches too.
Follow-up from #7549 and #7546.
Whenever you are fetching a dependency you only care about fetching that
specific dependency and not all the dependencies of that dependency.
Unlike installing, dependencies can be fetched in any order and have no
"chains" between them.
This uses `FormulaInstaller#fetch` to recursively fetch dependencies
through the dependency tree and allows `install_dependency` to not
do any fetching.
Remove usage where `Homebrew.args` could be used instead or, due to the
`Homebrew.args` parsing, there was dead code that was never executed
(and no-one complained about not working).
Refactor the CLI::Args module so it doesn't have different paths to
check arguments depending on whether the arguments have been parsed or
not. Instead, set the values we need from the global ARGV at
first, global initialisation time where they will be thrown away when
the actual arguments are parsed.
To do this some other general refactoring was needed:
- more methods made private when possible
- e.g. `HEAD?` used consistently instead of `head` before arguments
are parsed.
- formula options are only parsed after named arguments are extracted
In #6807, the FormulaInstaller began to rescue from
FormulaInstallationAlreadyAttemptedError but there is the
potential for tmp kegs to remain unlinked in the cellar.
I've merged the rescue statements so they both re-link tmp
kegs, but it doesn't raise for
FormulaInstallationAlreadyAttemptedError.
- This also required auto-fixes for Layout/EmptyLinesAroundBlockBody and
Layout/InconsistentIndentation once the auto-fixer had got rid of the
"redundant begin"s.
Only install the bottle depenencies when a bottle was in fact poured.
In particular, if the dependencies are already satisfied,
then there's no need to install the bottle dependencies.
This API is used internally correctly and externally mostly correctly
but #6230 reveals the external usage is fairly confusing and a bit
unsafe by default. Preserve the existing API while verifying the
checksum by default and providing an opt-out. Using the existing, safe
method will result in a double verification of the checksum which is
harmless. A Homebrew/homebrew-core PR will follow shortly to address
those cases.
Fixes#6230