From 20a824b5fe17901f7c88d5069a05a226613648c8 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Fri, 17 Feb 2006 11:21:27 +0000 Subject: [PATCH] bugfix 150844 update SLES9 --- zypp/solver/detail/QueueItemUninstall.cc | 48 +++++++++++++++++--------------- zypp/solver/detail/Resolver.cc | 6 +++- zypp/solver/detail/Resolver.h | 1 + zypp/solver/detail/ResolverContext.cc | 17 +++++++---- zypp/solver/detail/ResolverContext.h | 8 ++++-- zypp/solver/detail/ResolverUpgrade.cc | 3 ++ 6 files changed, 52 insertions(+), 31 deletions(-) diff --git a/zypp/solver/detail/QueueItemUninstall.cc b/zypp/solver/detail/QueueItemUninstall.cc index c610488..c89d0de 100644 --- a/zypp/solver/detail/QueueItemUninstall.cc +++ b/zypp/solver/detail/QueueItemUninstall.cc @@ -336,35 +336,39 @@ QueueItemUninstall::process (ResolverContext_Ptr context, QueueItemList & qil) // we're uninstalling an installed item // loop over all its provides and check if any installed item requires // one of these provides + // We assuming that the dependencies are satified by the new updated items + // Testcase exercise-bug150844-test.xml + if (!context->upgradeMode()) + { + CapSet provides = _item->dep(Dep::PROVIDES); - CapSet provides = _item->dep(Dep::PROVIDES); - - for (CapSet::const_iterator iter = provides.begin(); iter != provides.end(); iter++) { - UninstallProcess info ( pool(), context, _item, _upgraded_to, qil, _remove_only, _soft); + for (CapSet::const_iterator iter = provides.begin(); iter != provides.end(); iter++) { + UninstallProcess info ( pool(), context, _item, _upgraded_to, qil, _remove_only, _soft); - //world()->foreachRequiringPoolItem (*iter, uninstall_process_cb, &info); - Dep dep( Dep::REQUIRES ); + //world()->foreachRequiringPoolItem (*iter, uninstall_process_cb, &info); + Dep dep( Dep::REQUIRES ); - invokeOnEach( pool().byCapabilityIndexBegin( iter->index(), dep ), - pool().byCapabilityIndexEnd( iter->index(), dep ), - resfilter::ByCapMatch( *iter ), - functor::functorRef(info) ); + invokeOnEach( pool().byCapabilityIndexBegin( iter->index(), dep ), + pool().byCapabilityIndexEnd( iter->index(), dep ), + resfilter::ByCapMatch( *iter ), + functor::functorRef(info) ); - // re-establish all which supplement or freshen the just uninstalled item + // re-establish all which supplement or freshen the just uninstalled item - EstablishItem establish( pool(), qil, _soft ); + EstablishItem establish( pool(), qil, _soft ); - dep = Dep::SUPPLEMENTS; - invokeOnEach( pool().byCapabilityIndexBegin( iter->index(), dep ), - pool().byCapabilityIndexEnd( iter->index(), dep ), - resfilter::ByCapMatch( *iter ), - functor::functorRef( establish ) ); + dep = Dep::SUPPLEMENTS; + invokeOnEach( pool().byCapabilityIndexBegin( iter->index(), dep ), + pool().byCapabilityIndexEnd( iter->index(), dep ), + resfilter::ByCapMatch( *iter ), + functor::functorRef( establish ) ); - dep = Dep::FRESHENS; - invokeOnEach( pool().byCapabilityIndexBegin( iter->index(), dep ), - pool().byCapabilityIndexEnd( iter->index(), dep ), - resfilter::ByCapMatch( *iter ), - functor::functorRef( establish ) ); + dep = Dep::FRESHENS; + invokeOnEach( pool().byCapabilityIndexBegin( iter->index(), dep ), + pool().byCapabilityIndexEnd( iter->index(), dep ), + resfilter::ByCapMatch( *iter ), + functor::functorRef( establish ) ); + } } } diff --git a/zypp/solver/detail/Resolver.cc b/zypp/solver/detail/Resolver.cc index a14a9a5..4f51f54 100644 --- a/zypp/solver/detail/Resolver.cc +++ b/zypp/solver/detail/Resolver.cc @@ -62,10 +62,12 @@ Resolver::Resolver (const ResPool & pool) : _pool (pool) , _timeout_seconds (0) , _verifying (false) + , _testing (false) , _valid_solution_count (0) , _best_context (NULL) , _timed_out (false) , _forceResolve (false) + , _upgradeMode (false) { struct utsname buf; if (uname (&buf) < 0) { @@ -385,6 +387,7 @@ Resolver::establishState (ResolverContext_Ptr context) _ignoreArchitecture, _ignoreInstalledItem); context->setForceResolve (_forceResolve); + context->setUpgradeMode (_upgradeMode); for (KindList::const_iterator iter = ordered.begin(); iter != ordered.end(); iter++) { const Resolvable::Kind kind = *iter; @@ -490,7 +493,8 @@ Resolver::resolveDependencies (const ResolverContext_Ptr context) _ignoreRequires, _ignoreArchitecture, _ignoreInstalledItem); - initial_queue->context()->setForceResolve (_forceResolve); + initial_queue->context()->setForceResolve (_forceResolve); + initial_queue->context()->setUpgradeMode (_upgradeMode); /* If this is a verify, we do a "soft resolution" */ diff --git a/zypp/solver/detail/Resolver.h b/zypp/solver/detail/Resolver.h index cc20e2f..aa66b5b 100644 --- a/zypp/solver/detail/Resolver.h +++ b/zypp/solver/detail/Resolver.h @@ -105,6 +105,7 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable { bool _forceResolve; // remove items which are conflicts with others or // have unfulfilled requirements. // This behaviour is favourited by ZMD + bool _upgradeMode; // Resolver has been called with doUpgrade // helpers bool doesObsoleteCapability (PoolItem_Ref candidate, const Capability & cap); diff --git a/zypp/solver/detail/ResolverContext.cc b/zypp/solver/detail/ResolverContext.cc index 43ce25f..78fded0 100644 --- a/zypp/solver/detail/ResolverContext.cc +++ b/zypp/solver/detail/ResolverContext.cc @@ -85,6 +85,9 @@ ResolverContext::ResolverContext (const ResPool & pool, const Arch & arch, Resol , _establishing (false) , _invalid (false) , _architecture(arch) + , _forceResolve(false) + , _upgradeMode(false) + { _XDEBUG( "ResolverContext[" << this << "]::ResolverContext(" << parent << ")" ); if (parent != NULL) { @@ -102,6 +105,7 @@ _XDEBUG( "ResolverContext[" << this << "]::ResolverContext(" << parent << ")" ); _ignoreArchitecture = parent->_ignoreArchitecture; _ignoreInstalledItem = parent->_ignoreInstalledItem; _forceResolve = parent->_forceResolve; + _upgradeMode = parent->_upgradeMode; } else { _min_priority = MAXINT; } @@ -346,12 +350,14 @@ ResolverContext::uninstall (PoolItem_Ref item, bool part_of_upgrade, bool due_to assert (! (due_to_obsolete && due_to_unlink)); status = getStatus(item); - - if ( (forceResolve() // This is the behaviour of ZMD + + if ( ( (forceResolve() // This is the behaviour of ZMD + || upgradeMode()) && (status.isToBeInstalled() // \ The resolvable will be installed || item.status().isToBeInstalled())) // / explicit. - || (!forceResolve() // This is the bahaviour of YaST + || ( (!forceResolve() // This is the bahaviour of YaST + && !upgradeMode()) && (status.staysInstalled() || status.isToBeInstalled()) // \ We will have the resolvable && (item.status().staysInstalled() || item.status().isToBeInstalled()) // / available. && !part_of_upgrade @@ -375,12 +381,11 @@ ResolverContext::uninstall (PoolItem_Ref item, bool part_of_upgrade, bool due_to ResolverInfoList addList; for (ResolverInfoList::const_iterator iter = _log.begin(); iter != _log.end(); iter++) { ResolverInfo_Ptr info = *iter; - if (info->affected() == item - && (info->type() == RESOLVER_INFO_TYPE_CONFLICT_CANT_INSTALL +// if (info->affected() == item + if (info->type() == RESOLVER_INFO_TYPE_CONFLICT_CANT_INSTALL || info->type() == RESOLVER_INFO_TYPE_NO_PROVIDER || info->type() == RESOLVER_INFO_TYPE_NO_OTHER_PROVIDER || info->type() == RESOLVER_INFO_TYPE_CANT_SATISFY) - ) { // put the info on the end as error found = true; diff --git a/zypp/solver/detail/ResolverContext.h b/zypp/solver/detail/ResolverContext.h index 886eed8..c70bfdf 100644 --- a/zypp/solver/detail/ResolverContext.h +++ b/zypp/solver/detail/ResolverContext.h @@ -93,7 +93,8 @@ class ResolverContext : public base::ReferenceCounted, private base::NonCopyable bool _forceResolve; // remove items which are conflicts with others or // have unfulfilled requirements. // This behaviour is favourited by ZMD - + bool _upgradeMode; // Resolver has been called with doUpgrade + public: ResolverContext (const ResPool & pool, const Arch & arch, ResolverContext_Ptr parent = NULL); virtual ~ResolverContext(); @@ -140,7 +141,10 @@ class ResolverContext : public base::ReferenceCounted, private base::NonCopyable const PoolItemList getIgnoreInstalledItem() const { return _ignoreInstalledItem; } void setForceResolve (const bool force) { _forceResolve = force; } - const bool forceResolve() { return _forceResolve; } + const bool forceResolve() { return _forceResolve; } + + void setUpgradeMode (const bool upgrade) { _upgradeMode = upgrade; } + const bool upgradeMode() { return _upgradeMode; } // ---------------------------------- methods diff --git a/zypp/solver/detail/ResolverUpgrade.cc b/zypp/solver/detail/ResolverUpgrade.cc index 335d76b..1ef2946 100644 --- a/zypp/solver/detail/ResolverUpgrade.cc +++ b/zypp/solver/detail/ResolverUpgrade.cc @@ -628,6 +628,9 @@ MIL << "split matched !" << endl; // done /////////////////////////////////////////////////////////////////// MIL << opt_stats_r << endl; + + // Setting Resolver to upgrade mode + _upgradeMode = true; } /////////////////////////////////////////////////////////////////// -- 2.7.4