Class | Satsolver::Solver |
In: |
satsolver.i
|
Parent: | Object |
The solver class is at the heart of the satsolver, providing ultra-fast dependency resolution.
The solver is always attached to a pool, containing all solvables the solver can operate on. The pool also has designated repository for ‘installed’ solvables.
Solving is done by creating a Request and feeding it to the solver as input. On success (solver.solve() returning ‘true’), one can retrieve the Decisions made by the solver (i.e. install this, remove that, update those). On failure, the solver creates a list of Problems, explaining what went wrong and how to resolve the problem.
Solving can be controlled globally by setting solver flags. Additionally, specific constraints can be set by using Covenants.
pool = Satsolver::Pool.new pool.arch = "i686" system = pool.add_rpmdb( "/" ) pool.installed = system repo = pool.add_solv( "myrepo.solv" ) request = pool.create_request request.install( "packageA" ) request.install( "packageB" ) request.remove( "old_package" ) solver = pool.create_solver solver.allow_uninstall = true pool.prepare result = solver.solve( request ) if !result raise "Couldn't solve request" end solver.each_to_install do |s| puts "Install #{s}" end solver.each_to_remove do |s| puts "Remove #{s}" end
Allow arch change
After installation, the architecture of a package is fixed an the solver will not change it during upgrades. This prevents updates to a higher version but inferior architecture. If this flag is set, packages can change their architecture. The solver will usually try to select the ‘best’ architecture.
Allow downgrade The normal solver operation tries to install (to update to) the ‘best’ package, usually the one with the highest version. If allow_downgrade is set, packages may be downgraded in order to fulfill a request or a dependency
On package removal, also remove dependant packages.
If removal of a package breaks dependencies, the request is usually considered not solvable. The dependencies of installed packages take precedence over request actions.
On package removal, also remove dependant packages.
Setting allow_uninstall to ‘true’ will revert the precedence and remove all dependant packages.
Allow vendor change
The package vendor is usually an indicator of the package origin. Updates should only come from the same origin. If this flag is true, the solver will allow vendor changes during package upgrades.
Iterate over all to-be-newly-installed solvables those brought in for update reasons are normally not reported.
if true is passed, iterate over all to-be-installed solvables
Iterate over all to-be-removed-without-replacement solvables those replaced by an updated are normally not reported.
if true is passed, iterate over all to-be-removed solvables
Exclude (specific) solvable
Excluding a (specific) Solvable means that this Solvable must not be installed.
Excluding a Solvable by name means that any Solvable with the given name must not be installed.
Excluding a Solvable by relation means that any Solvable providing the given relation must not be installed.
Check and fix inconsistencies of the installed system
Normally, broken dependencies in the RPM database are silently ignored in order to prevent clutter in the solution. Setting fix_system to ‘true’ will repair broken system dependencies.
Get Covenant by index
The index is just a convenience access method and does NOT imply any preference/ordering of the Covenants.
The solver always considers Covenants as a set.
Include (specific) solvable
Including a Solvable explicitly means that this Solvable must be installed.
Including a Solvable by name means that one Solvable with the given name must be installed. The solver is free to choose one.
Including a Solvable by relation means that any Solvable providing the given relation must be installed.
Return the size change of the installed system
This is how much disk space gets allocated/freed after the solver decisions are applied to the system.
See Transaction for more details.
Solve the given Request
Returns true if a solution was found, else false.