apt-cudfbridges apt-getwith external CUDF solvers. It implements a translator from the protocol EDSP?? and CUDF??, invokes an external solver and translate back to apt-getthe outcome in the EDSP laguage.
This primer applies to version 3.3 of apt-cudf.
Using apt-get With External SolversPietro Abate, Roberto Di Cosmo, Ralf Treinen, Stefano ZacchiroliSeptember 3, 2015 |
From release 0.9.x apt-getis able to use external solvers (via the EDSP protocol).
The integration of CUDF solvers in apt-getis transparent from the user prospective. To invoke an external solver the user just need to pass the option --solver to apt-getplus the name of the selected CUDF solver. Available solvers in debian are aspcud, mccs, packup. These solvers use different technologies and can provide slightly different solutions.
Using an external CUDF solver does not require any other particular action from the user :
$apt-get -s --solver aspcud install gnome NOTE: This is only a simulation! apt-get needs root privileges for real execution. Keep also in mind that locking is deactivated, so don't depend on the relevance to the real current situation! Reading package lists... Done Building dependency tree Reading state information... Done Execute external solver... Done The following extra packages will be installed: [...]
Depending on the solver, the invocation of external solver can take longer then the apt-getinternal solver. This difference is to be explained in the additional conversion step from EDSP to CUDF and back and the effective solving time.
apt-getitself ships two EDSP-compatible tools. The first, the internal apt-getdependency solver, called internal, uses the apt dependency solver from release 0.8.x. The second, that is not strictly a solver is not a solver, can be used to dump the EDSP document in a text file for debugging purposes and it is called dump.
For example, the following invocation is equivalent to invoking apt-getwithout the --solver argument :
apt-get -s install --solver internal gnome
CUDF-based solvers come with the built-in ability to specify a set of user preferences for selecting the kind of changes one accepts on the system to satisfy the installation request. Compared with apt-get, this gives the user a greater flexibility to define “optimal” solutions for a specific installation problem (ex: minimize the number of new packages or minimize the total installation size the packages to upgrade).
Each CUDF solver implements a base optimization language, and some of them implement extensions to this basic language to respond to specific optimization requirements. apt-cudf, that is the bridge from apt-getand the CUDF solver, associates to each apt-getcommand an optimization strategy that can be either configured at each invocation using one apt-getconfiguration option or by using the configuration file (/etc/apt-cudf.conf ) of apt-cudf.
solver: * upgrade: -new,-removed,-notuptodate dist-upgrade: -notuptodate,-new install: -removed,-changed remove: -removed,-changed trendy: -removed,-notuptodate,-unsat_recommends,-new paranoid: -removed,-changed
The field solver define the (comma-separated) list of solvers to which this stanza applies. The symbol “*” denotes that this stanza applies to all solver that do not have a specific stanza.
Each field of the stanza defines the default optimization criteria. If one field name coincides with a standard apt-get action, like install, remove, upgrade or dist-upgrade, the corresponding criterion will be applied by the external solver. Otherwise the field is interpreted as a short-cut definition that can be used on the apt-getcommand line.
Using the configuration option of apt-getAPT::Solver::aspcud::Preferences, the user can pass a specific optimization criteria on the command line overwriting the default. For example :
apt-get -s --solver aspcud install totem -o "APT::Solver::aspcud::Preferences=trendy"
When a package is available in more than one version, apt-getuses a mechanism known as pinning to decide which version should be installed. However, since this mechanism defines from the beginning which package versions must be consider and consequently which package version should be ignored, it has also the consequence of considerably limiting the search space, leading to unsatisfiable solutions even if one might exists if all packages are considered.
To circumvent this restriction and to allow the underlying solver to explore the entire search space, apt-getcan be configured to let the CUDF solver ignore the pinning annotation.
The option APT::Solver::Strict-Pinning when used in conjunction with an external solver, tells apt-getto ignore pinning information when solving dependencies possibly leading to a solution that was not considered by the apt-getinternal solver.
Anther consequence of such strict pinning policy of apt-getis that if a package is specified on the command line with version or suite annotations, overwriting the pinning strategy for this package, but not for its dependencies, the underlying solver might not be able to find a possible solution because not all packages are available
Because of the way that pinning information are encoded, apt-cudf+ a CUDF solver is effectively unable to do better then apt-getbecause important information were lost on the way. In order to overcome this limitation, apt-cudfhas the ability to reconstruct the user request and to use this information to provide a possible solution. To this end, apt-cudfreads an environment variable, named APT_GET_CUDF_CMDLINE, that the user can pass along containing the invocation of apt-get.
To make it straightforward for the user, a very simple script called apt-cudf-get is provided by the apt-cudfpackage.
#!/bin/sh export APT_GET_CUDF_CMDLINE="apt-get $* -o APT::Solver::Strict-Pinning=\"false\"" apt-get $* -o APT::Solver::Strict-Pinning="false"
The wrapper is be invoked using the same commands as apt-get:
apt-cudf-get -s --solver aspcud install totem \ -o "APT::Solver::aspcud::Preferences=-new,-changed"
This document was translated from LATEX by HEVEA.