From 3c650323451ece5f1d95e31da67c5bc5d6d2f41c Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Tue, 29 Apr 2008 14:37:09 +0000 Subject: [PATCH] cleanup in return values of doUpgrade and doUpdate --- VERSION.cmake | 4 ++-- zypp/Resolver.cc | 4 ++-- zypp/Resolver.h | 2 +- zypp/solver/detail/Resolver.cc | 17 ++++++++--------- zypp/solver/detail/Resolver.h | 7 ++++--- zypp/solver/detail/ResolverUpgrade.cc | 9 +++++---- zypp/solver/detail/SATResolver.cc | 3 +-- zypp/solver/detail/SATResolver.h | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/VERSION.cmake b/VERSION.cmake index 66621a14f..a49861255 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -45,6 +45,6 @@ # SET(LIBZYPP_MAJOR "4") -SET(LIBZYPP_MINOR "16") -SET(LIBZYPP_COMPATMINOR "14") +SET(LIBZYPP_MINOR "17") +SET(LIBZYPP_COMPATMINOR "17") SET(LIBZYPP_PATCH "0") diff --git a/zypp/Resolver.cc b/zypp/Resolver.cc index 1235cac77..51404534c 100644 --- a/zypp/Resolver.cc +++ b/zypp/Resolver.cc @@ -72,8 +72,8 @@ namespace zypp { return _pimpl->problems (); } void Resolver::applySolutions( const ProblemSolutionList & solutions ) { _pimpl->applySolutions (solutions); } - void Resolver::doUpgrade( UpgradeStatistics & opt_stats_r ) - { _pimpl->doUpgrade(opt_stats_r); } + bool Resolver::doUpgrade( UpgradeStatistics & opt_stats_r ) + { return _pimpl->doUpgrade(opt_stats_r); } void Resolver::doUpdate() { _pimpl->doUpdate(); } void Resolver::setForceResolve( const bool force ) diff --git a/zypp/Resolver.h b/zypp/Resolver.h index ab39a677e..51114df35 100644 --- a/zypp/Resolver.h +++ b/zypp/Resolver.h @@ -111,7 +111,7 @@ namespace zypp * Quite helpful to get back to a 'sane state'. Quite disastrous * since you'll loose all non-distribution packages **/ - void doUpgrade( UpgradeStatistics & opt_stats_r ); + bool doUpgrade( UpgradeStatistics & opt_stats_r ); /** * Update to newest package diff --git a/zypp/solver/detail/Resolver.cc b/zypp/solver/detail/Resolver.cc index f0b5b8584..135e809ef 100644 --- a/zypp/solver/detail/Resolver.cc +++ b/zypp/solver/detail/Resolver.cc @@ -103,15 +103,10 @@ Resolver::reset (bool keepExtras ) } } -bool +void Resolver::doUpdate() { - if (_satResolver) { - return _satResolver->doUpdate(); - } else { - ERR << "SAT solver has not been initialized." << endl; - return false; - } + return _satResolver->doUpdate(); } void @@ -281,12 +276,14 @@ Resolver::resolveQueue(solver::detail::SolverQueueItemList & queue) // DESCRIPTION : Unmaintained packages which does not fit to // the updated system (broken dependencies) will be // deleted. +// returns true if solving was successful // -void Resolver::checkUnmaintainedItems () { +bool Resolver::checkUnmaintainedItems () { int solverRuns = 1; + bool solverRet = resolvePool(); MIL << "Checking unmaintained items....." << endl; - while (!resolvePool() && solverRuns++ < MAXSOLVERRUNS) { + while (!solverRet && solverRuns++ < MAXSOLVERRUNS) { ResolverProblemList problemList = problems(); ProblemSolutionList solutionList; PoolItemList problemItemList; @@ -344,6 +341,8 @@ void Resolver::checkUnmaintainedItems () { // break cause there is no other solution available by the next run solverRuns = MAXSOLVERRUNS; } + // next try + solverRet = resolvePool(); } } diff --git a/zypp/solver/detail/Resolver.h b/zypp/solver/detail/Resolver.h index adbd6267f..b9b6b3a0c 100644 --- a/zypp/solver/detail/Resolver.h +++ b/zypp/solver/detail/Resolver.h @@ -97,7 +97,8 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable { // Unmaintained packages which does not fit to the updated system // (broken dependencies) will be deleted. - void checkUnmaintainedItems (); + // returns true if solving was successful + bool checkUnmaintainedItems (); void solverInit(); @@ -137,9 +138,9 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable { bool verifySystem (); bool resolvePool(); bool resolveQueue(solver::detail::SolverQueueItemList & queue); - bool doUpdate(); + void doUpdate(); - void doUpgrade( zypp::UpgradeStatistics & opt_stats_r ); + bool doUpgrade( zypp::UpgradeStatistics & opt_stats_r ); PoolItemList problematicUpdateItems( void ) const { return _problem_items; } ResolverProblemList problems () const; diff --git a/zypp/solver/detail/ResolverUpgrade.cc b/zypp/solver/detail/ResolverUpgrade.cc index b2b17bdde..a11e65f04 100644 --- a/zypp/solver/detail/ResolverUpgrade.cc +++ b/zypp/solver/detail/ResolverUpgrade.cc @@ -200,12 +200,12 @@ bool setForInstallation (const ResPool &pool, PoolItem item) { // // // METHOD NAME : Resolver::doUpgrade -// METHOD TYPE : int +// METHOD TYPE : bool // // DESCRIPTION : go through all installed (but not yet touched by user) // packages and look for update candidates // -void +bool Resolver::doUpgrade( UpgradeStatistics & opt_stats_r ) { typedef map CandidateMap; @@ -223,7 +223,7 @@ Resolver::doUpgrade( UpgradeStatistics & opt_stats_r ) catch( const Exception & excpt_r) { ERR << "Huh, no target ?"; ZYPP_CAUGHT(excpt_r); - if (!_testing) return; // can't continue without target + if (!_testing) return false; // can't continue without target MIL << "Running in test mode, continuing without target" << endl; } MIL << "target at " << target << endl; @@ -643,7 +643,8 @@ Resolver::doUpgrade( UpgradeStatistics & opt_stats_r ) // Unmaintained packages which does not fit to the updated system // (broken dependencies) will be deleted. - checkUnmaintainedItems (); + // Make a solverrun and return it to the calling function + return checkUnmaintainedItems (); } diff --git a/zypp/solver/detail/SATResolver.cc b/zypp/solver/detail/SATResolver.cc index 7b928aa51..8a3750c01 100644 --- a/zypp/solver/detail/SATResolver.cc +++ b/zypp/solver/detail/SATResolver.cc @@ -741,7 +741,7 @@ SATResolver::resolveQueue(const SolverQueueItemList &requestQueue, } -bool SATResolver::doUpdate() +void SATResolver::doUpdate() { MIL << "SATResolver::doUpdate()" << endl; @@ -812,7 +812,6 @@ bool SATResolver::doUpdate() solverEnd(); MIL << "SATResolver::doUpdate() done" << endl; - return true; } diff --git a/zypp/solver/detail/SATResolver.h b/zypp/solver/detail/SATResolver.h index 6494d7c36..269b27a0e 100644 --- a/zypp/solver/detail/SATResolver.h +++ b/zypp/solver/detail/SATResolver.h @@ -116,7 +116,7 @@ class SATResolver : public base::ReferenceCounted, private base::NonCopyable { bool resolveQueue(const SolverQueueItemList &requestQueue, const PoolItemList & weakItems); // searching for new packages - bool doUpdate(); + void doUpdate(); ResolverProblemList problems (); void applySolutions (const ProblemSolutionList &solutions); -- 2.34.1