Configuring the interactive dependency resolver

Configuring resolver hints

Configuring resolver hints

To improve the quality of the dependency solutions that you receive, you can provide hints to the interactive dependency resolver. These hints can alter the priorities of the resolver, biasing it more strongly in favor of one version or package, or they can be used to pre-load the resolver with rejections and approvals, as if you had entered the resolver and manually rejected or approved various versions.

Hints are stored in the apt configuration file, /etc/apt/apt.conf, in the configuration group Aptitude::ProblemResolver::Hints (see the section called “Configuration file reference” for details on the configuration file).

Each resolver hint consists of an action, a target, and an optional version. A hint is written like this: "action target [version]". To apply a resolver hint, aptitude locates one or more packages using the value of target, chooses one or more versions of those packages using the value of version, and finally performs the given action.

The action field of a resolver hint may be one of the following:

  1. approve: Approve the version, as if the command ResolverToggle Approved (a) had been invoked on it.

  2. reject: Reject the version, as if the command ResolverToggle Rejected (r) had been invoked on it.

  3. discard: Discard every solution containing the version. Differs from reject in that it is not visible to the user and cannot be modified interactively.

  4. increase-safety-cost-to number: increase the safety cost of any solution that contains the version to number; if its safety cost is already higher than number, this hint has no effect. The safety cost can be used (and is used by default) to control the order in which solutions appear; see the section called “Costs and cost components” and the section called “Safety costs” for details.

    Several special cost levels can be chosen by name:

    1. conflict, discard: instead of changing the safety cost, discard solutions containing the version as if the discard hint had been applied.

    2. maximum: the highest safety cost.

    3. minimum: the lowest safety cost. All searches start at this cost, so increasing a version to this cost has no effect. However, this value can also be used when adjusting the predefined cost levels: for instance, setting Aptitude::ProblemResolver::Remove-Level to minimum will cause removed packages to have no effect on the safety cost of a solution.

    [Note]Note

    The increase-safety-cost-to hint is applied in addition to any default safety cost that is due to the selected action. For instance, a hint that increases the safety cost of install hal from experimental to 15,000 will have no effect, because that action already has a safety cost of 50,000 (assuming that this version of hal is not the default candidate version).

  5. number: add the given number to the version's score, biasing the resolver in favor of it or (with a negative number) away from it. For instance, the hint 200 emacs adds 200 to the score of emacs, whereas the hint -10 emacs subtracts 10 from its score.

If target field of a resolver hint contains a question mark (?) or tilde (~), it is considered to be a search pattern and all matching package versions are considered. Otherwise, it is considered to be the name of a package to select. So the target g++ will select only the g++ package, but the target ?section(non-free) will select any package in the non-free section. See the section called “Search patterns” for more information on search patterns.

If the version field is not present, then all versions of the package are affected by the hint. Otherwise, it may have any of the following forms:

  1. /archive: the hint only affects versions that are available in the given archive.

  2. <version: the hint only affects versions whose version number is less than version.

  3. <=version: the hint only affects versions whose version number is less than or equal to version.

  4. =version: the hint only affects versions whose version number is version.

  5. <>version: the hint only affects versions whose version number is not version.

  6. >=version: the hint only affects versions whose version number is greater than or equal to version.

  7. >version: the hint only affects versions whose version number is greater than version.

  8. :UNINST: instead of affecting any of the versions of target, the hint affects the decision to remove target. For instance, Aptitude::ProblemResolver::Hints { "reject aptitude :UNINST"; }; will prevent the resolver from attempting to remove aptitude.

  9. version: the hint only affects versions whose version number is version.