Imported Upstream version 17.8.0
[platform/upstream/libzypp.git] / zypp / Resolver.h
index 74db641..3225eb1 100644 (file)
 #include "zypp/base/PtrTypes.h"
 
 #include "zypp/ResPool.h"
-#include "zypp/solver/detail/Resolver.h"
-#include "zypp/solver/detail/SolverQueueItem.h"
+#include "zypp/PoolItem.h"
+#include "zypp/Capabilities.h"
+#include "zypp/Capability.h"
+#include "zypp/ResolverNamespace.h"
+
+#include "zypp/solver/detail/Types.h"
+
 #include "zypp/ProblemTypes.h"
+#include "zypp/ResolverProblem.h"
+#include "zypp/ProblemSolution.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
+  namespace sat
+  {
+    class Transaction;
+  }
 
   ///////////////////////////////////////////////////////////////////
   //
@@ -109,12 +120,15 @@ namespace zypp
 
 
     /**
-     * Do an distribution upgrade
+     * Do an distribution upgrade (DUP)
      *
      * 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.
      *
      * \see \ref addUpgradeRepo
      **/
@@ -154,6 +168,10 @@ 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
@@ -161,14 +179,23 @@ namespace zypp
      * This behaviour is favourited by ZMD.
      **/
     void setForceResolve( bool force );
-    bool forceResolve();
+    bool forceResolve() const;
 
     /**
      * Ignore recommended packages that were already recommended by
      * the installed packages
      **/
     void setIgnoreAlreadyRecommended( bool yesno_r );
-    bool ignoreAlreadyRecommended();
+    bool ignoreAlreadyRecommended() const;
+
+    /**
+     * Weak form of \ref ignoreAlreadyRecommended \c =false.
+     * Try to re-evaluate recommendations for specific namespaces only.
+     * \note May not support all namespaces.
+     */
+    void setInr( ResolverNamespaces namespaces_r );
+    void resetInr();
+    ResolverNamespaces inr() const;
 
     /**
      * Setting whether required packages are installed ONLY
@@ -177,24 +204,51 @@ namespace zypp
      **/
     void setOnlyRequires( bool yesno_r );
     void resetOnlyRequires(); // set back to default (described in zypp.conf)
-    bool onlyRequires();
+    bool onlyRequires() const;
 
     /**
-     * Whether the \ref Resolver is in upgrade mode.
+     * 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.
-     *
+     * Setting whether the solver should perform in 'update' mode or
+     * not. If on, it will add a resolver job to update all packages.
+     * \see \ref doUpdate.
+     */
+    void setUpdateMode( bool yesno_r );
+    bool updateMode() const;
+
+
+    /** \name  Solver flags (non DUP modes)
+     * Default for all flags is \c false unless overwritten by zypp.conf.
+     */
+    //@{
+    /** Whether to allow to downgrade installed solvable */
+    void setAllowDowngrade( bool yesno_r );
+    void setDefaultAllowDowngrade();   // Set back to default
+    bool allowDowngrade() const;
+
+    /** Whether to allow to change name of installed solvable */
+    void setAllowNameChange( bool yesno_r );
+    void setDefaultAllowNameChange();  // Set back to default
+    bool allowNameChange() const;
+
+    /** Whether to allow to change architecture of installed solvables */
+    void setAllowArchChange( bool yesno_r );
+    void setDefaultAllowArchChange();  // Set back to default
+    bool allowArchChange() const;
+
+    /**  Whether to allow to change vendor of installed solvables
      * \see \ref VendorAttr for definition of vendor equivalence.
-     **/
+     */
     void setAllowVendorChange( bool yesno_r );
-    void setDefaultAllowVendorChange(); // set back to default (in zypp.conf)
+    void setDefaultAllowVendorChange();        // Set back to default
     bool allowVendorChange() const;
+    //@}
 
     /**
      * System verification mode also monitors and repairs dependencies
@@ -218,6 +272,40 @@ namespace zypp
     void setDefaultSolveSrcPackages();
     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  Solver flags for DUP mode.
+     * DUP mode default settings differ from 'ordinary' ones. Default for
+     * all DUP flags is \c true unless overwritten by zypp.conf.
+     */
+    //@{
+    /** dup mode: allow to downgrade installed solvable */
+    void dupSetAllowDowngrade( bool yesno_r );
+    void dupSetDefaultAllowDowngrade();                // Set back to default (in zypp.conf)
+    bool dupAllowDowngrade() const;
+
+    /** dup mode: allow to change name of installed solvable */
+    void dupSetAllowNameChange( bool yesno_r );
+    void dupSetDefaultAllowNameChange();       // Set back to default (in zypp.conf)
+    bool dupAllowNameChange() const;
+
+    /** dup mode: allow to change architecture of installed solvables */
+    void dupSetAllowArchChange( bool yesno_r );
+    void dupSetDefaultAllowArchChange();       // Set back to default (in zypp.conf)
+    bool dupAllowArchChange() const;
+
+    /**  dup mode: allow to change vendor of installed solvables*/
+    void dupSetAllowVendorChange( bool yesno_r );
+    void dupSetDefaultAllowVendorChange();     // Set back to default (in zypp.conf)
+    bool dupAllowVendorChange() 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.
@@ -232,6 +320,11 @@ namespace zypp
     void addUpgradeRepo( Repository repo_r );
 
     /**
+     * Whether there is at least one \c UpgradeRepo request pending
+     */
+    bool upgradingRepos() const;
+
+    /**
      * Whether there is an \c UpgradeRepo request pending for this repo.
      */
     bool upgradingRepo( Repository repo_r ) const;
@@ -275,13 +368,13 @@ namespace zypp
      * Get all the additional requirements set by \ref addRequire(Capability).
      *
      */
-    CapabilitySet getRequire();
+    CapabilitySet getRequire() const;
 
     /**
      * Get all the additional conflicts set by \ref addConflict(Capability).
      *
      */
-    CapabilitySet getConflict();
+    CapabilitySet getConflict() const;
 
     /**
      * Generates a solver Testcase of the current state
@@ -357,12 +450,15 @@ namespace zypp
     solver::detail::ItemCapKindList installedSatisfied( const PoolItem & item );
 
 
-
   private:
-    solver::detail::Resolver_Ptr _pimpl;
+    friend std::ostream & operator<<( std::ostream & str, const Resolver & obj );
+    zypp::RW_pointer<solver::detail::ResolverInternal> _pimpl;
   };
   ///////////////////////////////////////////////////////////////////
 
+  /** \relates Resolver Stream output */
+  std::ostream & operator<<( std::ostream & str, const Resolver & obj );
+
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////