From: Stefan Schubert Date: Mon, 9 Jan 2006 16:16:48 +0000 (+0000) Subject: taking matches of the capabilities X-Git-Tag: BASE-SuSE-SLE-10-SP2-Branch~3465 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d8dfa1ecae607d1be9182d8ad7a56085c8f5338a;p=platform%2Fupstream%2Flibzypp.git taking matches of the capabilities --- diff --git a/zypp/solver/detail/QueueItemConflict.cc b/zypp/solver/detail/QueueItemConflict.cc index dbec017..a54f16f 100644 --- a/zypp/solver/detail/QueueItemConflict.cc +++ b/zypp/solver/detail/QueueItemConflict.cc @@ -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; } diff --git a/zypp/solver/detail/ResItemAndDependency.cc b/zypp/solver/detail/ResItemAndDependency.cc index 59cec4d..efc0ef9 100644 --- a/zypp/solver/detail/ResItemAndDependency.cc +++ b/zypp/solver/detail/ResItemAndDependency.cc @@ -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 } /////////////////////////////////////////////////////////////////// diff --git a/zypp/solver/detail/ResItemAndDependency.h b/zypp/solver/detail/ResItemAndDependency.h index 332ec34..4885d18 100644 --- a/zypp/solver/detail/ResItemAndDependency.h +++ b/zypp/solver/detail/ResItemAndDependency.h @@ -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 ResItemTable; // ---------------------------------- methods - bool verifyRelation (const Capability & dep) const; + CapMatch verifyRelation (const Capability & dep) const; }; /////////////////////////////////////////////////////////////////// diff --git a/zypp/solver/temporary/Match.cc b/zypp/solver/temporary/Match.cc index d321014..f677eda 100644 --- a/zypp/solver/temporary/Match.cc +++ b/zypp/solver/temporary/Match.cc @@ -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; } diff --git a/zypp/solver/temporary/Match.h b/zypp/solver/temporary/Match.h index 360922d..d286428 100644 --- a/zypp/solver/temporary/Match.h +++ b/zypp/solver/temporary/Match.h @@ -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; }; /////////////////////////////////////////////////////////////////// diff --git a/zypp/solver/temporary/StoreWorld.cc b/zypp/solver/temporary/StoreWorld.cc index f082512..384e3b2 100644 --- a/zypp/solver/temporary/StoreWorld.cc +++ b/zypp/solver/temporary/StoreWorld.cc @@ -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()) { diff --git a/zypp/solver/temporary/World.cc b/zypp/solver/temporary/World.cc index 8722011..632c2b2 100644 --- a/zypp/solver/temporary/World.cc +++ b/zypp/solver/temporary/World.cc @@ -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; }