cleanup in return values of doUpgrade and doUpdate
authorStefan Schubert <schubi@suse.de>
Tue, 29 Apr 2008 14:37:09 +0000 (14:37 +0000)
committerStefan Schubert <schubi@suse.de>
Tue, 29 Apr 2008 14:37:09 +0000 (14:37 +0000)
VERSION.cmake
zypp/Resolver.cc
zypp/Resolver.h
zypp/solver/detail/Resolver.cc
zypp/solver/detail/Resolver.h
zypp/solver/detail/ResolverUpgrade.cc
zypp/solver/detail/SATResolver.cc
zypp/solver/detail/SATResolver.h

index 66621a1..a498612 100644 (file)
@@ -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")
index 1235cac..5140453 100644 (file)
@@ -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 )
index ab39a67..51114df 100644 (file)
@@ -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
index f0b5b85..135e809 100644 (file)
@@ -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();      
     }
 }
 
index adbd626..b9b6b3a 100644 (file)
@@ -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;
index b2b17bd..a11e65f 100644 (file)
@@ -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<PoolItem,PoolItem> 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 ();  
   
 }
 
index 7b928aa..8a3750c 100644 (file)
@@ -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;
 }
 
 
index 6494d7c..269b27a 100644 (file)
@@ -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);