From: Stefan Schubert Date: Tue, 22 Apr 2008 10:00:45 +0000 (+0000) Subject: bugfix: product have the right status now: broken/satisfied X-Git-Tag: 6.6.0~1011 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d334e7864e83a5e9de22ac7fb12d2fd2a03d4a3;p=platform%2Fupstream%2Flibzypp.git bugfix: product have the right status now: broken/satisfied --- diff --git a/zypp/solver/detail/SATResolver.cc b/zypp/solver/detail/SATResolver.cc index 6136c56e0..57c755be2 100644 --- a/zypp/solver/detail/SATResolver.cc +++ b/zypp/solver/detail/SATResolver.cc @@ -43,7 +43,8 @@ extern "C" { #include "satsolver/evr.h" #include "satsolver/poolvendor.h" #include "satsolver/policy.h" -#include "satsolver/bitmap.h" +#include "satsolver/bitmap.h" +#include "satsolver/queue.h" } ///////////////////////////////////////////////////////////////////////// @@ -416,41 +417,20 @@ class CheckIfUpdate : public resfilter::PoolItemFilterFunctor }; -class SetValidate : public resfilter::PoolItemFilterFunctor +class CollectNonePackages : public resfilter::PoolItemFilterFunctor { public: - Map installedmap, conflictsmap; + Queue *solvableQueue; - SetValidate(Solver *solv) - { - solver_create_state_maps(solv, &installedmap, &conflictsmap); - } - - // set validation + CollectNonePackages( Queue *queue ) + :solvableQueue (queue) + {} + + // collecting none packges bool operator()( PoolItem item ) { - - if (isKind(item.resolvable())) { - // FIXME This is a hack for registration 11.0 beta1 - item.status().setSatisfied(); - _XDEBUG("SATSolutionToPool(" << item << " ) satisfied. THIS IS A HACK !"); - return true; - } - - int ret = solvable_trivial_installable_map(item.satSolvable().get(), &installedmap, &conflictsmap); - item.status().setUndetermined(); - - if (ret == -1) { - item.status().setNonRelevant(); - _XDEBUG("SATSolutionToPool(" << item << " ) nonRelevant !"); - } else if (ret == 1) { - item.status().setSatisfied(); - _XDEBUG("SATSolutionToPool(" << item << " ) satisfied !"); - } else if (ret == 0) { - item.status().setBroken(); - _XDEBUG("SATSolutionToPool(" << item << " ) broken !"); - } + queue_push(solvableQueue, item.satSolvable().id()); return true; } }; @@ -569,11 +549,37 @@ SATResolver::solving() } /* Write validation state back to pool */ - SetValidate infoValidate(_solv); + Map installedmap; + Queue flags, solvableQueue; + + queue_init(&flags); + queue_init(&solvableQueue); + + CollectNonePackages collectNonePackages(&solvableQueue); invokeOnEach( _pool.begin(), _pool.end(), functor::not_c(resfilter::byKind()), // every solvable BUT packages - functor::functorRef (infoValidate) ); + functor::functorRef (collectNonePackages) ); + solver_create_state_maps(_solv, &installedmap, 0); + pool_trivial_installable(_solv->pool, _solv->installed, &installedmap, &solvableQueue, &flags); + for (int i = 0; i < solvableQueue.count; i++) { + PoolItem item = _pool.find (sat::Solvable(solvableQueue.elements[i])); + item.status().setUndetermined(); + + if (flags.elements[i] == -1) { + item.status().setNonRelevant(); + _XDEBUG("SATSolutionToPool(" << item << " ) nonRelevant !"); + } else if (flags.elements[i] == 1) { + item.status().setSatisfied(); + _XDEBUG("SATSolutionToPool(" << item << " ) satisfied !"); + } else if (flags.elements[i] == 0) { + item.status().setBroken(); + _XDEBUG("SATSolutionToPool(" << item << " ) broken !"); + } + } + map_free(&installedmap); + queue_free(&(solvableQueue)); + queue_free(&flags); return true; }