taking matches of the capabilities
authorStefan Schubert <schubi@suse.de>
Mon, 9 Jan 2006 16:16:48 +0000 (16:16 +0000)
committerStefan Schubert <schubi@suse.de>
Mon, 9 Jan 2006 16:16:48 +0000 (16:16 +0000)
zypp/solver/detail/QueueItemConflict.cc
zypp/solver/detail/ResItemAndDependency.cc
zypp/solver/detail/ResItemAndDependency.h
zypp/solver/temporary/Match.cc
zypp/solver/temporary/Match.h
zypp/solver/temporary/StoreWorld.cc
zypp/solver/temporary/World.cc

index dbec017..a54f16f 100644 (file)
@@ -35,6 +35,7 @@
 #include "zypp/solver/detail/ResolverInfoObsoletes.h"
 #include "zypp/CapFactory.h"
 #include "zypp/CapSet.h"
+#include "zypp/CapMatch.h"
 #include "zypp/base/Logger.h"
 
 /////////////////////////////////////////////////////////////////////////
@@ -179,8 +180,8 @@ conflict_process_cb (ResItem_constPtr resItem, const Capability & cap, void *dat
                                           Rel::EQ,
                                           resItem->edition());
 
-    if (info->actually_an_obsolete)
-//              && !capTest.matches (cap))
+    if (info->actually_an_obsolete
+        && capTest.matches (cap) != CapMatch::yes )
     {
         return true;
     }
index 59cec4d..efc0ef9 100644 (file)
@@ -84,26 +84,12 @@ namespace zypp
 
       //---------------------------------------------------------------------------
 
-      /* This function also checks channels in addition to just dep relations */
-      /* FIXME: rc_resItem_dep_verify_relation already checks the channel */
+      /* This function checks the dep relations */
 
-      bool
+      CapMatch
       ResItemAndDependency::verifyRelation (const Capability & dep) const
       {
-#if 0
-      #if PHI
-          // don't check the channel, thereby honoring conflicts from installed resItems to to-be-installed resItems
           return dep.matches (_dependency);
-      #else
-          //if (!dep.matches (_dependency)) {
-       return false;
-          //}
-          _DBG("SPEW_DEP") << "ResItemAndDependency::verifyRelation _resItem->channel() " << _resItem->channel()->asString() << ", dep->channel()" << dep->channel()->asString() << endl;
-          return _resItem->channel()->equals (dep->channel());
-      #endif
-#else
-          return true;
-#endif
       }
 
       ///////////////////////////////////////////////////////////////////
index 332ec34..4885d18 100644 (file)
@@ -34,6 +34,7 @@
 #include "zypp/solver/detail/ResItemAndDependencyPtr.h"
 #include "zypp/solver/temporary/ResItem.h"
 #include "zypp/Capability.h"
+#include "zypp/CapMatch.h"
 
 /////////////////////////////////////////////////////////////////////////
 namespace zypp
@@ -85,7 +86,7 @@ typedef std::multimap<const std::string, ResItem_constPtr> ResItemTable;
 
           // ---------------------------------- methods
 
-          bool verifyRelation (const Capability & dep) const;
+          CapMatch verifyRelation (const Capability & dep) const;
       };
 
       ///////////////////////////////////////////////////////////////////
index d321014..f677eda 100644 (file)
@@ -130,7 +130,7 @@ Match::equals ( const Match & lock ) const {
 }
 
 
-bool
+CapMatch
 Match::test (ResItem_constPtr resItem, World_Ptr world) const
 {
     string name;
@@ -164,13 +164,12 @@ Match::test (ResItem_constPtr resItem, World_Ptr world) const
     /*   } */
     CapFactory  factory;
     Capability dependency;
-    bool check = false;
 
     dependency = factory.parse ( resItem->kind(),
                                  resItem->name(),
                                  Rel::EQ,
                                  resItem->edition());
-//          check = _dependency.matches (dependency);
+    CapMatch check = _dependency.matches (dependency);
     return check;
 }
 
index 360922d..d286428 100644 (file)
@@ -36,6 +36,7 @@
 #include "zypp/solver/temporary/ResItem.h"
 #include "zypp/solver/temporary/WorldPtr.h"
 #include "zypp/solver/temporary/XmlNode.h"
+#include "zypp/CapMatch.h"
 
 /////////////////////////////////////////////////////////////////////////
 namespace zypp
@@ -113,7 +114,7 @@ namespace zypp
           // equality
           bool equals (const Match & match) const;
 
-          bool test (ResItem_constPtr resItem, World_Ptr world) const;
+          CapMatch test (ResItem_constPtr resItem, World_Ptr world) const;
       };
 
       ///////////////////////////////////////////////////////////////////
index f082512..384e3b2 100644 (file)
@@ -28,6 +28,7 @@
 #include "zypp/Arch.h"
 #include "zypp/CapSet.h"
 #include "zypp/base/Logger.h"
+#include "zypp/CapMatch.h"
 
 /////////////////////////////////////////////////////////////////////////
 namespace zypp
@@ -502,7 +503,7 @@ StoreWorld::foreachProvidingResItem (const Capability & dep, ResItemAndDepFn fn,
     for (ResItemAndDependencyTable::const_iterator iter = _provides_by_name.lower_bound(dep.index()); iter != _provides_by_name.upper_bound(dep.index()); iter++) {
        ResItemAndDependency_constPtr r_and_d = iter->second;
 
-       if (r_and_d && r_and_d->verifyRelation (dep)) {
+       if (r_and_d && r_and_d->verifyRelation (dep) == CapMatch::yes) {
 //fprintf (stderr, "found: %s\n", r_and_d->resItem()->asString(true).c_str());
            /* If we have multiple identical resItems in RCWorld,
               we want to only include the resItem that is installed and
@@ -545,7 +546,7 @@ StoreWorld::foreachRequiringResItem (const Capability & dep, ResItemAndDepFn fn,
     for (ResItemAndDependencyTable::const_iterator iter = _requires_by_name.lower_bound(dep.index()); iter != _requires_by_name.upper_bound(dep.index()); iter++) {
        ResItemAndDependency_constPtr r_and_d = iter->second;
 
-       if (r_and_d ) {//&& r_and_d->dependency().matches (dep)) {
+       if (r_and_d && r_and_d->dependency().matches (dep) == CapMatch::yes) {
 
            /* Skip dups if one of them in installed. */
            if (r_and_d->resItem()->isInstalled()
@@ -588,7 +589,7 @@ StoreWorld::foreachConflictingResItem (const Capability & dep, ResItemAndDepFn f
 
        if (r_and_d)
 //fprintf (stderr, "==> %s verify %s ? %s\n", r_and_d->asString().c_str(), dep->asString().c_str(), r_and_d->verifyRelation (dep) ? "Y" : "N");
-       if (r_and_d) {//&& r_and_d->dependency().matches (dep)) {
+       if (r_and_d && r_and_d->dependency().matches (dep) == CapMatch::yes) {
            /* Skip dups if one of them in installed. */
            if (r_and_d->resItem()->isInstalled()
                || installed.find(r_and_d->resItem()) == installed.end()) {
index 8722011..632c2b2 100644 (file)
@@ -227,7 +227,7 @@ is_locked_cb (Match_constPtr match, void *data)
 {
     IsLockedInfo *info = (IsLockedInfo *)data;
 
-    if (match->test (info->resItem, info->world)) {
+    if (match->test (info->resItem, info->world) == CapMatch::yes) {
        info->is_locked = true;
        return false;
     }