From 05e3205e26c19f8aba9871b15a18cbf0f683cf6f Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Tue, 8 Dec 2009 19:37:28 +0100 Subject: [PATCH] Fix transaction building in presence of multiversion installable items. --- zypp/sat/WhatObsoletes.cc | 3 +++ zypp/solver/detail/SATResolver.cc | 27 +++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/zypp/sat/WhatObsoletes.cc b/zypp/sat/WhatObsoletes.cc index 800b7e0..740e4b5 100644 --- a/zypp/sat/WhatObsoletes.cc +++ b/zypp/sat/WhatObsoletes.cc @@ -87,6 +87,9 @@ namespace zypp void WhatObsoletes::ctorAdd( Solvable item_r ) { + if ( item_r.multiversionInstall() ) + return; // multiversion (rpm -i) does not evaluate any obsoletes + if ( obsoleteUsesProvides ) { WhatProvides obsoleted( item_r.obsoletes() ); diff --git a/zypp/solver/detail/SATResolver.cc b/zypp/solver/detail/SATResolver.cc index 909c2e4..c9e4553 100644 --- a/zypp/solver/detail/SATResolver.cc +++ b/zypp/solver/detail/SATResolver.cc @@ -368,19 +368,26 @@ class CheckIfUpdate : public resfilter::PoolItemFilterFunctor { public: bool is_updated; + bool multiversion; + sat::Solvable _installed; - CheckIfUpdate() + CheckIfUpdate( sat::Solvable installed_r ) : is_updated( false ) + , multiversion( installed_r.multiversionInstall() ) + , _installed( installed_r ) {} - // check this item will be installed + // check this item will be updated bool operator()( PoolItem item ) { - if (item.status().isToBeInstalled()) - { - is_updated = true; - return false; + if ( item.status().isToBeInstalled() ) + { + if ( ! multiversion || sameNVRA( _installed, item ) ) + { + is_updated = true; + return false; + } } return true; } @@ -459,9 +466,9 @@ SATResolver::solving(const CapabilitySet & requires_caps, if (_solv->decisionmap[it->id()] > 0) continue; - PoolItem poolItem( *it ); // Check if this is an update - CheckIfUpdate info; + CheckIfUpdate info( *it ); + PoolItem poolItem( *it ); invokeOnEach( _pool.byIdentBegin( poolItem ), _pool.byIdentEnd( poolItem ), resfilter::ByUninstalled(), // ByUninstalled @@ -832,10 +839,10 @@ void SATResolver::doUpdate() if (_solv->decisionmap[i] > 0) continue; - PoolItem poolItem = _pool.find (sat::Solvable(i)); + PoolItem poolItem( _pool.find( sat::Solvable(i) ) ); if (poolItem) { // Check if this is an update - CheckIfUpdate info; + CheckIfUpdate info( (sat::Solvable(i)) ); invokeOnEach( _pool.byIdentBegin( poolItem ), _pool.byIdentEnd( poolItem ), resfilter::ByUninstalled(), // ByUninstalled -- 2.7.4