setting SAT-solver flags for update and verify
authorStefan Schubert <schubi@suse.de>
Thu, 24 Jan 2008 16:20:26 +0000 (16:20 +0000)
committerStefan Schubert <schubi@suse.de>
Thu, 24 Jan 2008 16:20:26 +0000 (16:20 +0000)
zypp/sat/SATResolver.cc
zypp/sat/SATResolver.h
zypp/solver/detail/Resolver.cc
zypp/solver/detail/Resolver.h

index 3c93cfa579de58b6912225d83cf17ae935723201..4a5651011f96bd53b7cbe451d2e984df35edd90c 100644 (file)
@@ -436,11 +436,6 @@ SATResolver::resolvePool(const CapabilitySet & requires_caps,
     _solv = solver_create( _SATPool, sat::Pool::instance().systemRepo().get() );
     sat::Pool::instance().setDirty();
     sat::Pool::instance().prepare();
-    _solv->fixsystem = false;
-    _solv->updatesystem = false;
-    _solv->allowdowngrade = false;
-    _solv->allowuninstall = false;
-    _solv->noupdateprovide = false;
 
     // Solve !
     MIL << "Starting solving...." << endl;
index f3cadd4386d0e7988fd9378ae0a21bd207187637..ecacb0dc0e50655f6f0e39bf0eae33f99e40aca8 100644 (file)
@@ -64,7 +64,6 @@ class SATResolver : public base::ReferenceCounted, private base::NonCopyable {
     Solver *_solv;
     Queue _jobQueue;
 
-
     // list populated by calls to addPoolItemTo*()
     PoolItemList _items_to_install;
     PoolItemList _items_to_remove;
index 106c8d1bb9d849b4b68fd0544e981dfc85133cdd..e57b44bf449d885090d37adba909ed0dd2c91920 100644 (file)
@@ -64,10 +64,12 @@ Resolver::dumpOn( std::ostream & os ) const
 //---------------------------------------------------------------------------
 
 Resolver::Resolver (const ResPool & pool)
-    : _pool (pool)
-    , _satResolver (NULL)
-    , _poolchanged( _pool.serial() )
-    , _forceResolve (false)
+    : _pool(pool)
+    , _satResolver(NULL)
+    , _poolchanged(_pool.serial() )
+    , _forceResolve(false)
+    , _upgradeMode(false)
+    , _verifying(false)
 
 {
 
@@ -89,7 +91,7 @@ Resolver::pool (void) const
 void
 Resolver::reset (bool keepExtras )
 {
-    _items_to_verify.clear();
+    _verifying = false;    
 
     if (!keepExtras) {
       _extra_requires.clear();
@@ -97,15 +99,6 @@ Resolver::reset (bool keepExtras )
     }
 }
 
-
-void
-Resolver::addPoolItemToVerify (PoolItem_Ref item)
-{
-
-    _items_to_verify.push_back (item);
-}
-
-
 void
 Resolver::addExtraRequire (const Capability & capability)
 {
@@ -201,55 +194,20 @@ struct DoTransact : public resfilter::PoolItemFilterFunctor
 };
 
 
-struct VerifySystem : public resfilter::PoolItemFilterFunctor
-{
-    Resolver & resolver;
-
-    VerifySystem (Resolver & r)
-       : resolver (r)
-    { }
-
-    bool operator()( PoolItem_Ref provider )
-    {
-       resolver.addPoolItemToVerify (provider);
-       return true;
-    }
-};
-
 bool
 Resolver::verifySystem ()
 {
     UndoTransact resetting (ResStatus::APPL_HIGH);
 
     _DEBUG ("Resolver::verifySystem() ");
+    
+    _verifying = true;    
 
     invokeOnEach ( _pool.begin(), _pool.end(),
                   resfilter::ByTransact( ),                    // Resetting all transcations
                   functor::functorRef<bool,PoolItem>(resetting) );
 
-    VerifySystem info (*this);
-
-    invokeOnEach( pool().byKindBegin( ResTraits<Package>::kind ),
-                 pool().byKindEnd( ResTraits<Package>::kind ),
-                 resfilter::ByInstalled ( ),
-                 functor::functorRef<bool,PoolItem>(info) );
-
-    invokeOnEach( pool().byKindBegin( ResTraits<Pattern>::kind ),
-                 pool().byKindEnd( ResTraits<Pattern>::kind ),
-                 resfilter::ByInstalled ( ),
-                 functor::functorRef<bool,PoolItem>(info) );
-
-// FIXME setting verify mode
-#if 0    
-    bool success = resolveDependencies (); // do solve only
-
-    DoTransact setting (ResStatus::APPL_HIGH);
-
-    invokeOnEach ( _pool.begin(), _pool.end(),
-                  resfilter::ByTransact( ),
-                  functor::functorRef<bool,PoolItem>(setting) );
-#endif
-    return true; // FIXME success
+    return resolvePool();
 }
 
 
@@ -304,6 +262,29 @@ Resolver::resolvePool()
        }
        MIL << "------SAT-Pool end------" << endl;
 #endif
+       _satResolver->setFixsystem(false);
+       _satResolver->setAllowdowngrade(false);
+       _satResolver->setAllowarchchange(false);
+       _satResolver->setAllowvendorchange(false);
+       _satResolver->setAllowuninstall(false);
+       _satResolver->setUpdatesystem(false);
+       _satResolver->setAllowvirtualconflicts(false);
+       _satResolver->setNoupdateprovide(true);
+       _satResolver->setDosplitprovides(false);
+       
+       if (_upgradeMode) {
+           _satResolver->setAllowdowngrade(true);
+           _satResolver->setAllowarchchange(true);
+           _satResolver->setUpdatesystem(true);
+           _satResolver->setDosplitprovides(true);   
+       }
+
+       if (_forceResolve)
+           _satResolver->setAllowuninstall(true);
+
+       if (_verifying)
+           _satResolver->setFixsystem(true);
+       
        return _satResolver->resolvePool(_extra_requires, _extra_conflicts);
 }
 
index 9a0014a5e9cdd5316da30ed492e6b75e56af4259..8cddf19c77102aba8ee25cc5b3cd1530721f55ff 100644 (file)
@@ -68,9 +68,6 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
     SerialNumberWatcher _poolchanged;
     bool _testing;
 
-    // list populated by calls to addPoolItemTo*()
-    PoolItemList _items_to_verify;
-
     // list of problematic items after doUpgrade()
     PoolItemList _update_items;
 
@@ -99,7 +96,7 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
                         // have unfulfilled requirements.
                         // This behaviour is favourited by ZMD
     bool _upgradeMode;  // Resolver has been called with doUpgrade
-                                //if there are more solver results.
+    bool _verifying;    // The system will be checked
 
     // helpers
     bool doesObsoleteCapability (PoolItem_Ref candidate, const Capability & cap);
@@ -122,8 +119,6 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
     ResPool pool (void) const;
     void setPool (const ResPool & pool) { _pool = pool; }
 
-    void addPoolItemToVerify (PoolItem_Ref item);
-
     void addExtraRequire (const Capability & capability);
     void removeExtraRequire (const Capability & capability);
     void addExtraConflict (const Capability & capability);