Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / solver / detail / ProblemSolutionIgnore.cc
index 71a2972..cb44837 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  * 02111-1307, USA.
  */
+#define ZYPP_USE_RESOLVER_INTERNALS
 
 #include "zypp/base/String.h"
 #include "zypp/base/Gettext.h"
-#include "zypp/base/Logger.h"
 #include "zypp/solver/detail/ProblemSolutionIgnore.h"
-
-using namespace std;
+#include "zypp/solver/detail/SolutionAction.h"
 
 /////////////////////////////////////////////////////////////////////////
 namespace zypp
-{ ///////////////////////////////////////////////////////////////////////
+{
   ///////////////////////////////////////////////////////////////////////
   namespace solver
-  { /////////////////////////////////////////////////////////////////////
+  {
     /////////////////////////////////////////////////////////////////////
     namespace detail
-    { ///////////////////////////////////////////////////////////////////
-
-IMPL_PTR_TYPE(ProblemSolutionIgnoreConflicts);
-IMPL_PTR_TYPE(ProblemSolutionIgnoreRequires);
-IMPL_PTR_TYPE(ProblemSolutionIgnoreArch);
-IMPL_PTR_TYPE(ProblemSolutionIgnoreInstalled); 
-
-//---------------------------------------------------------------------------
-
-ProblemSolutionIgnoreRequires::ProblemSolutionIgnoreRequires( ResolverProblem_Ptr parent,
-                                                             PoolItem_Ref item,
-                                                             const Capability & capability)
-    : ProblemSolution (parent, "", "")
-{
-       _description = _("Ignore this requirement just here");
-       addAction ( new InjectSolutionAction (item, capability, REQUIRES));
-}
-
-ProblemSolutionIgnoreRequires::ProblemSolutionIgnoreRequires( ResolverProblem_Ptr parent,
-                                                             PoolItemList itemList,      
-                                                             const Capability & capability)
-    : ProblemSolution (parent, "", "")
-{
-       _description = _("Ignore this requirement generally");
-       for (PoolItemList::const_iterator iter = itemList.begin();
-            iter != itemList.end(); iter++) {
-           addAction ( new InjectSolutionAction (*iter, capability, REQUIRES));
-       }
-}
-       
-ProblemSolutionIgnoreConflicts::ProblemSolutionIgnoreConflicts( ResolverProblem_Ptr parent,
-                                                               PoolItem_Ref item,
-                                                               const Capability & capability,
-                                                               PoolItem_Ref otherItem)
-    : ProblemSolution (parent, "", "")
-{
-       // TranslatorExplanation %s = name of package, patch, selection ...
-       _description = str::form (_("Ignore this conflict of %s"),
-                                 item->name().c_str());
-       addAction (new InjectSolutionAction (item, capability, CONFLICTS, otherItem));  
-}
-
-ProblemSolutionIgnoreObsoletes::ProblemSolutionIgnoreObsoletes( ResolverProblem_Ptr parent,
-                                                               PoolItem_Ref item,
-                                                               const Capability & capability,
-                                                               PoolItem_Ref otherItem)
-    : ProblemSolution (parent, "", "")
-{
-       // TranslatorExplanation %s = name of package, patch, selection ...
-       _description = str::form (_("Ignore the obsolete %s in %s"),
-                                 ResolverInfo::toString (capability).c_str(),
-                                 otherItem->name().c_str());
-       addAction (new InjectSolutionAction (item, capability, OBSOLETES, otherItem));  
-}
-
-
-ProblemSolutionIgnoreArch::ProblemSolutionIgnoreArch( ResolverProblem_Ptr parent,
-                                                     PoolItem_Ref item )
-    : ProblemSolution (parent, "", "")
-{
-    _description = _("ignore architecture");
-    addAction ( new InjectSolutionAction (item, Capability(), ARCHITECTURE));
-}
-
-ProblemSolutionIgnoreInstalled::ProblemSolutionIgnoreInstalled( ResolverProblem_Ptr parent,
-                                                               PoolItem_Ref item,
-                                                               PoolItem_Ref otherItem)
-    : ProblemSolution (parent, "", "")
-{
-       // TranslatorExplanation %s = name of package, patch, selection ...
-       _description = str::form (_("Ignore that %s is already set to install"),
-                                 item->name().c_str());
-       addAction (new InjectSolutionAction (item, Capability(), INSTALLED, otherItem));        
-}
-       
-      ///////////////////////////////////////////////////////////////////
-    };// namespace detail
+    {
+      ProblemSolutionIgnore::ProblemSolutionIgnore( PoolItem item )
+      // TranslatorExplanation %s = name of package, patch, selection ...
+      : ProblemSolution( str::form(_("break %s by ignoring some of its dependencies"), item.satSolvable().asString().c_str() ) )
+      {
+       addAction( new InjectSolutionAction( item, WEAK ) );
+      }
+
+      ProblemSolutionIgnore::ProblemSolutionIgnore( PoolItemList itemList )
+      : ProblemSolution( _("generally ignore of some dependencies") )
+      {
+       for ( const auto & item : itemList)
+       { addAction( new InjectSolutionAction( item, WEAK ) ); }
+      }
+
+    } // namespace detail
     /////////////////////////////////////////////////////////////////////
-    /////////////////////////////////////////////////////////////////////
-  };// namespace solver
-  ///////////////////////////////////////////////////////////////////////
+  } // namespace solver
   ///////////////////////////////////////////////////////////////////////
-};// namespace zypp
+} // namespace zypp
 /////////////////////////////////////////////////////////////////////////