From 37ea0ad06207e29430d9989ac0890fe111c1ea17 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Thu, 27 Mar 2008 17:25:25 +0000 Subject: [PATCH] regarding recommend/suggest settings from the SAT-solver --- zypp/ResStatus.cc | 2 ++ zypp/ResStatus.h | 2 ++ zypp/sat/SATResolver.cc | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/zypp/ResStatus.cc b/zypp/ResStatus.cc index a0fa4b0fb..5ae71b082 100644 --- a/zypp/ResStatus.cc +++ b/zypp/ResStatus.cc @@ -33,6 +33,8 @@ namespace zypp const ResStatus ResStatus::satisfied (UNINSTALLED, SATISFIED); const ResStatus ResStatus::unneeded (UNINSTALLED, UNNEEDED); const ResStatus ResStatus::needed (UNINSTALLED, INCOMPLETE); + const ResStatus ResStatus::recommended (RECOMMENDED); + const ResStatus ResStatus::suggested (SUGGESTED); /////////////////////////////////////////////////////////////////// // diff --git a/zypp/ResStatus.h b/zypp/ResStatus.h index 58040b93e..2dfb11dd4 100644 --- a/zypp/ResStatus.h +++ b/zypp/ResStatus.h @@ -639,6 +639,8 @@ namespace zypp static const ResStatus unneeded; // uninstalled, unneeded static const ResStatus needed; // uninstalled, incomplete static const ResStatus incomplete; // installed, incomplete + static const ResStatus recommended; // recommended + static const ResStatus suggested; // suggested //@} private: diff --git a/zypp/sat/SATResolver.cc b/zypp/sat/SATResolver.cc index 70d0011db..4a10bc346 100644 --- a/zypp/sat/SATResolver.cc +++ b/zypp/sat/SATResolver.cc @@ -249,6 +249,14 @@ SATSolutionToPool (PoolItem item, const ResStatus & status, const ResStatus::Tra else if (status.isSatisfied()) { r = item.status().setSatisfied(); _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") satisfied !" << r); + } + else if (status.isRecommended()) { + item.status().setRecommended(true); + _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") recommended !" << r); + } + else if (status.isSuggested()) { + item.status().setSuggested(true); + _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") suggested !" << r); } else { _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") unchanged !"); } @@ -505,6 +513,38 @@ SATResolver::resolvePool(const CapabilitySet & requires_caps, } } + /* solvables which are recommended */ + for (int i = 0; i < _solv->recommendations.count; i++) + { + Id p; + p = _solv->recommendations.elements[i]; + if (p < 0 || !sat::Solvable(p)) + continue; + + PoolItem poolItem = _pool.find (sat::Solvable(p)); + if (poolItem) { + SATSolutionToPool (poolItem, ResStatus::recommended, ResStatus::SOLVER); + } else { + ERR << "id " << p << " not found in ZYPP pool." << endl; + } + } + + /* solvables which are suggested */ + for (int i = 0; i < _solv->suggestions.count; i++) + { + Id p; + p = _solv->suggestions.elements[i]; + if (p < 0 || !sat::Solvable(p)) + continue; + + PoolItem poolItem = _pool.find (sat::Solvable(p)); + if (poolItem) { + SATSolutionToPool (poolItem, ResStatus::suggested, ResStatus::SOLVER); + } else { + ERR << "id " << p << " not found in ZYPP pool." << endl; + } + } + // cleanup solver_free(_solv); _solv = NULL; -- 2.34.1