std::string Capability::index() const
{ return _pimpl->index(); }
- Rel Capability::op() const
- { return _pimpl->op(); }
-
- Edition Capability::edition() const
- { return _pimpl->edition(); }
+// Rel Capability::op() const
+// { return _pimpl->op(); }
+//
+// Edition Capability::edition() const
+// { return _pimpl->edition(); }
/******************************************************************
**
/** accessors needed by solver/zmd */
/** Deprecated */
std::string index() const;
- /** Deprecated, defaults to Rel::NONE */
- Rel op() const;
- /** Deprecated, defaults to Edition::noedition */
- Edition edition() const;
private:
typedef capability::CapabilityImpl Impl;
*/
virtual std::string index() const
{ return encode(); }
- /** \deprecated, defaults to Rel::NONE */
- virtual Rel op() const
- { return Rel::NONE; }
- /** \deprecated, defaults to Edition::noedition */
- virtual Edition edition() const
- { return Edition::noedition; }
public:
/** Solver hack. */
namespace capability
{ /////////////////////////////////////////////////////////////////
+ IMPL_PTR_TYPE(FileCap)
+
const CapabilityImpl::Kind & FileCap::kind() const
{ return CapTraits<Self>::kind; }
- CapMatch FileCap::matches( const constPtr & rhs ) const
+ CapMatch FileCap::matches( const CapabilityImpl::constPtr & rhs ) const
{
return ( sameKindAndRefers( rhs )
&& _fname == asKind<Self>(rhs)->_fname );
namespace capability
{ /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(FileCap)
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : FileCap
{
public:
typedef FileCap Self;
+ typedef FileCap_Ptr Ptr;
+ typedef FileCap_constPtr constPtr;
/** Ctor */
FileCap( const Resolvable::Kind & refers_r, const std::string & fname_r )
{}
public:
+ std::string filename() const
+ { return _fname; }
+
/** */
virtual const Kind & kind() const;
/** Same kind, refers and filename. */
- virtual CapMatch matches( const constPtr & rhs ) const;
+ virtual CapMatch matches( const CapabilityImpl::constPtr & rhs ) const;
/** Filename. */
virtual std::string encode() const;
namespace capability
{ /////////////////////////////////////////////////////////////////
+ IMPL_PTR_TYPE(NamedCap)
+
const CapabilityImpl::Kind & NamedCap::kind() const
{ return CapTraits<Self>::kind; }
- CapMatch NamedCap::matches( const constPtr & rhs ) const
+ CapMatch NamedCap::matches( const CapabilityImpl::constPtr & rhs ) const
{
if ( sameKindAndRefers( rhs ) )
{
namespace capability
{ /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(NamedCap)
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : NamedCap
{
public:
typedef NamedCap Self;
+ typedef NamedCap_Ptr Ptr;
+ typedef NamedCap_constPtr constPtr;
/** Ctor */
NamedCap( const Resolvable::Kind & refers_r, const std::string & name_r )
virtual const Kind & kind() const;
/** Return whether the Capabilities match. */
- virtual CapMatch matches( const constPtr & rhs ) const;
+ virtual CapMatch matches( const CapabilityImpl::constPtr & rhs ) const;
/** Name. */
virtual std::string encode() const;
-
- protected:
+
/** */
const std::string & name() const
{ return _name; }
+
+ protected:
+
/** Rel::ANY. */
virtual const Edition::MatchRange & range() const;
namespace capability
{ /////////////////////////////////////////////////////////////////
+ IMPL_PTR_TYPE(VersionedCap)
+
std::string VersionedCap::encode() const
{
std::string ret( name() );
namespace capability
{ /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(VersionedCap)
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : VersionedCap
*/
class VersionedCap : public NamedCap
{
- public:
+ public:
+ typedef VersionedCap Self;
+ typedef VersionedCap_Ptr Ptr;
+ typedef VersionedCap_constPtr constPtr;
+
/** Ctor */
VersionedCap( const Resolvable::Kind & refers_r,
const std::string & name_r,
namespace data
{
typedef std::list< capability::CapabilityImpl::Ptr > DependencyList;
-
- struct Dependencies
- {
-// DependencyList & operator[]( zypp::Dep idx )
-// {
-// switch ( idx.inSwitch() )
-// {
-// case zypp::Dep::PROVIDES.inSwitch(): return provides; break;
-// case zypp::Dep::CONFLICTS.inSwitch(): return conflicts; break;
-// case zypp::Dep::OBSOLETES.inSwitch(): return obsoletes; break;
-// case zypp::Dep::FRESHENS.inSwitch(): return freshens; break;
-// case zypp::Dep::REQUIRES.inSwitch(): return requires; break;
-// case zypp::Dep::PREREQUIRES.inSwitch(): return prerequires; break;
-// case zypp::Dep::RECOMMENDS.inSwitch(): return recommends; break;
-// case zypp::Dep::SUGGESTS.inSwitch(): return suggests; break;
-// case zypp::Dep::SUPPLEMENTS.inSwitch(): return supplements; break;
-// case zypp::Dep::ENHANCES.inSwitch(): return enhances; break;
-// }
-// }
-
- DependencyList provides;
- DependencyList conflicts;
- DependencyList obsoletes;
- DependencyList freshens;
- DependencyList requires;
- DependencyList prerequires;
- DependencyList recommends;
- DependencyList suggests;
- DependencyList supplements;
- DependencyList enhances;
- };
+ typedef std::map< zypp::Dep, DependencyList> Dependencies;
class Resolvable : public base::ReferenceCounted, private base::NonCopyable
{
// if its a provides, check for non-empty edition since
// kernels provide "kernel-flavor-nongpl" (empty edition)
// and "kernel-flavor = x.y" (non-empty edition)
-
- if ( it->index().substr( 0, 7 ) == "kernel-"
- && (dep == Dep::REQUIRES
- || it->edition() != Edition::noedition ) )
- {
- return it->index().erase( 0, 7 ); // erase "kernel-"
- }
+ capability::VersionedCap::constPtr vercap = capability::asKind<capability::VersionedCap>(*it);
+ if ( vercap ) {
+
+ if ( vercap->index().substr( 0, 7 ) == "kernel-"
+ && (dep == Dep::REQUIRES
+ || vercap->edition() != Edition::noedition ) )
+ {
+ return vercap->index().erase( 0, 7 ); // erase "kernel-"
+ }
+ }
+ else
+ {
+ ERR << *it << " is not a VersionedCap" << std::endl;
+ }
}
return "";
}
flavor.append( ":" );
CapFactory factory;
deps[dep].clear();
- for (CapSet::iterator it = cset.begin(); it != cset.end(); ++it) {
+ for (CapSet::const_iterator it = cset.begin(); it != cset.end(); ++it) {
std::string idx( it->index() );
if ( idx.substr( 0, 7 ) == "kernel(" // capability is "kernel(..."
&& idx.find( ":" ) == std::string::npos ) // without a colon
{
- deps[dep].insert( factory.parse( it->refers(), idx.insert( 7, flavor ), it->op(), it->edition() ) );
+ capability::VersionedCap::constPtr vercap = capability::asKind<capability::VersionedCap>(*it);
+ if ( vercap )
+
+ deps[dep].insert( factory.parse( vercap->refers(), idx.insert( 7, flavor ), vercap->op(), vercap->edition() ) );
+ else
+ ERR << *it << " is not a VersionedCap" << std::endl;
}
else {
deps[dep].insert( *it );
std::string helixXML( const Capability &cap )
{
stringstream str;
- if (isKind<VersionedCap>(cap)
- && cap.op() != Rel::NONE
- && cap.op() != Rel::ANY
- && !cap.edition().version().empty()) {
- // version capability
- str << "<dep name='" << xml_escape(cap.index()) << "' op='" << xml_escape(cap.op().asString()) <<
- "' version='" << cap.edition().version() << "'";
- if (!cap.edition().release().empty())
- str << " release='" << cap.edition().release() << "'";
- if (cap.edition().epoch() != Edition::noepoch)
- str << " epoch='" << numstring(cap.edition().epoch()) << "'";
- } else {
- // anything else
- str << "<dep name='" << xml_escape(cap.asString()) << "'";
+ if (isKind<VersionedCap>(cap))
+ {
+ VersionedCap::constPtr vercap = asKind<VersionedCap>(cap);
+ if (
+ vercap->op() != Rel::NONE
+ && vercap->op() != Rel::ANY
+ && !vercap->edition().version().empty() ) {
+ // version capability
+ str << "<dep name='" << xml_escape(vercap->index()) << "' op='" << xml_escape(vercap->op().asString()) <<
+ "' version='" << vercap->edition().version() << "'";
+ if (!vercap->edition().release().empty())
+ str << " release='" << vercap->edition().release() << "'";
+ if (vercap->edition().epoch() != Edition::noepoch)
+ str << " epoch='" << numstring(vercap->edition().epoch()) << "'";
+ }
}
+ else
+ {
+ str << "<dep name='" << xml_escape(cap.asString()) << "'";
+ }
+
str << " kind=\"" << toLower (cap.refers().asString()) << "\""
<< " />" << endl;
${zypp2_source_SRCS}
${zypp2_SRCS}
${zypp2_cache_SRCS}
-${zypp2_source_sqlite-source_SRCS}
+#${zypp2_source_sqlite-source_SRCS}
${zypp2_cache_sqlite3x_SRCS}
)
${zypp2_source_HEADERS}
${zypp2_HEADERS}
${zypp2_cache_HEADERS}
-${zypp2_source_sqlite-source_HEADERS}
+#${zypp2_source_sqlite-source_HEADERS}
${zypp2_cache_sqlite3x_HEADERS}
)