Let's start storing `revision` and `pkg_version` for tab runtime
dependencies and use them when available.
When the `revision` is not available, use a conservative approach to
deciding whether dependencies need to be upgrade.
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
When we're installing a formula from a bottle, we currently always
upgrade all dependencies in the dependency tree to be safe.
However, if we're installing a bottle and the `runtime_dependencies`
within that bottle's tab all have older or equal versions to those
already installed: we do not need to upgrade these dependencies.
This should help a lot of upgrading a lot of the time, at least for
users using bottles (which is the huge majority).
The only downside or other noticeable change is that this requires us
to download or attempt to download the bottle tab before we compute
the dependencies at installation time.
Co-authored-by: Kevin <apainintheneck@gmail.com>
Dependency.to_formula() in the following line will cause a
CoreTapFormulaUnavailableError then download all dependency bottles in FormulaInstaller.verfi_deps_exist()
Filtering for this is now handled properly in places where this function is used.
In some scenarios, we _want_ test deps on more than the first level (Homebrew.args.include_formula_test_deps?).
Previously, this returned a String, but a Tap instance seems much more
sensible.
I couldn't find anywhere this method was actually used, so the change
shouldn't break anything.
- formula_installer: only recompute dependencies when necessary i.e.
when a bottle pour fails.
- formula_installer: re-add accidentally remove dependency options
- dependency: missing options are only those that actually exist on a
formula
During the dependencies expansion, there may be errors (e.g. FormulaUnavaiableError).
As result, some deps will be left behind in the stack and interfere afterwards
dependencies expansion.
So let's ensure stack clean for each expansions.
FixesHomebrew/homebrew#48834.
If we have a dependency cycle ensure that infinite recursion does not
result by storing state in a stack which we push/pop from for each
level of recursion and verify that we haven’t been through this
dependency already.
ClosesHomebrew/homebrew#47933.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
While it may suffice to merge string and non-reserved tags by forming a
union of all tags of dependencies of the same name, this approach fails
to work for the reserved tags. These are now merged such that the most
restrictive tag (meaning sometimes an empty tag) is preserved.
The previous behavior caused essential dependencies to be omitted and
builds to fail in response. E.g., multiple `:fortran` dependencies with
tags `[]`, `[:recommended]`, and `[:optional]` would have been expanded
and merged to `"gcc"` with tags `[:recommended, :optional]`, causing it
to be no longer seen as a required dependency.
ClosesHomebrew/homebrew#47040.
Signed-off-by: Martin Afanasjew <martin@afanasjew.de>