Author: mlandres Date: Thu Sep 6 14:20:35 2007 New Revision: 7123 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7123&view=rev Log: - Let the solver treat vendor suse and opensuse as equivalent. Modified: trunk/libzypp/zypp/VendorAttr.cc Modified: trunk/libzypp/zypp/VendorAttr.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/VendorAttr.cc?rev=7123&r1=7122&r2=7123&view=diff ============================================================================== --- trunk/libzypp/zypp/VendorAttr.cc (original) +++ trunk/libzypp/zypp/VendorAttr.cc Thu Sep 6 14:20:35 2007 @@ -147,18 +147,27 @@ bool VendorAttr::autoProtect( const Vendor & vendor_r ) const { return( ZConfig::instance().autolock_untrustedvendor() && ! trusted( vendor_r ) ); } - bool VendorAttr::equivalent( const Vendor & lhs, const Vendor & rhs ) const + /** Helper: Lowercase prefix */ + inline bool hasLcPrefix( const std::string & str_r, const std::string & pref_r ) + { return str::toLower( str_r.substr( 0, pref_r.size() ) ) == pref_r; } + + /** Helper: SuSE and equivalent vendors */ + inline bool isSUSE( const Vendor & vnd_r ) { - static const std::string defSUSE( "suse" ); + static const std::string defSUSE ( "suse" ); + static const std::string defopenSUSE( "opensuse" ); - if ( lhs == rhs ) - return true; - // By now handcrafted equivalence definition: - if ( str::toLower( lhs.substr( 0, 4 ) ) == defSUSE - && str::toLower( rhs.substr( 0, 4 ) ) == defSUSE ) + return( hasLcPrefix( vnd_r, defSUSE ) + || hasLcPrefix( vnd_r, defopenSUSE ) ); + } + + bool VendorAttr::equivalent( const Vendor & lhs, const Vendor & rhs ) const + { + if ( lhs == rhs ) return true; - return false; + // By now handcrafted equivalence definition: + return( isSUSE( lhs ) && isSUSE( rhs ) ); } ///////////////////////////////////////////////////////////////// -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org