Author: schubi2
Date: Thu Jan 10 15:42:01 2008
New Revision: 8254
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8254&view=rev
Log:
Checking delete request if the reason for is an update/upgrade.
Modified:
trunk/libzypp/zypp/sat/SATResolver.cc
Modified: trunk/libzypp/zypp/sat/SATResolver.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SATResolver.cc?rev=8254&r1=8253&r2=8254&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/SATResolver.cc (original)
+++ trunk/libzypp/zypp/sat/SATResolver.cc Thu Jan 10 15:42:01 2008
@@ -357,6 +357,29 @@
//----------------------------------------------------------------------------
+class CheckIfUpdate : public resfilter::PoolItemFilterFunctor
+{
+ public:
+ bool is_updated;
+
+ CheckIfUpdate()
+ : is_updated( false )
+ {}
+
+ // check this item will be installed
+
+ bool operator()( PoolItem_Ref item )
+ {
+ if (item.status().isToBeInstalled())
+ {
+ is_updated = true;
+ return false;
+ }
+ return true;
+ }
+};
+
+
bool
SATResolver::resolvePool()
{
@@ -426,19 +449,6 @@
ERR << "Solverrun finished with an ERROR" << endl;
return false;
}
- /* solvables to be erased */
- for (int i = solv->installed->start; i < solv->installed->start + solv->installed->nsolvables; i++)
- {
- if (solv->decisionmap[i] > 0)
- continue;
-
- PoolItem_Ref poolItem = _pool.find (sat::Solvable(i));
- if (poolItem) {
- SATSolutionToPool (poolItem, ResStatus::toBeUninstalled, ResStatus::SOLVER);
- } else {
- ERR << "id " << i << " not found in ZYPP pool." << endl;
- }
- }
/* solvables to be installed */
for (int i = 0; i < solv->decisionq.count; i++)
@@ -458,6 +468,32 @@
}
}
+ /* solvables to be erased */
+ for (int i = solv->installed->start; i < solv->installed->start + solv->installed->nsolvables; i++)
+ {
+ if (solv->decisionmap[i] > 0)
+ continue;
+
+ PoolItem_Ref poolItem = _pool.find (sat::Solvable(i));
+ if (poolItem) {
+ // Check if this is an update
+ CheckIfUpdate info;
+ invokeOnEach( _pool.byNameBegin( poolItem->name() ),
+ _pool.byNameEnd( poolItem->name() ),
+ functor::chain (resfilter::ByUninstalled (), // ByUninstalled
+ resfilter::ByKind( poolItem->kind() ) ), // equal kind
+ functor::functorRef