Author: mlandres Date: Wed Nov 12 18:59:49 2008 New Revision: 11669 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11669&view=rev Log: - Add Capability ctor from Arch and Name: (Arch_i386, "name") or (Arch_i386, "name == 1.0"). Modified: trunk/libzypp/VERSION.cmake trunk/libzypp/package/libzypp.changes trunk/libzypp/tests/zypp/Capabilities_test.cc trunk/libzypp/zypp/Capability.cc trunk/libzypp/zypp/Capability.h Modified: trunk/libzypp/VERSION.cmake URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/VERSION.cmake?rev=11669&r1=11668&r2=11669&view=diff ============================================================================== --- trunk/libzypp/VERSION.cmake (original) +++ trunk/libzypp/VERSION.cmake Wed Nov 12 18:59:49 2008 @@ -60,7 +60,7 @@ # SET(LIBZYPP_MAJOR "5") SET(LIBZYPP_COMPATMINOR "23") -SET(LIBZYPP_MINOR "23") +SET(LIBZYPP_MINOR "24") SET(LIBZYPP_PATCH "0") # # LAST RELEASED: 5.23.0 (23) Modified: trunk/libzypp/package/libzypp.changes URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=11669&r1=11668&r2=11669&view=diff ============================================================================== --- trunk/libzypp/package/libzypp.changes (original) +++ trunk/libzypp/package/libzypp.changes Wed Nov 12 18:59:49 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Wed Nov 12 18:53:03 CET 2008 - ma@suse.de + +- Add Capability ctor from Arch and Name: (Arch_i386, "name") or + (Arch_i386, "name == 1.0"). +- revision 11669 + +------------------------------------------------------------------- Wed Nov 12 14:31:20 CET 2008 - ma@suse.de - Take care to always reset CURLOPT_TIMECONDITION to prevent incomplete Modified: trunk/libzypp/tests/zypp/Capabilities_test.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/Capabilities_test.cc?rev=11669&r1=11668&r2=11669&view=diff ============================================================================== --- trunk/libzypp/tests/zypp/Capabilities_test.cc (original) +++ trunk/libzypp/tests/zypp/Capabilities_test.cc Wed Nov 12 18:59:49 2008 @@ -99,14 +99,18 @@ BOOST_CHECK_EQUAL( noe.detail().hasArch(), false ); BOOST_CHECK_EQUAL( naoe.detail().hasArch(), true ); - BOOST_REQUIRE ( n.detail().arch().empty() ); + BOOST_CHECK ( n.detail().arch().empty() ); BOOST_CHECK_EQUAL( na.detail().arch(), Arch_i386.idStr() ); - BOOST_REQUIRE ( noe.detail().arch().empty() ); + BOOST_CHECK ( noe.detail().arch().empty() ); BOOST_CHECK_EQUAL( naoe.detail().arch(), Arch_i386.idStr() ); BOOST_CHECK_EQUAL( Capability( "", "na.me", "", "" ), n ); BOOST_CHECK_EQUAL( Capability( "i386", "na.me", "", "" ), na ); BOOST_CHECK_EQUAL( Capability( "", "na.me", "==", "1" ), noe ); BOOST_CHECK_EQUAL( Capability( "i386", "na.me", "==", "1" ), naoe ); + + // explicit arch + BOOST_CHECK_EQUAL( Capability( Arch_i386, "na.me" ), na ); + BOOST_CHECK_EQUAL( Capability( Arch_i386, "na.me == 1" ), naoe ); } Modified: trunk/libzypp/zypp/Capability.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Capability.cc?rev=11669&r1=11668&r2=11669&view=diff ============================================================================== --- trunk/libzypp/zypp/Capability.cc (original) +++ trunk/libzypp/zypp/Capability.cc Wed Nov 12 18:59:49 2008 @@ -114,6 +114,7 @@ /** Full parse from string, unless Capability::PARSED. */ sat::detail::IdType relFromStr( ::_Pool * pool_r, + const Arch & arch_r, // parse from name if empty const std::string & str_r, const ResKind & kind_r, Capability::CtorFlag flag_r ) { @@ -147,7 +148,10 @@ //else // not a versioned relation - return relFromStr( pool_r, name, op, ed, kind_r ); // parses for name[.arch] + if ( arch_r.empty() ) + return relFromStr( pool_r, name, op, ed, kind_r ); // parses for name[.arch] + // else + return relFromStr( pool_r, arch_r, name, op, ed, kind_r ); } ///////////////////////////////////////////////////////////////// @@ -160,19 +164,35 @@ ///////////////////////////////////////////////////////////////// Capability::Capability( const char * str_r, const ResKind & prefix_r, CtorFlag flag_r ) - : _id( relFromStr( myPool().getPool(), str_r, prefix_r, flag_r ) ) + : _id( relFromStr( myPool().getPool(), Arch_empty, str_r, prefix_r, flag_r ) ) {} Capability::Capability( const std::string & str_r, const ResKind & prefix_r, CtorFlag flag_r ) - : _id( relFromStr( myPool().getPool(), str_r.c_str(), prefix_r, flag_r ) ) + : _id( relFromStr( myPool().getPool(), Arch_empty, str_r.c_str(), prefix_r, flag_r ) ) + {} + + Capability::Capability( const Arch & arch_r, const char * str_r, const ResKind & prefix_r, CtorFlag flag_r ) + : _id( relFromStr( myPool().getPool(), arch_r, str_r, prefix_r, flag_r ) ) + {} + + Capability::Capability( const Arch & arch_r, const std::string & str_r, const ResKind & prefix_r, CtorFlag flag_r ) + : _id( relFromStr( myPool().getPool(), arch_r, str_r.c_str(), prefix_r, flag_r ) ) {} Capability::Capability( const char * str_r, CtorFlag flag_r, const ResKind & prefix_r ) - : _id( relFromStr( myPool().getPool(), str_r, prefix_r, flag_r ) ) + : _id( relFromStr( myPool().getPool(), Arch_empty, str_r, prefix_r, flag_r ) ) {} Capability::Capability( const std::string & str_r, CtorFlag flag_r, const ResKind & prefix_r ) - : _id( relFromStr( myPool().getPool(), str_r, prefix_r, flag_r ) ) + : _id( relFromStr( myPool().getPool(), Arch_empty, str_r, prefix_r, flag_r ) ) + {} + + Capability::Capability( const Arch & arch_r, const char * str_r, CtorFlag flag_r, const ResKind & prefix_r ) + : _id( relFromStr( myPool().getPool(), arch_r, str_r, prefix_r, flag_r ) ) + {} + + Capability::Capability( const Arch & arch_r, const std::string & str_r, CtorFlag flag_r, const ResKind & prefix_r ) + : _id( relFromStr( myPool().getPool(), arch_r, str_r, prefix_r, flag_r ) ) {} /////////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp/Capability.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Capability.h?rev=11669&r1=11668&r2=11669&view=diff ============================================================================== --- trunk/libzypp/zypp/Capability.h (original) +++ trunk/libzypp/zypp/Capability.h Wed Nov 12 18:59:49 2008 @@ -70,7 +70,7 @@ /** Ctor from id. */ explicit Capability( sat::detail::IdType id_r ) : _id( id_r ) {} - /** \name Ctors parsing a Capability: <tt>"name[.arch] [op edition]"</tt> + /** \name Ctors parsing a Capability: <tt>"name[.arch] [op edition]"</tt> or <tt>( arch, "name [op edition]")</tt> */ //@{ /** Ctor from string. @@ -81,12 +81,22 @@ explicit Capability( const char * str_r, const ResKind & prefix_r = ResKind(), CtorFlag flag_r = UNPARSED ); /** \overload */ explicit Capability( const std::string & str_r, const ResKind & prefix_r = ResKind(), CtorFlag flag_r = UNPARSED ); - /** \overload Convenience for parsed (name only) packages. */ + /** \overload Explicitly specify the \c arch. */ + Capability( const Arch & arch_r, const char * str_r, const ResKind & prefix_r = ResKind(), CtorFlag flag_r = UNPARSED ); + /** \overload Explicitly specify the \c arch. */ + Capability( const Arch & arch_r, const std::string & str_r, const ResKind & prefix_r = ResKind(), CtorFlag flag_r = UNPARSED ); + + /** \overload Convenience for parsed (name only, no <tt>"[op edition]</tt>) packages: <tt>Capability( "glibc", PARSED ); */ Capability( const char * str_r, CtorFlag flag_r, const ResKind & prefix_r = ResKind() ); /** \overload */ Capability( const std::string & str_r, CtorFlag flag_r, const ResKind & prefix_r = ResKind() ); + /** \overload Explicitly specify the \c arch. */ + Capability( const Arch & arch_r, const char * str_r, CtorFlag flag_r, const ResKind & prefix_r = ResKind() ); + /** \overload */ + Capability( const Arch & arch_r, const std::string & str_r, CtorFlag flag_r, const ResKind & prefix_r = ResKind() ); //@} + /** \name Ctors parsing a broken down Capability: <tt>( "name[.arch]", op, edition )</tt> */ //@{ -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org