remove old solver
authorStefan Schubert <schubi@suse.de>
Wed, 23 Jan 2008 10:23:15 +0000 (10:23 +0000)
committerStefan Schubert <schubi@suse.de>
Wed, 23 Jan 2008 10:23:15 +0000 (10:23 +0000)
zypp/CMakeLists.txt
zypp/Resolver.cc
zypp/Resolver.h
zypp/solver/detail/Resolver.cc
zypp/solver/detail/Resolver.h
zypp/solver/detail/SolutionAction.cc
zypp/solver/detail/Testcase.cc
zypp/solver/detail/Testcase.h

index 62a109b..41dad2e 100644 (file)
@@ -501,81 +501,33 @@ INSTALL(  FILES
 
 SET( zypp_solver_detail_SRCS
   solver/detail/Helper.cc
-  solver/detail/Importance.cc
-  solver/detail/InstallOrder.cc
-  solver/detail/Pending.cc
+#  solver/detail/InstallOrder.cc
   solver/detail/ProblemSolutionIgnore.cc
   solver/detail/ProblemSolutionInstall.cc
   solver/detail/ProblemSolutionKeep.cc
   solver/detail/ProblemSolutionUninstall.cc
   solver/detail/ProblemSolutionUnlock.cc
-  solver/detail/ProblemSolutionAllBranches.cc
-  solver/detail/ProblemSolutionDoubleTimeout.cc
   solver/detail/ProblemSolutionCombi.cc
-  solver/detail/QueueItem.cc
-  solver/detail/QueueItemBranch.cc
-  solver/detail/QueueItemConflict.cc
-  solver/detail/QueueItemEstablish.cc
-  solver/detail/QueueItemGroup.cc
-  solver/detail/QueueItemInstall.cc
-  solver/detail/QueueItemRequire.cc
-  solver/detail/QueueItemUninstall.cc
   solver/detail/Resolver.cc
-  solver/detail/ResolverContext.cc
-  solver/detail/ResolverInfo.cc
-  solver/detail/ResolverInfoChildOf.cc
-  solver/detail/ResolverInfoConflictsWith.cc
-  solver/detail/ResolverInfoContainer.cc
-  solver/detail/ResolverInfoDependsOn.cc
-  solver/detail/ResolverInfoMisc.cc
-  solver/detail/ResolverInfoMissingReq.cc
-  solver/detail/ResolverInfoNeededBy.cc
-  solver/detail/ResolverInfoObsoletes.cc
-  solver/detail/ResolverQueue.cc
-  solver/detail/ResolverUpgrade.cc
+#  solver/detail/ResolverUpgrade.cc
   solver/detail/Resolver_problems.cc
   solver/detail/SolutionAction.cc
   solver/detail/Testcase.cc
-  solver/detail/ContextPool.cc
 )
 
 SET( zypp_solver_detail_HEADERS
   solver/detail/Helper.h
-  solver/detail/Importance.h
-  solver/detail/InstallOrder.h
-  solver/detail/Pending.h
+#  solver/detail/InstallOrder.h
   solver/detail/ProblemSolutionIgnore.h
   solver/detail/ProblemSolutionInstall.h
   solver/detail/ProblemSolutionKeep.h
   solver/detail/ProblemSolutionUninstall.h
   solver/detail/ProblemSolutionUnlock.h
-  solver/detail/ProblemSolutionAllBranches.h
-  solver/detail/ProblemSolutionDoubleTimeout.h
   solver/detail/ProblemSolutionCombi.h
-  solver/detail/QueueItem.h
-  solver/detail/QueueItemBranch.h
-  solver/detail/QueueItemConflict.h
-  solver/detail/QueueItemEstablish.h
-  solver/detail/QueueItemGroup.h
-  solver/detail/QueueItemInstall.h
-  solver/detail/QueueItemRequire.h
-  solver/detail/QueueItemUninstall.h
   solver/detail/Resolver.h
-  solver/detail/ResolverContext.h
-  solver/detail/ResolverInfo.h
-  solver/detail/ResolverInfoChildOf.h
-  solver/detail/ResolverInfoConflictsWith.h
-  solver/detail/ResolverInfoContainer.h
-  solver/detail/ResolverInfoDependsOn.h
-  solver/detail/ResolverInfoMisc.h
-  solver/detail/ResolverInfoMissingReq.h
-  solver/detail/ResolverInfoNeededBy.h
-  solver/detail/ResolverInfoObsoletes.h
-  solver/detail/ResolverQueue.h
   solver/detail/SolutionAction.h
   solver/detail/Testcase.h
   solver/detail/Types.h
-  solver/detail/ContextPool.h
 )
 
 INSTALL(  FILES
@@ -927,7 +879,7 @@ ${zypp_target_rpm_SRCS}
 ${zypp_target_hal_SRCS}
 ${zypp_target_modalias_SRCS}
 ${zypp_target_SRCS}
-#${zypp_solver_detail_SRCS}
+${zypp_solver_detail_SRCS}
 ${zypp_ui_SRCS}
 ${zypp_thread_SRCS}
 ${zypp_SRCS}
index 5105732..6b721c4 100644 (file)
@@ -57,78 +57,39 @@ namespace zypp
   //
   ///////////////////////////////////////////////////////////////////
   bool Resolver::verifySystem ()
-  { return _pimpl->verifySystem(false); }
-  bool Resolver::verifySystem (bool considerNewHardware)
-  { return _pimpl->verifySystem(considerNewHardware); }
-  bool Resolver::establishPool ()
-  { return _pimpl->establishPool(); }
-  bool Resolver::freshenPool ()
-  { return _pimpl->freshenPool(); }
+  { return _pimpl->verifySystem(); }
   bool Resolver::resolvePool ()
-  { return _pimpl->resolvePool( false ); }// do not try all possibilities 
-  bool Resolver::resolvePool( bool tryAllPossibilities)
-  { return _pimpl->resolvePool( tryAllPossibilities); }
-  bool Resolver::resolveDependencies( void )
-  { return _pimpl->resolveDependencies( ); }
+  { return _pimpl->resolvePool(); }
   void Resolver::undo()
   { _pimpl->undo(); }
-  solver::detail::ResolverContext_Ptr Resolver::context (void) const
-  { return _pimpl->context(); }
   ResolverProblemList Resolver::problems ()
   { return _pimpl->problems (); }
-  std::list<std::string> Resolver::problemDescription( void ) const
-  { return _pimpl->problemDescription (); }    
   void Resolver::applySolutions( const ProblemSolutionList & solutions )
   { _pimpl->applySolutions (solutions); }      
   void Resolver::doUpgrade( UpgradeStatistics & opt_stats_r )
   { _pimpl->doUpgrade(opt_stats_r); }
-  Arch Resolver::architecture() const
-  { return _pimpl->architecture(); }
-  void Resolver::setArchitecture( const Arch & arch )
-  { _pimpl->setArchitecture( arch ); }
   void Resolver::setForceResolve( const bool force )
   { _pimpl->setForceResolve( force ); }
   bool Resolver::forceResolve()
   { return _pimpl->forceResolve(); }
-    void Resolver::setPreferHighestVersion( const bool highestVersion )
-  { _pimpl->setPreferHighestVersion( highestVersion ); }
-  bool Resolver::preferHighestVersion()
-  { return _pimpl->preferHighestVersion(); }
-  bool Resolver::transactResObject( ResObject::constPtr robj, bool install)
-  { return _pimpl->transactResObject( robj, install ); }
-  bool Resolver::transactResKind( Resolvable::Kind kind )
-  { return _pimpl->transactResKind( kind ); }
-  void Resolver::transactReset( ResStatus::TransactByValue causer )
-  { _pimpl->transactReset( causer ); }
+  
   void Resolver::addRequire (const Capability & capability)
-  { _pimpl->addExtraCapability( capability ); }
+  { _pimpl->addExtraRequire( capability ); }
   void Resolver::addConflict (const Capability & capability)
   { _pimpl->addExtraConflict( capability ); }
   void Resolver::removeRequire (const Capability & capability)
-  { _pimpl->removeExtraCapability( capability ); }
+  { _pimpl->removeExtraRequire( capability ); }
   void Resolver::removeConflict (const Capability & capability)
   { _pimpl->removeExtraConflict( capability ); }
-  const Capabilities Resolver::getRequire ()
-  { return _pimpl->extraCapability();}
-  const Capabilities Resolver::getConflict ()
+  const CapabilitySet Resolver::getRequire ()
+  { return _pimpl->extraRequires();}
+  const CapabilitySet Resolver::getConflict ()
   { return _pimpl->extraConflicts();}      
   std::list<PoolItem_Ref> Resolver::problematicUpdateItems( void ) const
   { return _pimpl->problematicUpdateItems(); }
-  void Resolver::setTimeout( int seconds )
-  { _pimpl->setTimeout( seconds ); }
-  void Resolver::setMaxSolverPasses (int count)
-  { _pimpl->setMaxSolverPasses( count ); }
-  int Resolver::timeout()
-  { return _pimpl->timeout(); }
-  int Resolver::maxSolverPasses()
-  { return _pimpl->maxSolverPasses(); }
   bool Resolver::createSolverTestcase (const std::string & dumpPath)
   { solver::detail::Testcase testcase (dumpPath);
     return testcase.createTestcase(*_pimpl);}
-  const solver::detail::ItemCapKindList Resolver::isInstalledBy (const PoolItem_Ref item)
-  { return _pimpl->isInstalledBy (item); }
-  const solver::detail::ItemCapKindList Resolver::installs (const PoolItem_Ref item)
-  { return _pimpl->installs (item); }
 
 
   /////////////////////////////////////////////////////////////////
index be0b39d..7aaa0c8 100644 (file)
@@ -21,7 +21,6 @@
 #include "zypp/ResPool.h"
 #include "zypp/UpgradeStatistics.h"
 #include "zypp/solver/detail/Resolver.h"
-#include "zypp/solver/detail/ResolverContext.h"
 #include "zypp/ProblemTypes.h"
 
 ///////////////////////////////////////////////////////////////////
@@ -53,46 +52,6 @@ namespace zypp
      **/
     bool verifySystem ();
 
-    /**
-     * Resolve package dependencies:
-     *
-     * Verify consistency of system
-     * considerNewHardware = install packages which depends on
-     * new hardware
-     *
-     **/
-    bool verifySystem (bool considerNewHardware);
-
-    /**
-     * Establish state of 'higher level' Resolvables in Pool
-     *
-     * Must be called when dealing with non-package resolvables,
-     * like Patches, Patterns, and Products
-     *
-     * Must be called with a 'plain' pool, e.g. no additonal
-     * transacts set.
-     *
-     * return true if it was successful
-     * return false if not (this will only happen if other
-     *   transactions are in the pool which will lead to
-     *   no solution)
-     **/
-    bool establishPool (void);
-
-    /**
-     * go through all package 'freshen' dependencies and
-     * schedule matches for installation.
-     *
-     * To be called at begin of installation and upgrade.
-     * Probably also useful after adding a new package
-     * repository.
-     *
-     * return true if it was successful
-     * return false if not (this will only happen if other
-     *   transactions are in the pool which will lead to
-     *   no solution)
-     **/
-    bool freshenPool (void);
 
     /**
      * Resolve package dependencies:
@@ -112,40 +71,12 @@ namespace zypp
      **/
     bool resolvePool (void);      
 
-    /**
-     * Resolve package dependencies:
-     *
-     * Try to execute all pending transactions (there may be more than
-     * one!).
-     * If tryAllPossibilities is false, restrict searches for matching
-     *  requirements to best architecture, highest version.
-     * If tryAllPossibilities is true, evaluate all possible matches
-     *  for a requirement.
-     *
-     * Returns "true" on success (i.e., if there were no problems that
-     * need user interaction) and "false" if there were problems.  In
-     * the latter case, use problems() and later applySolutions()
-     * below.
-     **/
-    bool resolvePool (bool tryAllPossibilities);
-      
-    bool resolveDependencies( void );
-
     /*
      * Undo solver changes done in resolvePool()
      * Throwing away all ignored dependencies.
      */
     void undo( void );
 
-    /*
-     * Get the most recent resolver context
-     *
-     * It will be NULL if resolvePool() or establishPool() was never called.
-     * Depending on the return code of the last resolvePool() call,
-     * it _either_ points to a valid or an invalid solution.
-     */
-    solver::detail::ResolverContext_Ptr context (void) const;
-
     /**
      * Do an distribution upgrade
      *
@@ -174,20 +105,13 @@ namespace zypp
      **/
     ResolverProblemList problems();
 
-    /**
-     * Return more solver information if an error has happened.
-     **/
       
-    std::list<std::string> problemDescription( void ) const;      
-
     /**
      * Apply problem solutions. No more than one solution per problem
      * can be applied.
      **/
     void applySolutions( const ProblemSolutionList & solutions );
 
-    Arch architecture() const;
-    void setArchitecture( const Arch & arch);
 
     /**      
      * Remove resolvables which are conflicts with others or
@@ -197,50 +121,6 @@ namespace zypp
     void setForceResolve (const bool force);
     bool forceResolve();
 
-    /**      
-     * Prefer the result with the newest version if there are more solver
-     * results. 
-     **/
-    void setPreferHighestVersion (const bool highestVersion);
-    bool preferHighestVersion();      
-
-    /**
-     * transact a single ResObject
-     *
-     * Installs (install == true) or removes (install == false) all required
-     * and recommended packages(!) of \c robj
-     * (More or less a 'single step' resolver call)
-     *
-     * returns false if requirements are not all fulfillable
-     * 
-     * Is obsolete; use resolvePool() instead
-     */
-    bool transactResObject( ResObject::constPtr robj, bool install = true);
-
-    /**
-     * transact all objects of this kind
-     *
-     * Look through the pool and runs transactResObject, first for removes
-     * then for installs
-     * (More or less a 'single step' resolver call)
-     *
-     * returns false if any transactResObject() call returned false.
-     *
-     * Is obsolete; use resolvePool() instead     
-     */
-    bool transactResKind( Resolvable::Kind kind );
-
-    /**
-     * reset any transact states
-     *
-     * Look through the pool and clear transact state.
-     * It will only reset states which have an equal or
-     * lower causer
-     *
-     * Is obsolete; use resolvePool() instead     
-     */
-    void transactReset( ResStatus::TransactByValue causer );
-
     /**
      * Adding additional requirement
      *
@@ -269,43 +149,13 @@ namespace zypp
      * Get all the additional requirements set by \ref addRequire(Capability).
      *
      */      
-    const Capabilities getRequire ();
+    const CapabilitySet getRequire ();
       
     /**
      * Get all the additional conflicts set by \ref addConflict(Capability).
      *
      */            
-    const Capabilities getConflict();
-
-    /**
-     * Setting solver timeout
-     *
-     * Stop solving after a given timeframe (seconds) 
-     * seconds = 0 : No timeout
-     *
-     */
-    void setTimeout( int seconds );
-
-    /**
-     * Getting solver timeout in seconds
-     *
-     */
-    int timeout();      
-
-    /**
-     * Restricting solver passes
-     *
-     * Stop solving after a given amount of passes
-     * count = 0 : No restriction
-     *
-     */
-    void setMaxSolverPasses (int count);
-
-    /**
-     * Count of max solver passes
-     *
-     */
-    int maxSolverPasses ();
+    const CapabilitySet getConflict();
 
     /**
      * Generates a solver Testcase of the current state
@@ -316,35 +166,6 @@ namespace zypp
     bool createSolverTestcase (const std::string & dumpPath = "/var/log/YaST2/solverTestcase");
 
 
-    /**
-     * Gives information about WHO has pused an installation of an given item.
-     *
-     * \param item    Evaluate additional information for this resolvable.
-     * \return A list of structures which contains:
-     *         item     Item which has triggered the installation of the given param item.
-     *         cap      Capability which has triggerd this installation
-     *         capKind  Kind of that capability (e.g.  Dep::REQUIRES,Dep::RECOMMENDS,... )
-     *
-     * Note: In order to have a result start a solver run before. Not matter if it is valid or invalid.
-     *
-     */
-    const solver::detail::ItemCapKindList isInstalledBy (const PoolItem_Ref item);
-
-    /**
-     * Gives information about WHICH additional items will be installed due the installation of an item.
-     *
-     * \param item     Evaluate additional information for this resolvable.
-     * \return A list of structures which contains:
-     *         item     Item which will be installed due to the installation of the given param item too.
-     *         cap      Capability which causes the installation
-     *         capKind  Kind of that capability (e.g.  Dep::REQUIRES,Dep::RECOMMENDS,... )
-     *
-     * Note: In order to have a result start a solver run before. Not matter if it is valid or invalid.
-     *
-     */      
-    const solver::detail::ItemCapKindList installs (const PoolItem_Ref item);
-      
-
   protected:
 
   private:
index 4e7e673..84f85aa 100644 (file)
@@ -106,13 +106,13 @@ Resolver::addPoolItemToVerify (PoolItem_Ref item)
 
 
 void
-Resolver::addExtraRequires (const Capability & capability)
+Resolver::addExtraRequire (const Capability & capability)
 {
     _extra_requires.insert (capability);
 }
 
 void
-Resolver::removeExtraRequires (const Capability & capability)
+Resolver::removeExtraRequire (const Capability & capability)
 {
     _extra_requires.erase (capability);
 }
index 02d6ea5..ed1a1ec 100644 (file)
@@ -124,8 +124,8 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
 
     void addPoolItemToVerify (PoolItem_Ref item);
 
-    void addExtraRequires (const Capability & capability);
-    void removeExtraRequires (const Capability & capability);
+    void addExtraRequire (const Capability & capability);
+    void removeExtraRequire (const Capability & capability);
     void addExtraConflict (const Capability & capability);
     void removeExtraConflict (const Capability & capability);    
 
@@ -149,6 +149,7 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
     bool resolvePool();
 
     void doUpgrade( zypp::UpgradeStatistics & opt_stats_r ) {return;}; // FIXME
+    PoolItemList problematicUpdateItems( void ) const { return _update_items; }
 
     ResolverProblemList problems () const;
     void applySolutions (const ProblemSolutionList &solutions);
index 9d40b4a..e4927a8 100644 (file)
@@ -216,7 +216,7 @@ InjectSolutionAction::execute(Resolver & resolver) const
            if (_item == PoolItem_Ref()) {
                // this was a requirement via Resolver::addExtraCapability
                // so we have to delete it.
-               resolver.removeExtraRequires (_capability);
+               resolver.removeExtraRequire (_capability);
            } else {
                resolver.addIgnoreRequires (_item, _capability);
            }
index f9d1708..2125aa3 100644 (file)
 #include "zypp/Package.h"
 #include "zypp/Edition.h"
 #include "zypp/target/store/xml_escape_parser.hpp"
-#include "zypp/capability/VersionedCap.h"
 #include "zypp/base/String.h"
 #include "zypp/base/PtrTypes.h"
+#include "zypp/Capabilities.h"
 
 
 /////////////////////////////////////////////////////////////////////////
 namespace zypp
 { ///////////////////////////////////////////////////////////////////////
+
+  namespace zypp_detail
+  { /////////////////////////////////////////////////////////////////
+    Arch defaultArchitecture();
+    /////////////////////////////////////////////////////////////////
+  } // namespace zypp_detail
+  ///////////////////////////////////////////////////////////////////
   ///////////////////////////////////////////////////////////////////////
   namespace solver
   { /////////////////////////////////////////////////////////////////////
@@ -41,7 +48,6 @@ namespace zypp
 #define TAB2 "\t\t"
        
 using namespace std;
-using namespace zypp::capability;
 using namespace zypp::str;
 
 IMPL_PTR_TYPE(HelixResolvable);        
@@ -94,27 +100,7 @@ template<>
 std::string helixXML( const Capability &cap )
 {
     stringstream str;
-    VersionedCap::constPtr vercap = asKind<VersionedCap>(cap);
-    if (vercap
-       && vercap->op() != Rel::NONE
-       && vercap->op() != Rel::ANY
-       && !vercap->edition().version().empty() )
-    {
-       // version capability
-       str << "<dep name='" << xml_escape(vercap->index()) << "' op='" << xml_escape(vercap->op().asString()) <<
-           "' version='" << vercap->edition().version() << "'";
-       if (!vercap->edition().release().empty())
-           str << " release='" << vercap->edition().release() << "'";
-       if (vercap->edition().epoch() != Edition::noepoch)
-           str << " epoch='" << numstring(vercap->edition().epoch()) << "'";
-    }
-    else
-    {
-      str << "<dep name='" << xml_escape(cap.asString()) << "'";
-    }
-    
-    str << " kind=\"" << toLower (cap.refers().asString()) << "\""
-       << " />" << endl;
+    str << "<dep name='" << xml_escape(cap.asString()) << "'  />" << endl;
        
     return str.str();    
 }
@@ -123,7 +109,7 @@ template<>
 std::string helixXML( const Capabilities &caps )
 {
     stringstream str;
-    Capabilities::iterator it = caps.begin();
+    Capabilities::const_iterator it = caps.begin();
     str << endl;
     for ( ; it != caps.end(); ++it)
     {
@@ -162,10 +148,8 @@ std::string helixXML( const PoolItem_Ref &item )
 {
   const Resolvable::constPtr resolvable = item.resolvable();
   stringstream str;
-  if ( isKind<SystemResObject>(resolvable)
-       || isKind<Language>(resolvable) ) {
-      // system resolvable will be generated by the resolver
-      // language dependencies will be written i another part
+  if ( isKind<Language>(resolvable) ) {
+      // language dependencies will be written in another part
       return str.str();
   }
   
@@ -277,8 +261,7 @@ bool Testcase::createTestcase(Resolver & resolver)
                items_to_remove.push_back (*it);
            }
            if ( it->status().isLocked()
-                && !(it->status().isBySolver())
-                && !isKind<SystemResObject>(res)) {
+                && !(it->status().isBySolver())) {
                items_locked.push_back (*it);
            }
            
@@ -289,7 +272,7 @@ bool Testcase::createTestcase(Resolver & resolver)
 
     HelixControl control (dumpPath + "/solver-test.xml",
                          repoTable,
-                         resolver.architecture(),
+                         zypp_detail::defaultArchitecture(),
                          language);
 
     for (PoolItemList::const_iterator iter = items_to_install.begin(); iter != items_to_install.end(); iter++) {
@@ -308,7 +291,7 @@ bool Testcase::createTestcase(Resolver & resolver)
        control.deleteResolvable (iter->resolvable());  
     }
 
-    control.addDependencies (resolver.extraCapability(), resolver.extraConflicts());
+    control.addDependencies (resolver.extraRequires(), resolver.extraConflicts());
 
     return true;
 }
@@ -432,15 +415,13 @@ void HelixControl::deleteResolvable(const ResObject::constPtr &resObject)
          << " name=\"" << resObject->name() << "\"" << "/>" << endl;    
 }
 
-void HelixControl::addDependencies (const Capabilities & capRequire, const Capabilities & capConflict)
+void HelixControl::addDependencies (const CapabilitySet & capRequire, const CapabilitySet & capConflict)
 {
-    for (Capabilities::const_iterator iter = capRequire.begin(); iter != capRequire.end(); iter++) {
-       *file << "<addRequire " << " kind=\"" << toLower (iter->kind().asString()) << "\""
-         << " name=\"" << iter->asString() << "\"" << "/>" << endl;    
+    for (CapabilitySet::const_iterator iter = capRequire.begin(); iter != capRequire.end(); iter++) {
+       *file << "<addRequire " <<  " name=\"" << iter->asString() << "\"" << "/>" << endl;    
     }
-    for (Capabilities::const_iterator iter = capConflict.begin(); iter != capConflict.end(); iter++) {
-       *file << "<addConflict " << " kind=\"" << toLower (iter->kind().asString()) << "\""
-         << " name=\"" << iter->asString() << "\"" << "/>" << endl;    
+    for (CapabilitySet::const_iterator iter = capConflict.begin(); iter != capConflict.end(); iter++) {
+       *file << "<addConflict " << " name=\"" << iter->asString() << "\"" << "/>" << endl;    
     }    
 }
 
index cf5d462..0830df5 100644 (file)
@@ -105,7 +105,7 @@ class  HelixControl {
     void lockResolvable (const ResObject::constPtr &resObject);
     void keepResolvable (const ResObject::constPtr &resObject);        
     void deleteResolvable (const ResObject::constPtr &resObject);
-    void addDependencies (const Capabilities &capRequire, const Capabilities &capConflict);
+    void addDependencies (const CapabilitySet &capRequire, const CapabilitySet &capConflict);
     std::string filename () { return dumpFile; }
 };