Author: matz Date: Sun Nov 25 04:41:32 2007 New Revision: 7912 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7912&view=rev Log: Let's make a half-assed attempt to implement capability matching with what the satsolver provides. Modified: branches/use-solv/libzypp/zypp/Capability.cc branches/use-solv/libzypp/zypp/capability/CapabilityImpl.cc Modified: branches/use-solv/libzypp/zypp/Capability.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/Capability.cc?rev=7912&r1=7911&r2=7912&view=diff ============================================================================== --- branches/use-solv/libzypp/zypp/Capability.cc (original) +++ branches/use-solv/libzypp/zypp/Capability.cc Sun Nov 25 04:41:32 2007 @@ -15,6 +15,8 @@ #include "zypp/capability/CapabilityImpl.h" #include "zypp/capability/NullCap.h" +#include "evr.h" + using namespace std; /////////////////////////////////////////////////////////////////// @@ -61,7 +63,42 @@ { return true; } CapMatch Capability::matches( const Capability & rhs ) const - { return CapMatch::irrelevant; /* _pimpl->matches( rhs._pimpl.getPtr() );*/ } + { + Id name1 = ISRELDEP (id) ? GETRELDEP (the_pool, id)->name : id; + Id name2 = ISRELDEP (rhs.id) ? GETRELDEP (the_pool, rhs.id)->name : rhs.id; + if (name1 != name2) + return CapMatch::no; + /* Names are the same, so if not both are reldeps this is a match. */ + if (!ISRELDEP (id) || !ISRELDEP (rhs.id)) + return CapMatch::yes; +#if 1 + /* Both are reldeps, look at them. */ + Reldep *rd1 = GETRELDEP (the_pool, id); + Reldep *rd2 = GETRELDEP (the_pool, rhs.id); + /* We can't yet handle REL_AND, REL_WITH, REL_OR and REL_NAMESPACE. */ + if (rd1->flags && rd1->flags < 8 + && rd2->flags && rd2->flags < 8) + { + if (rd1->flags == 7 || rd2->flags == 7) + return CapMatch::yes; + if ((rd2->flags & rd1->flags & 5) != 0) + return CapMatch::yes; /* same direction, match */ + if (rd1->evr == rd2->evr) + { + if ((rd1->flags & rd2->flags & 2) != 0) + return CapMatch::yes; /* both have =, match */ + } + else + { + int f = rd2->flags == 5 ? 5 : rd2->flags == 2 ? rd1->flags : (rd2->flags ^ 5) & ( + rd1->flags | 5); + if ((f & (1 << (1 + evrcmp (the_pool, rd2->evr, rd1->evr)))) != 0) + return CapMatch::yes; + } + } +#endif + return CapMatch::no; + } std::string Capability::asString() const { return dep2str (the_pool, id); /*_pimpl->asString();*/ } Modified: branches/use-solv/libzypp/zypp/capability/CapabilityImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/capability/CapabilityImpl.cc?rev=7912&r1=7911&r2=7912&view=diff ============================================================================== --- branches/use-solv/libzypp/zypp/capability/CapabilityImpl.cc (original) +++ branches/use-solv/libzypp/zypp/capability/CapabilityImpl.cc Sun Nov 25 04:41:32 2007 @@ -397,7 +397,7 @@ CapabilityImpl::Ptr slow_parse( const Resolvable::Kind & refers_r, const std::string & strval_r ) { - cerr << "AIEEE! capability::slow_parse called" << endl; + cerr << "AIEEE! capability::slow_parse(" << strval_r << ") called" << endl; return NULL; } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org