Imported Upstream version 15.0.0
[platform/upstream/libzypp.git] / zypp / Resolver.h
index 01e94d0..3ba8fdd 100644 (file)
@@ -19,7 +19,6 @@
 #include "zypp/base/PtrTypes.h"
 
 #include "zypp/ResPool.h"
-#include "zypp/UpgradeStatistics.h"
 #include "zypp/solver/detail/Resolver.h"
 #include "zypp/solver/detail/SolverQueueItem.h"
 #include "zypp/ProblemTypes.h"
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
+  namespace sat
+  {
+    class Transaction;
+  }
 
   ///////////////////////////////////////////////////////////////////
   //
@@ -58,7 +61,7 @@ namespace zypp
      *
      * Call \ref setSystemVerification to turn of this mode.
      **/
-    bool verifySystem ();
+    bool verifySystem();
 
 
     /**
@@ -75,7 +78,7 @@ namespace zypp
      * the latter case, use problems() and later applySolutions()
      * below.
      **/
-    bool resolvePool (void);
+    bool resolvePool();
 
 
     /**
@@ -95,35 +98,34 @@ namespace zypp
      * to e.g. the selectables.
      *
      **/
-    bool resolveQueue (solver::detail::SolverQueueItemList & queue);
+    bool resolveQueue( solver::detail::SolverQueueItemList & queue );
 
     /*
      * Undo solver changes done in resolvePool()
      * Throwing away all ignored dependencies.
      */
-    void undo( void );
+    void undo();
 
     /*
      * Resets solver information and verify option.
      */
-    void reset( void );
+    void reset();
 
 
     /**
      * Do an distribution upgrade
      *
-     * This will run a full upgrade on the pool, taking all upgrade
-     * dependencies (provide/obsolete for package renames, split-
-     * provides, etc.) into account and actually removing installed
-     * packages if no upgrade exists AND the package dependency is
-     * broken
+     * Perform a distribution upgrade. This performs an update of
+     * all packages with a special resolver algorithm which takes
+     * care of package splits, pattern  and  product  updates,
+     * etc.
+     * This call also turns the solver into \ref upgradeMode, so
+     * consecutive calls to \ref resolvePool performed in this
+     * mode too. Call \ref setUpgradeMode to turn this mode off.
      *
-     * To be run with great caution. It basically brings your
-     * system 'back to start'.
-     * Quite helpful to get back to a 'sane state'. Quite disastrous
-     * since you'll loose all non-distribution packages
+     * \see \ref addUpgradeRepo
      **/
-    bool doUpgrade( UpgradeStatistics & opt_stats_r );
+    bool doUpgrade();
 
     /**
      * Update to newest package
@@ -136,7 +138,6 @@ namespace zypp
      **/
     void doUpdate( );
 
-
     /**
      * Unmaintained packages which does not fit to
      * the updated system (broken dependencies) will be
@@ -144,7 +145,7 @@ namespace zypp
      * Return the list of deleted items.
      * Note : This list is valid after the call doUpgrade() only.
      **/
-    std::list<PoolItem> problematicUpdateItems( void ) const;
+    std::list<PoolItem> problematicUpdateItems() const;
 
     /**
      * Return the dependency problems found by the last call to
@@ -160,30 +161,54 @@ namespace zypp
      **/
     void applySolutions( const ProblemSolutionList & solutions );
 
+    /**
+     * Return the \ref Transaction computed by the last solver run.
+     */
+    sat::Transaction getTransaction();
 
     /**
      * Remove resolvables which are conflicts with others or
      * have unfulfilled requirements.
      * This behaviour is favourited by ZMD.
      **/
-    void setForceResolve (const bool force);
-    bool forceResolve();
+    void setForceResolve( bool force );
+    bool forceResolve() const;
 
     /**
      * Ignore recommended packages that were already recommended by
      * the installed packages
      **/
-    void setIgnoreAlreadyRecommended (const bool ignoreAlreadyRecommended);
-    bool ignoreAlreadyRecommended();
+    void setIgnoreAlreadyRecommended( bool yesno_r );
+    bool ignoreAlreadyRecommended() const;
 
     /**
      * Setting whether required packages are installed ONLY
      * So recommended packages, language packages and packages which depend
      * on hardware (modalias) will not be regarded.
      **/
-    void setOnlyRequires (const bool onlyRequires);
+    void setOnlyRequires( bool yesno_r );
     void resetOnlyRequires(); // set back to default (described in zypp.conf)
-    bool onlyRequires();
+    bool onlyRequires() const;
+
+    /**
+     * Setting whether the solver should perform in 'upgrade' mode or
+     * not.
+     * \see \ref doUpgrade.
+     */
+    void setUpgradeMode( bool yesno_r );
+    bool upgradeMode() const;
+
+    /**
+     * Setting whether the solver should allow or disallow vendor changes.
+     *
+     * If OFF (the default) the solver will replace packages with packages
+     * of the same (or equivalent) vendor ony.
+     *
+     * \see \ref VendorAttr for definition of vendor equivalence.
+     **/
+    void setAllowVendorChange( bool yesno_r );
+    void setDefaultAllowVendorChange(); // set back to default (in zypp.conf)
+    bool allowVendorChange() const;
 
     /**
      * System verification mode also monitors and repairs dependencies
@@ -208,40 +233,77 @@ namespace zypp
     bool solveSrcPackages() const;
 
     /**
+     * Cleanup when deleting packages. Whether the solver should per default
+     * try to remove packages exclusively required by the ones he's asked to delete.
+     */
+    void setCleandepsOnRemove( bool yesno_r );
+    void setDefaultCleandepsOnRemove(); // set back to default (in zypp.conf)
+    bool cleandepsOnRemove() const;
+
+    /** \name Upgrade to content of a specific repository.
+     * \note This is an ordinary solver request. You should simply
+     * \ref resolvePool to execute, and not \ref doUpgrade.
+     */
+    //@{
+    /**
+     * Adding request to perform a dist upgrade restricted to this repository.
+     *
+     * This is what e.g. <tt>zypper dup --repo myrepo</tt> should perform.
+     * \see \ref doUpgrade
+     */
+    void addUpgradeRepo( Repository repo_r );
+
+    /**
+     * Whether there is an \c UpgradeRepo request pending for this repo.
+     */
+    bool upgradingRepo( Repository repo_r ) const;
+
+    /**
+     * Remove an upgrade request for this repo.
+     */
+    void removeUpgradeRepo( Repository repo_r );
+
+    /**
+     * Remove all upgrade repo requests.
+     */
+    void removeUpgradeRepos();
+    //@}
+
+    /**
      * Adding additional requirement
      *
      */
-    void addRequire (const Capability & capability);
+    void addRequire( const Capability & capability );
 
     /**
      * Adding additional conflict
      *
      */
-    void addConflict (const Capability & capability);
+    void addConflict( const Capability & capability );
 
     /**
      * Remove the additional requirement set by \ref addRequire(Capability).
      *
      */
-    void removeRequire (const Capability & capability);
+    void removeRequire( const Capability & capability );
 
     /**
      * Remove the additional conflict set by \ref addConflict(Capability).
      *
      */
-    void removeConflict (const Capability & capability);
+    void removeConflict( const Capability & capability );
 
     /**
      * Get all the additional requirements set by \ref addRequire(Capability).
      *
      */
-    const CapabilitySet getRequire ();
+    CapabilitySet getRequire() const;
 
     /**
      * Get all the additional conflicts set by \ref addConflict(Capability).
      *
      */
-    const CapabilitySet getConflict();
+    CapabilitySet getConflict() const;
 
     /**
      * Generates a solver Testcase of the current state
@@ -249,7 +311,7 @@ namespace zypp
      * \parame dumpPath destination directory of the created directory
      * \return true if it was successful
      */
-    bool createSolverTestcase (const std::string & dumpPath = "/var/log/YaST2/solverTestcase");
+    bool createSolverTestcase( const std::string & dumpPath = "/var/log/YaST2/solverTestcase", bool runSolver = true );
 
     /**
      * Gives information about WHO has pused an installation of an given item.
@@ -265,7 +327,7 @@ namespace zypp
      * 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 item);
+    solver::detail::ItemCapKindList isInstalledBy( const PoolItem & item );
 
     /**
      * Gives information about WHICH additional items will be installed due the installation of an item.
@@ -281,7 +343,7 @@ namespace zypp
      * 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 item);
+    solver::detail::ItemCapKindList installs( const PoolItem & item );
 
     /**
      * Gives information about WHICH installed items are requested by the installation of an item.
@@ -292,12 +354,12 @@ namespace zypp
      *          initialInstallation This item has triggered the installation
      *                             Not already fullfilled requierement only.
      *         cap                 Capability which has triggerd this installation
-     *         capKind             Kind of that capability (e.g.  Dep::REQUIRES,Dep::RECOMMENDS,... )     
+     *         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 satifiedByInstalled(const PoolItem item);
+    solver::detail::ItemCapKindList satifiedByInstalled( const PoolItem & item );
 
 
     /**
@@ -309,20 +371,25 @@ namespace zypp
      *          initialInstallation This item has triggered the installation
      *                             Not already fullfilled requierement only.
      *         cap                 Capability which has triggerd this installation
-     *         capKind             Kind of that capability (e.g.  Dep::REQUIRES,Dep::RECOMMENDS,... )     
+     *         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 installedSatisfied(const PoolItem item);
-
+    solver::detail::ItemCapKindList installedSatisfied( const PoolItem & item );
 
 
   private:
-    solver::detail::Resolver_Ptr _pimpl;
+    friend std::ostream & operator<<( std::ostream & str, const Resolver & obj );
+
+    typedef solver::detail::Resolver Impl;
+    zypp::RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
   };
   ///////////////////////////////////////////////////////////////////
 
+  /** \relates Resolver Stream output */
+  std::ostream & operator<<( std::ostream & str, const Resolver & obj );
+
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////