Mailinglist Archive: zypp-commit (301 mails)

< Previous Next >
[zypp-commit] r7591 - in /branches/use-solv/libzypp/zypp: ./ capability/ detail/ repo/cached/ solver/detail/ target/rpm/
  • From: matz@xxxxxxxxxxxxxxxx
  • Date: Sun, 21 Oct 2007 14:27:10 -0000
  • Message-id: <20071021142710.D65EF23E07@xxxxxxxxxxxxxxxx>
Author: matz
Date: Sun Oct 21 16:27:10 2007
New Revision: 7591

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7591&view=rev
Log:
Capability is Id based now, with no further subclasses.  Quite some
functionality is missing now.

Modified:
    branches/use-solv/libzypp/zypp/CapFactory.cc
    branches/use-solv/libzypp/zypp/CapFactory.h
    branches/use-solv/libzypp/zypp/Capability.cc
    branches/use-solv/libzypp/zypp/Capability.h
    branches/use-solv/libzypp/zypp/TODO.use-solv
    branches/use-solv/libzypp/zypp/capability/CapabilityImpl.h
    branches/use-solv/libzypp/zypp/capability/SplitCap.cc
    branches/use-solv/libzypp/zypp/detail/ResolvableImpl.cc
    branches/use-solv/libzypp/zypp/repo/cached/RepoImpl.cc
    branches/use-solv/libzypp/zypp/solver/detail/Testcase.cc
    branches/use-solv/libzypp/zypp/target/rpm/RpmDb.cc

Modified: branches/use-solv/libzypp/zypp/CapFactory.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/CapFactory.cc?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/CapFactory.cc (original)
+++ branches/use-solv/libzypp/zypp/CapFactory.cc Sun Oct 21 16:27:10 2007
@@ -183,6 +183,7 @@
   //   METHOD NAME : CapFactory::fromImpl
   //   METHOD TYPE : Capability
   //
+#if 0
   Capability CapFactory::fromImpl( capability::CapabilityImpl::Ptr impl ) const
   try
   {
@@ -193,6 +194,12 @@
     ZYPP_RETHROW( excpt );
     return Capability(); // not reached
   }
+#endif
+
+  Capability CapFactory::fromId (Id id)
+  {
+    return Capability (id);
+  }
 
 #if 0
   ///////////////////////////////////////////////////////////////////
@@ -308,7 +315,7 @@
   //
   std::string CapFactory::encode( const Capability & cap_r ) const
   {
-    return cap_r._pimpl->encode();
+    return cap_r.asString();
   }
 
   /******************************************************************

Modified: branches/use-solv/libzypp/zypp/CapFactory.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/CapFactory.h?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/CapFactory.h (original)
+++ branches/use-solv/libzypp/zypp/CapFactory.h Sun Oct 21 16:27:10 2007
@@ -19,6 +19,8 @@
 #include "zypp/Capability.h"
 #include "zypp/capability/CapabilityImpl.h"
 
+#include "pool.h"
+
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
@@ -52,7 +54,8 @@
      * \a impl is a valid \ref CapabilityImpl Ptr
      * \throw EXCEPTION on null capability
     */
-    Capability fromImpl( capability::CapabilityImpl::Ptr impl ) const;
+    //Capability fromImpl( capability::CapabilityImpl::Ptr impl ) const;
+    Capability fromId (Id id);
 
 #if 0
     /** Parse Capability from string providing Resolvable::Kind.

Modified: branches/use-solv/libzypp/zypp/Capability.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/Capability.cc?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/Capability.cc (original)
+++ branches/use-solv/libzypp/zypp/Capability.cc Sun Oct 21 16:27:10 2007
@@ -21,6 +21,8 @@
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
+  extern Pool *the_pool;
+
   const Capability Capability::noCap;
 
   ///////////////////////////////////////////////////////////////////
@@ -29,7 +31,7 @@
   //   METHOD TYPE : Ctor
   //
   Capability::Capability()
-  : _pimpl( capability::NullCap::instance() )
+  : id( ID_NULL )
   {}
 
   ///////////////////////////////////////////////////////////////////
@@ -37,8 +39,8 @@
   //   METHOD NAME : Capability::Capability
   //   METHOD TYPE : Ctor
   //
-  Capability::Capability( Impl_Ptr impl_r )
-  : _pimpl( impl_r )
+  Capability::Capability( Id _id )
+  : id( _id )
   {}
 
   ///////////////////////////////////////////////////////////////////
@@ -50,22 +52,22 @@
   {}
 
   const Capability::Kind & Capability::kind() const
-  { return _pimpl->kind(); }
+  { return capability::CapTraits<capability::NullCap>::kind; }
 
   const Resolvable::Kind & Capability::refers() const
-  { return _pimpl->refers(); }
+  { return ResTraits<Package>::kind; }
 
   bool Capability::relevant() const
-  { return _pimpl->relevant(); }
+  { return true; }
 
   CapMatch Capability::matches( const Capability & rhs ) const
-  { return _pimpl->matches( rhs._pimpl.getPtr() ); }
+  { return CapMatch::irrelevant; /* _pimpl->matches( rhs._pimpl.getPtr() );*/ }
 
   std::string Capability::asString() const
-  { return _pimpl->asString(); }
+  { return dep2str (the_pool, id); /*_pimpl->asString();*/ }
 
   std::string Capability::index() const
-  { return _pimpl->index(); }
+  { return id2str (the_pool, id); /*_pimpl->index();*/ }
 
 //   Rel Capability::op() const
 //   { return _pimpl->op(); }
@@ -80,7 +82,7 @@
   */
   std::ostream & operator<<( std::ostream & str, const Capability & obj )
   {
-    return str << obj._pimpl;
+    return str << dep2str (the_pool, obj.id); //_pimpl;
   }
 
   /////////////////////////////////////////////////////////////////

Modified: branches/use-solv/libzypp/zypp/Capability.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/Capability.h?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/Capability.h (original)
+++ branches/use-solv/libzypp/zypp/Capability.h Sun Oct 21 16:27:10 2007
@@ -20,13 +20,15 @@
 #include "zypp/Resolvable.h"
 #include "zypp/CapMatch.h"
 
+#include "pool.h"
+
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
   ///////////////////////////////////////////////////////////////////
   namespace capability
   { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(CapabilityImpl);
+    //DEFINE_PTR_TYPE(CapabilityImpl);
     /////////////////////////////////////////////////////////////////
   } // namespace capability
   ///////////////////////////////////////////////////////////////////
@@ -120,22 +122,24 @@
     std::string index() const;
 
   private:
-    typedef capability::CapabilityImpl          Impl;
+    /*typedef capability::CapabilityImpl          Impl;
     typedef capability::CapabilityImpl_Ptr      Impl_Ptr ;
-    typedef capability::CapabilityImpl_constPtr Impl_constPtr;
+    typedef capability::CapabilityImpl_constPtr Impl_constPtr;*/
 
     /** Factory */
     friend class CapFactory;
 
     /** Factory ctor */
-    explicit
-    Capability( Impl_Ptr impl_r );
+    /*explicit
+    Capability( Impl_Ptr impl_r );*/
+    Capability( Id );
 
   private:
+    Id id;
     /** */
-    friend class capability::CapabilityImpl;
+    //friend class capability::CapabilityImpl;
     /** Pointer to implementation */
-    RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
+    //RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
   };
   ///////////////////////////////////////////////////////////////////
 
@@ -153,14 +157,14 @@
   struct CapOrder : public std::binary_function<Capability, Capability, bool>
   {
     bool operator()( const Capability & lhs, const Capability & rhs ) const
-    { return lhs._pimpl.get() < rhs._pimpl.get(); }
+    { return lhs.id < rhs.id; /*lhs._pimpl.get() < rhs._pimpl.get();*/ }
   };
 
   ///////////////////////////////////////////////////////////////////
 
   /** \relates Capability  */
   inline bool operator==( const Capability & lhs, const Capability & rhs )
-  { return lhs._pimpl.get() == rhs._pimpl.get(); }
+  { return lhs.id == rhs.id; /*lhs._pimpl.get() == rhs._pimpl.get();*/ }
 
   /** \relates Capability  */
   inline bool operator!=( const Capability & lhs, const Capability & rhs )

Modified: branches/use-solv/libzypp/zypp/TODO.use-solv
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/TODO.use-solv?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/TODO.use-solv (original)
+++ branches/use-solv/libzypp/zypp/TODO.use-solv Sun Oct 21 16:27:10 2007
@@ -38,3 +38,10 @@
 target/store/XMLFilesBackend.cc : uses factory.parse to add requires from
    patch to atoms, and in XMLFilesBackend::createCapability
 target/rpm/RpmDb : uses factory.parse for fiddling with filereqs
+solver/detail/Testcase.cc : helixXML(const Capability &cap) want to access
+   the Cap details to write as string.
+capability/SplitCap.cc : handle getSplitInfo in ::Capability
+Capability.cc : rewrite Capability::matches, remove Capability::index, rewrite
+   other members
+CapFactory.cc : encode() needs to emit a string representation of Cap
+   which can be parsed back.

Modified: branches/use-solv/libzypp/zypp/capability/CapabilityImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/capability/CapabilityImpl.h?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/capability/CapabilityImpl.h (original)
+++ branches/use-solv/libzypp/zypp/capability/CapabilityImpl.h Sun Oct 21 16:27:10 2007
@@ -122,10 +122,6 @@
       /** Solver hack. */
       static SplitInfo getSplitInfo( const Capability & cap );
 
-      /** Access to Capability details. */
-      static constPtr backdoor( const Capability & cap )
-      { return cap._pimpl.getPtr(); }
-
     protected:
       /** Ctor taking the kind of Resolvable \c this refers to.*/
       CapabilityImpl( const Resolvable::Kind & refers_r );
@@ -298,11 +294,6 @@
       inline intrusive_ptr<_Cap> asKind( const CapabilityImpl::Ptr & cap )
       { return dynamic_pointer_cast<_Cap>(cap); }
 
-    /** Access to Capability details. */
-    template<class _Cap>
-      inline intrusive_ptr<const _Cap> asKind( const Capability & cap )
-      { return dynamic_pointer_cast<const _Cap>( CapabilityImpl::backdoor(cap) ); }
-
     ///////////////////////////////////////////////////////////////////
 
     /** Ordering relation used by ::CapFactory to unify CapabilityImpl. */

Modified: branches/use-solv/libzypp/zypp/capability/SplitCap.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/capability/SplitCap.cc?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/capability/SplitCap.cc (original)
+++ branches/use-solv/libzypp/zypp/capability/SplitCap.cc Sun Oct 21 16:27:10 2007
@@ -40,12 +40,13 @@
     CapabilityImpl::SplitInfo CapabilityImpl::getSplitInfo( const Capability & cap )
     {
       SplitInfo ret;
-      intrusive_ptr<const SplitCap> splitPtr( asKind<SplitCap>( cap._pimpl.getPtr() ) );
+      // XXX
+      /*intrusive_ptr<const SplitCap> splitPtr( asKind<SplitCap>( cap._pimpl.getPtr() ) );
       if ( splitPtr )
         {
           ret.name = splitPtr->name();
           ret.path = splitPtr->path();
-        }
+        }*/
       return ret;
     }
     /////////////////////////////////////////////////////////////////

Modified: branches/use-solv/libzypp/zypp/detail/ResolvableImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/detail/ResolvableImpl.cc?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/detail/ResolvableImpl.cc (original)
+++ branches/use-solv/libzypp/zypp/detail/ResolvableImpl.cc Sun Oct 21 16:27:10 2007
@@ -187,6 +187,7 @@
     // see bugzilla #190163
     //
 
+#if 0
     std::string findKernelFlavor( const CapSet & cset, const Dep & dep )
     {
       for ( CapSet::iterator it = cset.begin(); it != cset.end(); ++it )
@@ -208,7 +209,6 @@
       return "";
     }
 
-#if 0
     void rewriteKernelDeps( Dependencies & deps )
     {
       // check the smaller set (requires) first

Modified: branches/use-solv/libzypp/zypp/repo/cached/RepoImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/repo/cached/RepoImpl.cc?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/repo/cached/RepoImpl.cc (original)
+++ branches/use-solv/libzypp/zypp/repo/cached/RepoImpl.cc Sun Oct 21 16:27:10 2007
@@ -185,65 +185,7 @@
        }
       else
         {
-         const char *name = id2str (pool, id);
-         capability::CapabilityImpl::Ptr capi;
-         if (name[0] == '/')
-           {
-             capi = new capability::FileCap (ResTraits<Package>::kind, name);
-           }
-         else if (!strncmp (name, "hal(", 4))
-           {
-             char * modname = strdup (name + 4);
-             if (strlen (modname))
-               modname[strlen (modname) - 1] = 0;
-             capi = new capability::HalCap (ResTraits<SystemResObject>::kind, modname);
-             free (modname);
-           }
-         else if (!strncmp (name, "modalias(", 9))
-           {
-             char * modname = strdup (name + 9);
-             if (strlen (modname))
-               modname[strlen (modname) - 1] = 0;
-             capi = new capability::ModaliasCap (ResTraits<SystemResObject>::kind, modname);
-             free (modname);
-           }
-         else if (!strncmp (name, "filesystem(", 11))
-           {
-             char * modname = strdup (name + 11);
-             if (strlen (modname))
-               modname[strlen (modname) - 1] = 0;
-             capi = new capability::FilesystemCap (ResTraits<SystemResObject>::kind, modname);
-             free (modname);
-           }
-         else if (!ISRELDEP (id))
-           {
-             Resolvable::Kind refer = kind_for_name (name, 1);
-             capi = new capability::NamedCap (refer, name);
-           }
-         else
-           {
-             Reldep *rd = GETRELDEP (pool, id);
-             Resolvable::Kind refer = kind_for_name (name, 1);
-             Rel rel = flag2rel[rd->flags & 7];
-             Edition ed;
-             if (id2ed.find (rd->evr) != id2ed.end())
-               ed = id2ed[rd->evr];
-             else
-               {
-                 /* ??? catch exception here? */
-                 ed = Edition (rd->evr);
-                 id2ed[rd->evr] = ed;
-               }
-              capi = new capability::VersionedCap( refer, name, rel, ed );
-           }
-
-         //snprintf(buf, sizeof(buf), "%s%s%s", name, id2rel(pool, id), id2evr(pool, id));
-         /* XXX Bah, we need the kind of the thing referred _to_ :-(
-            Do something about the kind stuff, s->name contains it,
-            but zypp wants to have it as extra field.  */
-         //cerr << "doing cap " << id << ": " << buf << endl;
-         //capability::CapabilityImpl::Ptr capi = capability::parse (refer, buf);
-         Capability cap = factory.fromImpl(capi);
+         Capability cap = factory.fromId(id);
          id2cap[id] = cap;
           caps.insert (cap);
         }

Modified: branches/use-solv/libzypp/zypp/solver/detail/Testcase.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/solver/detail/Testcase.cc?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/solver/detail/Testcase.cc (original)
+++ branches/use-solv/libzypp/zypp/solver/detail/Testcase.cc Sun Oct 21 16:27:10 2007
@@ -95,6 +95,7 @@
 std::string helixXML( const Capability &cap )
 {
     stringstream str;
+#if 0
     VersionedCap::constPtr vercap = asKind<VersionedCap>(cap);
     if (vercap
        && vercap->op() != Rel::NONE
@@ -110,6 +111,7 @@
            str << " epoch='" << numstring(vercap->edition().epoch()) << "'";*/
     }
     else
+#endif
     {
       str << "<dep name='" << xml_escape(cap.asString()) << "'";
     }

Modified: branches/use-solv/libzypp/zypp/target/rpm/RpmDb.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/target/rpm/RpmDb.cc?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/target/rpm/RpmDb.cc (original)
+++ branches/use-solv/libzypp/zypp/target/rpm/RpmDb.cc Sun Oct 21 16:27:10 2007
@@ -1146,6 +1146,7 @@
   return empty_list;
 }
 
+#if 0
 inline static void insertCaps( CapSet &capset, capability::CapabilityImplPtrSet ptrset, CapFactory &factory )
 {
   for ( capability::CapabilityImplPtrSet::const_iterator it = ptrset.begin();
@@ -1155,6 +1156,7 @@
     capset.insert( factory.fromImpl(*it) );
   }
 }
+#endif
 
 //
 // make Package::Ptr from RpmHeader
@@ -1345,37 +1347,7 @@
        }
       else
         {
-         const char *name = id2str (pool, id);
-         capability::CapabilityImpl::Ptr capi;
-         if (name[0] == '/')
-           {
-             capi = new capability::FileCap (ResTraits<Package>::kind, name);
-           }
-         /* ??? The normal target::rpm code doesn't look at the specific
-            kind of the dependencies (hal/modalias/filesystem).  */
-         else if (!ISRELDEP (id))
-           {
-             Resolvable::Kind refer = kind_for_name (name, 1);
-             capi = new capability::NamedCap (refer, name);
-           }
-         else
-           {
-             Reldep *rd = GETRELDEP (pool, id);
-             Resolvable::Kind refer = kind_for_name (name, 1);
-             Rel rel = flag2rel[rd->flags & 7];
-             Edition ed;
-             if (id2ed.find (rd->evr) != id2ed.end())
-               ed = id2ed[rd->evr];
-             else
-               {
-                 /* ??? catch exception here? */
-                 ed = Edition (rd->evr);
-                 id2ed[rd->evr] = ed;
-               }
-              capi = new capability::VersionedCap( refer, name, rel, ed );
-           }
-
-         Capability cap = factory.fromImpl(capi);
+         Capability cap = factory.fromId( id );
          id2cap[id] = cap;
           caps.insert (cap);
         }

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages