The existing dependency resolution, as implemented in resolvedep(),
prioritises name matches for a dependency over packages that only
provide that dependency. We would like the option to prioritise
database ordering above a precise name match.
To do this, we add a DependencyStrategy configuration parameter. The
default is to behave as pacman currently does, with
DependencyStrategy=Default. However, we also add a Strict strategy
(to strictly honour the priorities of repositories) which matches our
desired behaviour in some circumstances.
For the sake of clarity, the default strategy will:
- take the package with the exact name given from the highest priority
repository, ignoring all other packages.
- if this doesn't exist, take an installed package providing this
name, ignoring all other packages.
- otherwise, it will give a list of packages that provide this name,
in repository priority order, accumulated from every repository.
In contrast, the strict strategy will:
- take an installed package providing the dependency name, ignoring
all other packages.
- otherwise, give a list of all packages that either have this name,
or provide this name, accumulated from every repository. The
ordering is by repository priority order, with packages having the
exact name being first among the packages from their repository.
When does this difference matter? Let's suppose we have two repositories,
- customizations
- base
Let's say we have a list of instructions that involve installing the
name foo, which is provided by customizations/foo-customized. One day,
base/foo comes into existence. Under the default strategy, our
instructions now no longer install customizations/foo-customized,
meaning our instructions no longer install our customized version of
foo. Under the strict strategy, our instructions will now either
prompt for the correct package to install, or because the default will
be correct, will simply install the correct package with --noconfirm.
Signed-off-by: Ed Smith <ed.smith@collabora.com>