Author: mlandres
Date: Tue Apr 1 22:03:24 2008
New Revision: 9328
URL: http://svn.opensuse.org/viewcvs/zypp?rev=9328&view=rev
Log:
- Extend sat::WhatProvides to allow to query for possible providers
of a collection of capabilies. E.g. all providers of a packages
requirements.
- Fixed retrieval of translated texts from .solv files, provided the
solv file contains them.
Modified:
trunk/libzypp/package/libzypp.changes
trunk/libzypp/zypp/sat/Solvable.cc
trunk/libzypp/zypp/sat/Solvable.h
trunk/libzypp/zypp/sat/WhatProvides.cc
trunk/libzypp/zypp/sat/WhatProvides.h
trunk/libzypp/zypp/sat/detail/PoolImpl.cc
trunk/libzypp/zypp/sat/detail/PoolMember.h
Modified: trunk/libzypp/package/libzypp.changes
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=9328&r1=9327&r2=9328&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Tue Apr 1 22:03:24 2008
@@ -1,4 +1,14 @@
-------------------------------------------------------------------
+Tue Apr 1 21:54:10 CEST 2008 - ma@suse.de
+
+- Extend sat::WhatProvides to allow to query for possible providers
+ of a collection of capabilies. E.g. all providers of a packages
+ requirements.
+- Fixed retrieval of translated texts from .solv files, provided the
+ solv file contains them.
+- revision 9328
+
+-------------------------------------------------------------------
Tue Apr 1 16:17:44 CEST 2008 - jreidinger@suse.cz
- initial implementation of serialize/recovery PoolQuery
Modified: trunk/libzypp/zypp/sat/Solvable.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Solvable.cc?rev=9328&r1=9327&r2=9328&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/Solvable.cc (original)
+++ trunk/libzypp/zypp/sat/Solvable.cc Tue Apr 1 22:03:24 2008
@@ -30,7 +30,7 @@
namespace sat
{ /////////////////////////////////////////////////////////////////
- const Solvable Solvable::nosolvable;
+ const Solvable Solvable::noSolvable;
/////////////////////////////////////////////////////////////////
@@ -46,7 +46,7 @@
Solvable Solvable::nextInRepo() const
{
- NO_SOLVABLE_RETURN( nosolvable );
+ NO_SOLVABLE_RETURN( noSolvable );
for ( detail::SolvableIdType next = _id+1; next < unsigned(_solvable->repo->end); ++next )
{
::_Solvable * nextS( myPool().getSolvable( next ) );
@@ -55,7 +55,7 @@
return Solvable( next );
}
}
- return nosolvable;
+ return noSolvable;
}
Repository Solvable::repository() const
@@ -65,7 +65,10 @@
}
bool Solvable::isSystem() const
- { return repository().isSystemRepo(); }
+ {
+ NO_SOLVABLE_RETURN( _id == detail::systemSolvableId );
+ return Repository( _solvable->repo ).isSystemRepo();
+ }
IdString Solvable::ident() const
{
@@ -76,26 +79,35 @@
std::string Solvable::lookupStrAttribute( const SolvAttr & attr ) const
{
NO_SOLVABLE_RETURN( std::string() );
- const char *s = ::repo_lookup_str( _solvable, attr.idStr().id() );
- return s ? s : std::string();
+ const char * s = ::solvable_lookup_str( _solvable, attr.idStr().id() );
+ return s ? s : std::string();
}
std::string Solvable::lookupStrAttribute( const SolvAttr & attr, const Locale & lang_r ) const
{
-#warning FIX RETRIEVIENG TRANSLATIONS
- return lookupStrAttribute( attr );
+ NO_SOLVABLE_RETURN( std::string() );
+ const char * s = 0;
+ if ( lang_r == Locale::noCode )
+ {
+ s = ::solvable_lookup_str_poollang( _solvable, attr.idStr().id() );
+ }
+ else
+ {
+ s = ::solvable_lookup_str_lang( _solvable, attr.idStr().id(), lang_r.code().c_str() );
+ }
+ return s ? s : std::string();
}
unsigned Solvable::lookupNumAttribute( const SolvAttr & attr ) const
{
NO_SOLVABLE_RETURN( 0 );
- return ::repo_lookup_num( _solvable, attr.idStr().id() );
+ return ::solvable_lookup_num( _solvable, attr.idStr().id(), 0 );
}
bool Solvable::lookupBoolAttribute( const SolvAttr & attr ) const
{
NO_SOLVABLE_RETURN( false );
- return ::repo_lookup_num( _solvable, attr.idStr().id() );
+ return ::solvable_lookup_bool( _solvable, attr.idStr().id() );
}
std::string Solvable::lookupLocation(unsigned &medianr) const
@@ -399,7 +411,7 @@
std::ostream & operator<<( std::ostream & str, const Solvable & obj )
{
if ( ! obj )
- return str << "sat::solvable()";
+ return str << (obj.isSystem() ? "systemSolvable" : "noSolvable" );
return str << "(" << obj.id() << ")"
<< ( obj.isKind( ResKind::srcpackage ) ? "srcpackage:" : "" ) << obj.ident()
Modified: trunk/libzypp/zypp/sat/Solvable.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Solvable.h?rev=9328&r1=9327&r2=9328&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/Solvable.h (original)
+++ trunk/libzypp/zypp/sat/Solvable.h Tue Apr 1 22:03:24 2008
@@ -49,8 +49,6 @@
* \ref Solvable will hide this inconsistency by treating source
* packages as an own kind of solvable and map their arch to
* \ref Arch_noarch.
- *
- *
*/
class Solvable : protected detail::PoolMember,
private base::SafeBool<Solvable>
@@ -59,7 +57,7 @@
typedef sat::detail::SolvableIdType IdType;
public:
- /** Default ctor creates \ref nosolvable.*/
+ /** Default ctor creates \ref noSolvable.*/
Solvable()
: _id( detail::noSolvableId ) {}
@@ -69,12 +67,14 @@
public:
/** Represents no \ref Solvable. */
- static const Solvable nosolvable;
+ static const Solvable noSolvable;
- /** Evaluate \ref Solvable in a boolean context (\c != \c nosolvable). */
+ /** Evaluate \ref Solvable in a boolean context (\c != \c noSolvable). */
using base::SafeBool<Solvable>::operator bool_type;
- /** Return whether this \ref Solvable belongs to the system repo. */
+ /** Return whether this \ref Solvable belongs to the system repo.
+ * \note This includes the otherwise hidden systemSolvable.
+ */
bool isSystem() const;
/** The \ref Repository this \ref Solvable belongs to. */
@@ -89,11 +89,13 @@
std::string lookupStrAttribute( const SolvAttr & attr ) const;
/** \overload Trying to look up a translated string attribute.
*
+ * Returns the translation for \c lang_r (\b no fallback locales).
+ *
* Passing an empty \ref Locale will return the string for the
- * current default locale (\see \ref ZConfig::defaultTextLocale).
+ * current default locale (\see \ref ZConfig::defaultTextLocale),
+ * \b considering all fallback locales.
*
- * Returns the translation for \c lang_r considering all fallback
- * locales. Returns an empty string if no translation is available.
+ * Returns an empty string if no translation is available.
*/
std::string lookupStrAttribute( const SolvAttr & attr, const Locale & lang_r ) const;
@@ -175,9 +177,9 @@
//@}
public:
- /** Return next Solvable in \ref Pool (or \ref nosolvable). */
+ /** Return next Solvable in \ref Pool (or \ref noSolvable). */
Solvable nextInPool() const;
- /** Return next Solvable in \ref Repo (or \ref nosolvable). */
+ /** Return next Solvable in \ref Repo (or \ref noSolvable). */
Solvable nextInRepo() const;
public:
Modified: trunk/libzypp/zypp/sat/WhatProvides.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/WhatProvides.cc?rev=9328&r1=9327&r2=9328&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/WhatProvides.cc (original)
+++ trunk/libzypp/zypp/sat/WhatProvides.cc Tue Apr 1 22:03:24 2008
@@ -10,8 +10,9 @@
*
*/
#include <iostream>
-#include "zypp/base/LogTools.h"
+#include