Author: mlandres
Date: Thu Dec 13 16:24:00 2007
New Revision: 8112
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8112&view=rev
Log:
backup
Modified:
trunk/libzypp/devel/devel.ma/NewPool.cc
trunk/libzypp/zypp/@DOXYGEN/DOXYGEN.h
trunk/libzypp/zypp/sat/Capabilities.cc
trunk/libzypp/zypp/sat/Capabilities.h
trunk/libzypp/zypp/sat/Capability.h
trunk/libzypp/zypp/sat/Repo.h
trunk/libzypp/zypp/sat/Solvable.cc
trunk/libzypp/zypp/sat/Solvable.h
trunk/libzypp/zypp/sat/detail/PoolImpl.cc
trunk/libzypp/zypp/sat/detail/PoolMember.h
Modified: trunk/libzypp/devel/devel.ma/NewPool.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/NewPool.cc?rev=8112&r1=8111&r2=8112&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/NewPool.cc (original)
+++ trunk/libzypp/devel/devel.ma/NewPool.cc Thu Dec 13 16:24:00 2007
@@ -384,6 +384,30 @@
DBG << lhs << " <=> " << rhs << " --> " << ::strcmp( lhs, rhs ) << endl;
}
+namespace filter
+{
+ template
+ class HasValue
+ {
+ public:
+ HasValue( _MemFun fun_r, _Value val_r )
+ : _fun( fun_r ), _val( val_r )
+ {}
+ template <class _Tp>
+ bool operator()( const _Tp & obj_r ) const
+ { return( _fun && (obj_r.*_fun)() == _val ); }
+ private:
+ _MemFun _fun;
+ _Value _val;
+ };
+
+ template
+ HasValue<_MemFun, _Value> byValue( _MemFun fun_r, _Value val_r )
+ { return HasValue<_MemFun, _Value>( fun_r, val_r ); }
+}
+
+
+
/******************************************************************
**
@@ -402,7 +426,29 @@
//sat::Repo s( satpool.addRepoSolv( "sl10.1-beta7-selections.solv" ) );
sat::Repo s( satpool.addRepoSolv( "target.solv" ) );
- std::for_each( satpool.solvablesBegin(), satpool.solvablesEnd(), Xprint() );
+ sat::Capabilities r( (*satpool.solvablesBegin())[Dep::PROVIDES] );
+ MIL << r << endl;
+ sat::Capabilities::const_iterator it = r.begin();
+ DBG << *it << endl;
+ it = ++r.begin();
+ DBG << *it << endl;
+
+ if ( 1 )
+ std::for_each( make_filter_iterator( filter::byValue( &sat::Solvable::name, "bash" ),
+ satpool.solvablesBegin(), satpool.solvablesEnd() ),
+ make_filter_iterator( filter::byValue( &sat::Solvable::name, "bash" ),
+ satpool.solvablesEnd(), satpool.solvablesEnd() ),
+ Xprint() );
+
+ // make_filter_iterator(detail::ByRepo( *this ),
+ // Repo.cc- detail::SolvableIterator(_repo->end),
+ // Repo.cc- detail::SolvableIterator(_repo->end) );
+
+
+// DBG << satpool.solvablesBegin()->name() << endl;
+// DBG << (*satpool.solvablesBegin())[Dep::PROVIDES] << endl;
+
+ //std::for_each( satpool.solvablesBegin(), satpool.solvablesEnd(), Xprint() );
///////////////////////////////////////////////////////////////////
INT << "===[END]============================================" << endl << endl;
Modified: trunk/libzypp/zypp/@DOXYGEN/DOXYGEN.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/%40DOXYGEN/DOXYGEN.h?rev=8112&r1=8111&r2=8112&view=diff
==============================================================================
--- trunk/libzypp/zypp/@DOXYGEN/DOXYGEN.h (original)
+++ trunk/libzypp/zypp/@DOXYGEN/DOXYGEN.h Thu Dec 13 16:24:00 2007
@@ -56,3 +56,12 @@
/** \ref BOOST */
namespace boost {}
////////////////////////////////////////////////////////////////////////////////
+/** \defgroup SATSOLVER Satsolver interface.
+ * Interface to sat-pool and sat-solver.
+ */
+ namespace zypp
+ {
+ /** \ref SATSOLVER */
+ namespace sat {}
+ }
+
Modified: trunk/libzypp/zypp/sat/Capabilities.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Capabilities.cc?rev=8112&r1=8111&r2=8112&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/Capabilities.cc (original)
+++ trunk/libzypp/zypp/sat/Capabilities.cc Thu Dec 13 16:24:00 2007
@@ -22,16 +22,42 @@
///////////////////////////////////////////////////////////////////
namespace sat
{ /////////////////////////////////////////////////////////////////
+
+ Capabilities:: Capabilities( const detail::IdType * base_r, detail::IdType skip_r )
+ : _begin( base_r )
+ {
+ if ( ! _begin )
+ return;
+
+ if ( skip_r )
+ {
+ for ( const detail::IdType * end = _begin; *end; ++end )
+ {
+ if ( *end == skip_r )
+ {
+ _begin = end+1;
+ return;
+ }
+ }
+ }
+ // skipp all ==> empty
+ _begin = 0;
+ }
+
Capabilities::size_type Capabilities::size() const
{
if ( ! _begin )
return 0;
- const detail::IdType * end = _begin;
- for ( ; *end; ++end )
- ;/*NOOP*/
- return end - _begin;
+ // jump over satsolvers internal ids.
+ Capabilities::size_type ret = 0;
+ for ( const detail::IdType * end = _begin; *end; ++end )
+ {
+ if ( ! detail::isDepMarkerId( *end ) )
+ ++ret;
+ }
+ return ret;
}
/******************************************************************
Modified: trunk/libzypp/zypp/sat/Capabilities.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Capabilities.h?rev=8112&r1=8111&r2=8112&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/Capabilities.h (original)
+++ trunk/libzypp/zypp/sat/Capabilities.h Thu Dec 13 16:24:00 2007
@@ -29,7 +29,10 @@
// CLASS NAME : Capabilities
//
/** Container of \ref Capability (currently read only).
- * \todo PREREQ iteration
+ *
+ * \note satsolver dependency lists may include internal ids
+ * which must be skipped on iteration or size calculation
+ * (\see \ref detail::isDepMarkerId).
*/
class Capabilities
{
@@ -37,19 +40,26 @@
typedef Capability value_type;
typedef unsigned size_type;
+ enum Mode { SKIP_TO_INTERNAL };
+
public:
/** Default ctor */
Capabilities()
: _begin( 0 )
{}
- /** Ctor from Id pointer (for \ref Solvable). */
+ /** Ctor from Id pointer (friend \ref Solvable). */
explicit
Capabilities( const detail::IdType * base_r )
: _begin( base_r )
{}
- public:
+ /** Ctor from Id pointer (friend \ref Solvable).
+ * Jump behind skip_r (e.g. behind prereqMarker).
+ */
+ Capabilities( const detail::IdType * base_r, detail::IdType skip_r );
+
+ public:
/** Whether the container is empty. */
bool empty() const
{ return ! ( _begin && *_begin ); }
@@ -95,23 +105,32 @@
explicit const_iterator( const detail::IdType * _idx )
: const_iterator::iterator_adaptor_( _idx )
- {}
+ { assignVal(); }
private:
friend class boost::iterator_core_access;
reference dereference() const
- { return (_val = Capability( *base() )); }
+ { return _val; }
template
bool equal( const boost::iterator_adaptor & rhs ) const
{ // NULL pointer is eqal pointer to Id 0
- return ( base() == rhs.base()
- || ( !base() && !*rhs.base() )
- || ( !rhs.base() && !*base() ) );
+ return ( base() == rhs.base() // includes both NULL...
+ || ( !rhs.base() && !*base() )
+ || ( !base() && !*rhs.base() ) );
+ }
+
+ void increment()
+ { // jump over satsolvers internal ids.
+ if ( detail::isDepMarkerId( *(++base_reference()) ) ) ++base_reference();
+ assignVal();
}
private:
+ void assignVal()
+ { _val = ( base() ) ? Capability( *base() ) : Capability::Null; }
+
mutable Capability _val;
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/sat/Capability.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Capability.h?rev=8112&r1=8111&r2=8112&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/Capability.h (original)
+++ trunk/libzypp/zypp/sat/Capability.h Thu Dec 13 16:24:00 2007
@@ -63,6 +63,7 @@
public:
/** No or Null \ref Capability. */
static const Capability Null;
+
public:
/** Conversion to <tt>const char *</tt> */
const char * c_str() const;
Modified: trunk/libzypp/zypp/sat/Repo.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Repo.h?rev=8112&r1=8111&r2=8112&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/Repo.h (original)
+++ trunk/libzypp/zypp/sat/Repo.h Thu Dec 13 16:24:00 2007
@@ -196,6 +196,7 @@
public:
ByRepo( const Repo & repo_r ) : _repo( repo_r ) {}
ByRepo( RepoIdType id_r ) : _repo( id_r ) {}
+ ByRepo() {}
bool operator()( const Solvable & slv_r ) const
{ return slv_r.repo() == _repo; }
Modified: trunk/libzypp/zypp/sat/Solvable.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Solvable.cc?rev=8112&r1=8111&r2=8112&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/Solvable.cc (original)
+++ trunk/libzypp/zypp/sat/Solvable.cc Thu Dec 13 16:24:00 2007
@@ -89,14 +89,13 @@
return VendorId( _solvable->vendor );
}
- Capabilities Solvable::operator[]( Dep idx_r ) const
+ Capabilities Solvable::operator[]( Dep which_r ) const
{
NO_SOLVABLE_RETURN( Capabilities() );
::Offset offs = 0;
- switch( idx_r.inSwitch() )
+ switch( which_r.inSwitch() )
{
case Dep::PROVIDES_e: offs = _solvable->provides; break;
- case Dep::PREREQUIRES_e: break; // not yet handled.
case Dep::REQUIRES_e: offs = _solvable->requires; break;
case Dep::CONFLICTS_e: offs = _solvable->conflicts; break;
case Dep::OBSOLETES_e: offs = _solvable->obsoletes; break;
@@ -105,10 +104,18 @@
case Dep::FRESHENS_e: offs = _solvable->freshens; break;
case Dep::ENHANCES_e: offs = _solvable->enhances; break;
case Dep::SUPPLEMENTS_e: offs = _solvable->supplements; break;
+
+ case Dep::PREREQUIRES_e:
+ // prerequires are a subset of requires
+ if ( (offs = _solvable->requires) )
+ return Capabilities( _solvable->repo->idarraydata + offs, detail::solvablePrereqMarker );
+ else
+ return Capabilities();
+ break;
}
- if ( ! offs )
- return Capabilities();
- return Capabilities( _solvable->repo->idarraydata + offs );
+
+ return offs ? Capabilities( _solvable->repo->idarraydata + offs )
+ : Capabilities();
}
/******************************************************************
@@ -136,7 +143,7 @@
str << obj;
if ( obj )
{
-#define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::PROVIDES]
+#define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]
OUTS(PROVIDES);
OUTS(PREREQUIRES);
OUTS(REQUIRES);
Modified: trunk/libzypp/zypp/sat/Solvable.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Solvable.h?rev=8112&r1=8111&r2=8112&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/Solvable.h (original)
+++ trunk/libzypp/zypp/sat/Solvable.h Thu Dec 13 16:24:00 2007
@@ -61,14 +61,32 @@
Repo repo() const;
public:
- NameId name() const;
- EvrId evr() const;
- ArchId arch() const;
+ NameId name() const;
+ EvrId evr() const;
+ ArchId arch() const;
VendorId vendor() const;
public:
- /** Access to the \ref Solvable dependencies. */
- Capabilities operator[]( Dep idx_r ) const;
+
+ /** \name Access to the \ref Solvable dependencies.
+ *
+ * \note Prerequires are a subset of requires.
+ */
+ //@{
+ Capabilities operator[]( Dep which_r ) const;
+
+ Capabilities provides() const;
+ Capabilities requires() const;
+ Capabilities conflicts() const;
+ Capabilities obsoletes() const;
+ Capabilities recommends() const;
+ Capabilities suggests() const;
+ Capabilities freshens() const;
+ Capabilities enhances() const;
+ Capabilities supplements() const;
+ Capabilities prerequires() const;
+ //@}
+
public:
/** Return next Solvable in \ref Pool (or \ref nosolvable). */
Modified: trunk/libzypp/zypp/sat/detail/PoolImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/detail/PoolImpl.cc?rev=8112&r1=8111&r2=8112&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/detail/PoolImpl.cc (original)
+++ trunk/libzypp/zypp/sat/detail/PoolImpl.cc Thu Dec 13 16:24:00 2007
@@ -10,6 +10,7 @@
*
*/
#include <iostream>
+#include
#include "zypp/base/Logger.h"
#include "zypp/base/Gettext.h"
@@ -31,6 +32,12 @@
namespace detail
{ /////////////////////////////////////////////////////////////////
+ // MPL checks for satlib constants we redefine:
+ BOOST_MPL_ASSERT_RELATION( solvablePrereqMarker, ==, SOLVABLE_PREREQMARKER );
+ BOOST_MPL_ASSERT_RELATION( solvableFileMarker, ==, SOLVABLE_FILEMARKER );
+
+ /////////////////////////////////////////////////////////////////
+
void logSat( struct _Pool *, void *data, int type, const char *logString )
{
if ((type & (SAT_FATAL|SAT_ERROR))) {
Modified: trunk/libzypp/zypp/sat/detail/PoolMember.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/detail/PoolMember.h?rev=8112&r1=8111&r2=8112&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/detail/PoolMember.h (original)
+++ trunk/libzypp/zypp/sat/detail/PoolMember.h Thu Dec 13 16:24:00 2007
@@ -69,6 +69,13 @@
typedef int IdType;
static const IdType noId( 0 );
+ /** Internal ids satlib includes in dependencies. */
+ static const IdType solvablePrereqMarker( 16 ); // MPL check in PoolImpl.cc
+ static const IdType solvableFileMarker ( 17 ); // MPL check in PoolImpl.cc
+ /** Test for internal ids satlib includes in dependencies. */
+ inline bool isDepMarkerId( IdType id_r )
+ { return( id_r == solvablePrereqMarker || id_r == solvableFileMarker ); }
+
/** Id type to connect \ref Solvable and sat-solvable.
* Indext into solvable array.
*/
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org