22#ifndef ZYPP_SOLVER_DETAIL_SAT_RESOLVER_H
23#define ZYPP_SOLVER_DETAIL_SAT_RESOLVER_H
24#ifndef ZYPP_USE_RESOLVER_INTERNALS
25#error Do not directly include this file!
29#include <solv/solver.h>
65class SATResolver :
public base::ReferenceCounted,
private base::NonCopyable,
private sat::detail::PoolMember
70 sat::detail::CPool *_satPool;
71 sat::detail::CSolver *_satSolver;
72 sat::detail::CQueue _jobQueue;
75 PoolItemList _problem_items;
78 PoolItemList _items_to_install;
79 PoolItemList _items_to_remove;
80 PoolItemList _items_to_lock;
81 PoolItemList _items_to_keep;
84 PoolItemList _result_items_to_install;
85 PoolItemList _result_items_to_remove;
91 bool _allowdowngrade:1;
92 bool _allownamechange:1;
93 bool _allowarchchange:1;
94 bool _allowvendorchange:1;
95 bool _allowuninstall:1;
97 bool _noUpdateProvide:1;
98 bool _dosplitprovides:1;
100 bool _ignorealreadyrecommended:1;
102 bool _removeOrphaned:1;
103 bool _removeUnneeded:1;
104 bool _dup_allowdowngrade:1;
105 bool _dup_allownamechange:1;
106 bool _dup_allowarchchange:1;
107 bool _dup_allowvendorchange:1;
108 bool _solveSrcPackages:1;
109 bool _cleandepsOnRemove:1;
115 std::string SATproblemRuleInfoString (Id rule, std::string &detail, Id &ignoreId);
116 std::vector<std::string> SATgetCompleteProblemInfoStrings ( Id problem, std::string &detail, Id &ignoreId );
117 void resetItemTransaction (PoolItem item);
120 void solverInit(
const PoolItemList & weakItems);
121 void solverInitSetLocks();
122 void solverInitSetSystemRequirements();
123 void solverInitSetModeJobsAndFlags();
125 void solverAddJobsFromPool();
126 void solverAddJobsFromExtraQueues(
const CapabilitySet & requires_caps,
const CapabilitySet & conflict_caps );
129 bool solving(
const CapabilitySet & requires_caps =
CapabilitySet(),
140 sat::Solvable mapSolvable (
const Id &
id);
141 PoolItem mapItem (
const PoolItem &item);
145 SATResolver (ResPool pool, sat::detail::CPool *satPool);
146 virtual ~SATResolver();
150 virtual std::ostream &
dumpOn( std::ostream & str )
const;
151 friend std::ostream&
operator<<(std::ostream& str,
const SATResolver & obj)
152 {
return obj.dumpOn (str); }
154 ResPool pool (
void)
const;
155 void setPool (
const ResPool & pool) { _pool = pool; }
158 bool resolvePool(
const CapabilitySet & requires_caps,
159 const CapabilitySet & conflict_caps,
160 const PoolItemList & weakItems,
161 const std::set<Repository> & upgradeRepos
164 bool resolveQueue(
const SolverQueueItemList &requestQueue,
165 const PoolItemList & weakItems
171 void applySolutions (
const ProblemSolutionList &solutions);
173 bool fixsystem ()
const {
return _fixsystem;}
174 void setFixsystem (
const bool fixsystem) { _fixsystem = fixsystem;}
176 bool ignorealreadyrecommended ()
const {
return _ignorealreadyrecommended;}
177 void setIgnorealreadyrecommended (
const bool ignorealreadyrecommended) { _ignorealreadyrecommended = ignorealreadyrecommended;}
179 bool distupgrade ()
const {
return _distupgrade;}
180 void setDistupgrade (
const bool distupgrade) { _distupgrade = distupgrade;}
182 bool removeOrphaned ()
const {
return _removeOrphaned;}
183 void setRemoveOrphaned (
const bool removeOrphaned) { _removeOrphaned = removeOrphaned;}
185 bool allowdowngrade ()
const {
return _allowdowngrade;}
186 void setAllowdowngrade (
const bool allowdowngrade) { _allowdowngrade = allowdowngrade;}
188 bool allowarchchange ()
const {
return _allowarchchange;}
189 void setAllowarchchange (
const bool allowarchchange) { _allowarchchange = allowarchchange;}
191 bool allowvendorchange ()
const {
return _allowvendorchange;}
192 void setAllowvendorchange (
const bool allowvendorchange) { _allowvendorchange = allowvendorchange;}
194 bool allowuninstall ()
const {
return _allowuninstall;}
195 void setAllowuninstall (
const bool allowuninstall) { _allowuninstall = allowuninstall;}
197 bool updatesystem ()
const {
return _updatesystem;}
198 void setUpdatesystem (
const bool updatesystem) { _updatesystem = updatesystem;}
201 void setNoUpdateProvide (
const bool noUpdateProvide) { _noUpdateProvide =
noUpdateProvide;}
203 bool dosplitprovides ()
const {
return _dosplitprovides;}
204 void setDosplitprovides (
const bool dosplitprovides) { _dosplitprovides = dosplitprovides;}
206 bool onlyRequires ()
const {
return _onlyRequires;}
207 void setOnlyRequires (
const bool onlyRequires) { _onlyRequires = onlyRequires;}
209 bool solveSrcPackages()
const {
return _solveSrcPackages; }
210 void setSolveSrcPackages(
bool state_r ) { _solveSrcPackages = state_r; }
212 bool cleandepsOnRemove()
const {
return _cleandepsOnRemove; }
213 void setCleandepsOnRemove(
bool state_r ) { _cleandepsOnRemove = state_r; }
215 PoolItemList problematicUpdateItems(
void )
const {
return _problem_items; }
216 PoolItemList problematicUpdateItems() {
return _problem_items; }
218 PoolItemList resultItemsToInstall () {
return _result_items_to_install; }
219 PoolItemList resultItemsToRemove () {
return _result_items_to_remove; }
221 sat::StringQueue autoInstalled()
const;
222 sat::StringQueue userInstalled()
const;
226 sat::detail::CSolver * get()
const {
return _satSolver; }
std::ostream & operator<<(std::ostream &str, const zypp::sat::detail::CDataiterator *obj)
relates: zypp::sat::LookupAttr::iterator Stream output of the underlying iterator for debug.
Common types used in the Resolver public API and need to be passed down to the details tree.
Libsolv transaction wrapper.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Easy-to use interface to the ZYPP dependency resolver.
ResolverFocus
The resolver's general attitude.
std::list< ResolverProblem_Ptr > ResolverProblemList
std::unordered_set< Capability > CapabilitySet
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
relates: Capability Detailed stream output