zypper port starts. zypp2 to zypp
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Wed, 6 Jun 2007 14:42:20 +0000 (14:42 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Wed, 6 Jun 2007 14:42:20 +0000 (14:42 +0000)
21 files changed:
zypp/repo/RepoException.cc [new file with mode: 0644]
zypp/repo/RepoException.h [new file with mode: 0644]
zypp/repo/RepoType.cc [new file with mode: 0644]
zypp/repo/RepoType.h [new file with mode: 0644]
zypp/repo/RepositoryImpl.cc [new file with mode: 0644]
zypp/repo/RepositoryImpl.h [new file with mode: 0644]
zypp/repo/cached/PackageImpl.cc [new file with mode: 0644]
zypp/repo/cached/PackageImpl.h [new file with mode: 0644]
zypp/repo/cached/RepoImpl.cc [new file with mode: 0644]
zypp/repo/cached/RepoImpl.h [new file with mode: 0644]
zypp/repo/cached/SrcPackageImpl.cc [new file with mode: 0644]
zypp/repo/cached/SrcPackageImpl.h [new file with mode: 0644]
zypp/repo/dummy.cc [new file with mode: 0644]
zypp/repo/memory/PackageImpl.cc [new file with mode: 0644]
zypp/repo/memory/PackageImpl.h [new file with mode: 0644]
zypp/repo/memory/PatternImpl.cc [new file with mode: 0644]
zypp/repo/memory/PatternImpl.h [new file with mode: 0644]
zypp/repo/memory/ProductImpl.cc [new file with mode: 0644]
zypp/repo/memory/ProductImpl.h [new file with mode: 0644]
zypp/repo/memory/SrcPackageImpl.cc [new file with mode: 0644]
zypp/repo/memory/SrcPackageImpl.h [new file with mode: 0644]

diff --git a/zypp/repo/RepoException.cc b/zypp/repo/RepoException.cc
new file mode 100644 (file)
index 0000000..aeb4cb8
--- /dev/null
@@ -0,0 +1,58 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/repo/RepoException.cc
+ *
+*/
+#include <iostream>
+//#include "zypp/base/Logger.h"
+#include "zypp/repo/RepoException.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace repo
+  { /////////////////////////////////////////////////////////////////
+    RepoException::RepoException()
+    : Exception( "Repo exception" )
+    {}
+
+    RepoException::RepoException( const std::string & msg_r )
+    : Exception( msg_r )
+    {}
+
+    RepoException::~RepoException() throw()
+    {}
+    
+    RepoNotCachedException::RepoNotCachedException()
+    : RepoException( "Repository not Cached" )
+    {}
+
+    RepoNotCachedException::RepoNotCachedException( const std::string & msg_r )
+    : RepoException( msg_r )
+    {}
+
+    RepoNotCachedException::~RepoNotCachedException() throw()
+    {}
+
+
+    std::ostream & RepoException::dumpOn( std::ostream & str ) const
+    {
+      return Exception::dumpOn( str );
+    }
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace repo
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/repo/RepoException.h b/zypp/repo/RepoException.h
new file mode 100644 (file)
index 0000000..c188217
--- /dev/null
@@ -0,0 +1,109 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/parser/tagfile/RepoException.h
+ *
+*/
+#ifndef ZYPP_REPO_REPOEXCEPTION_H
+#define ZYPP_REPO_REPOEXCEPTION_H
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/base/Exception.h"
+#include "zypp/base/UserRequestException.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace repo
+  { /////////////////////////////////////////////////////////////////
+
+    /**
+     * \short Exception for repository handling.
+     */
+    class RepoException : public Exception
+    {
+    public:
+      /** Default ctor */
+      RepoException();
+      /** Ctor */
+      RepoException( const std::string & msg_r );
+        /** Dtor */
+      virtual ~RepoException() throw();
+    protected:
+      virtual std::ostream & dumpOn( std::ostream & str ) const;
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /**
+     * The repository cache is not built yet
+     * so you can't create the repostories from
+     * the cache.
+     */
+    class RepoNotCachedException : public RepoException
+    {
+    public:
+      RepoNotCachedException();
+      RepoNotCachedException( const std::string & msg_r );
+      virtual ~RepoNotCachedException() throw();
+    };
+    
+    /**
+     * thrown when it was impossible to
+     * determine one url for this repo.
+     */
+    class RepoNoUrlException : public RepoException
+    {
+    
+    };
+    
+    /**
+     * thrown when it was impossible to
+     * determine an alias for this repo.
+     */
+    class RepoNoAliasException : public RepoException
+    {
+    
+    };
+    
+    /**
+     * thrown when it was impossible to
+     * match a repository
+     */
+    class RepoNotFoundException : public RepoException
+    {
+    
+    };
+    
+    /**
+     * Repository already exists and some unique
+     * attribute can't be duplicated.
+     */
+    class RepoAlreadyExistsException : public RepoException
+    {
+    
+    };
+    
+    /**
+     * thrown when it was impossible to
+     * determine an alias for this repo.
+     */
+    class RepoUnknownTypeException : public RepoException
+    {
+    
+    };
+    
+    /////////////////////////////////////////////////////////////////
+  } // namespace parser
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_PARSER_TAGFILE_PARSEEXCEPTION_H
diff --git a/zypp/repo/RepoType.cc b/zypp/repo/RepoType.cc
new file mode 100644 (file)
index 0000000..5df9e99
--- /dev/null
@@ -0,0 +1,72 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#include <map>
+#include "zypp/base/Exception.h"
+#include "RepoType.h"
+
+namespace zypp
+{
+namespace repo
+{
+
+  static std::map<std::string,RepoType::Type> _table;
+
+  const RepoType RepoType::RPMMD(RepoType::RPMMD_e);
+  const RepoType RepoType::YAST2(RepoType::YAST2_e);
+  //const RepoType RepoType::NONE(RepoType::NONE_e);
+
+  RepoType::RepoType(const std::string & strval_r)
+    : _type(parse(strval_r))
+  {}
+
+  RepoType::Type RepoType::parse(const std::string & strval_r)
+  {
+    if (_table.empty())
+    {
+      // initialize it
+      _table["repomd"] = RepoType::RPMMD_e;
+      _table["rpmmd"] = RepoType::RPMMD_e;
+      _table["rpm-md"] = RepoType::RPMMD_e;
+      _table["yum"] = RepoType::RPMMD_e;
+      _table["susetags"] = RepoType::YAST2_e;
+      _table["yast"] = RepoType::YAST2_e;
+      _table["yast2"] = RepoType::YAST2_e;
+      _table["NONE"] = _table["none"] = RepoType::NONE_e;
+    }
+
+    std::map<std::string,RepoType::Type>::const_iterator it
+      = _table.find(strval_r);
+    if (it == _table.end())
+    {
+      ZYPP_THROW(Exception(
+        "RepoType parse: illegal string value '" + strval_r + "'"));
+    }
+    return it->second;
+  }
+
+
+  const std::string & RepoType::asString() const
+  {
+    static std::map<Type, std::string> _table;
+    if ( _table.empty() )
+    {
+      // initialize it
+      _table[RPMMD_e]   = "rpm-md";
+      _table[YAST2_e]   = "yast2";
+      _table[NONE_e] = "NONE";
+    }
+    return _table[_type];
+  }
+
+
+  } // ns repo
+} // ns zypp
+
+// vim: set ts=2 sts=2 sw=2 et ai:
diff --git a/zypp/repo/RepoType.h b/zypp/repo/RepoType.h
new file mode 100644 (file)
index 0000000..e355bdf
--- /dev/null
@@ -0,0 +1,66 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_REPO_TYPE_H_
+#define ZYPP_REPO_TYPE_H_
+
+#include <iosfwd>
+#include<string>
+
+namespace zypp
+{
+  namespace repo
+  {
+  
+  /**
+   * \short Repository type enumeration
+   *
+   * Repositories can be from varous types
+   * ...
+   */
+  struct RepoType
+  {
+    static const RepoType RPMMD;
+    static const RepoType YAST2;
+    //static const RepoType NONE;
+    
+    enum Type
+    {
+      NONE_e,
+      RPMMD_e,
+      YAST2_e
+    };
+
+    RepoType(Type type) : _type(type) {}
+
+    explicit RepoType(const std::string & strval_r);
+
+    const Type toEnum() const { return _type; }
+    
+    RepoType::Type parse(const std::string & strval_r);
+
+    const std::string & asString() const;
+
+    Type _type;
+  };
+
+
+  inline std::ostream & operator<<( std::ostream & str, const RepoType & obj )
+  { return str << obj.asString(); }
+
+  inline bool operator==(const RepoType & obj1, const RepoType & obj2)
+  { return obj1._type == obj2._type; }
+
+
+  } // ns repo
+} // ns zypp
+
+#endif
+
+// vim: set ts=2 sts=2 sw=2 et ai:
diff --git a/zypp/repo/RepositoryImpl.cc b/zypp/repo/RepositoryImpl.cc
new file mode 100644 (file)
index 0000000..93dad28
--- /dev/null
@@ -0,0 +1,35 @@
+
+#include "zypp/repo/RepositoryImpl.h"
+
+namespace zypp { namespace repo {
+
+IMPL_PTR_TYPE(RepositoryImpl)
+
+RepositoryImpl::RepositoryImpl( const RepoInfo &info )
+  : _info(info)
+{
+
+}
+
+const RepoInfo RepositoryImpl::info() const
+{
+  return _info;
+}
+
+RepositoryImpl::~RepositoryImpl()
+{
+
+}
+
+RepositoryImpl::RepositoryImpl( const null & )
+  : base::ProvideNumericId<RepositoryImpl,Repository::NumericId>( NULL )
+{}
+
+
+const ResStore & RepositoryImpl::resolvables() const
+{
+  return _store;
+}
+
+} } // ns
+
diff --git a/zypp/repo/RepositoryImpl.h b/zypp/repo/RepositoryImpl.h
new file mode 100644 (file)
index 0000000..e77e8c4
--- /dev/null
@@ -0,0 +1,75 @@
+
+
+#ifndef ZYPP_REPOSITORY_IMPL_h
+#define ZYPP_REPOSITORY_IMPL_h
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/ProvideNumericId.h"
+#include "zypp/ResStore.h"
+#include "zypp/Repository.h"
+#include "zypp/RepoInfo.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace repo
+  { /////////////////////////////////////////////////////////////////
+
+    DEFINE_PTR_TYPE(RepositoryImpl);
+
+    class RepositoryImpl : public base::ReferenceCounted,
+                           public base::ProvideNumericId<RepositoryImpl,Repository::NumericId>,
+                           private base::NonCopyable
+    {
+      friend std::ostream & operator<<( std::ostream & str, const RepositoryImpl & obj );
+    public:
+      
+      /**
+       * \short Ctor.
+       * \param info What is known about this source at construction time.
+       *
+       */
+      RepositoryImpl( const RepoInfo &info = RepoInfo() );
+      
+      /**
+       * \short Information about this repository
+       * You can't change this information after creation.
+       * Use \ref RepoManager for that.
+       */
+      const RepoInfo info() const;
+      
+      /**
+       * \short Dtor
+       */
+      ~RepositoryImpl();
+
+      const ResStore & resolvables() const;
+
+      struct null {};
+    public:
+      /** Offer default Impl. */
+      static RepositoryImpl_Ptr nullimpl()
+      {
+        static RepositoryImpl_Ptr _nullimpl( new RepositoryImpl( null() ) );
+        return _nullimpl;
+      }
+
+      RepositoryImpl( const null & );
+
+      Repository selfRepository()
+      { return Repository( this ); }
+    protected:
+      RepoInfo _info;
+      
+      ResStore _store;
+    };
+  }
+}
+
+#endif
diff --git a/zypp/repo/cached/PackageImpl.cc b/zypp/repo/cached/PackageImpl.cc
new file mode 100644 (file)
index 0000000..f2cf607
--- /dev/null
@@ -0,0 +1,101 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zmd/backend/dbrepository/PackageImpl.h
+ *
+*/
+
+#include "zypp/TranslatedText.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Logger.h"
+#include "zypp/repo/RepositoryImpl.h"
+#include "PackageImpl.h"
+
+
+using namespace std;
+using namespace zypp::detail;
+using namespace::zypp::repo;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp { namespace repo { namespace cached {
+
+///////////////////////////////////////////////////////////////////
+//
+//        CLASS NAME : PackageImpl
+//
+///////////////////////////////////////////////////////////////////
+
+/** Default ctor
+*/
+PackageImpl::PackageImpl (const data::RecordId &id, cached::RepoImpl::Ptr repository_r)
+    : _repository (repository_r)
+    , _install_only(false)
+    , _size_installed(0)
+    , _size_archive(0)
+    , _data_loaded(false)
+    , _id(id)
+{}
+
+Repository
+PackageImpl::repository() const
+{
+  return _repository->selfRepository();
+}
+
+/** Package summary */
+TranslatedText PackageImpl::summary() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+}
+
+/** Package description */
+TranslatedText PackageImpl::description() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+}
+
+PackageGroup PackageImpl::group() const
+{
+  return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "group" );
+}
+
+Pathname PackageImpl::location() const
+{
+  return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "group" );
+}
+
+ByteCount PackageImpl::size() const
+{
+  return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
+}
+
+/** */
+ByteCount PackageImpl::archivesize() const
+{
+  return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+}
+
+bool PackageImpl::installOnly() const
+{
+  return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+}
+
+unsigned PackageImpl::repositoryMediaNr() const
+{
+  return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "repositoryMediaNr" );
+}
+
+Vendor PackageImpl::vendor() const
+{
+  return "suse";
+}
+
+/////////////////////////////////////////////////////////////////
+} } } // namespace zypp::repo::cached
+///////////////////////////////////////////////////////////////////
+
diff --git a/zypp/repo/cached/PackageImpl.h b/zypp/repo/cached/PackageImpl.h
new file mode 100644 (file)
index 0000000..86cde9c
--- /dev/null
@@ -0,0 +1,66 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#ifndef zypp_repo_cached_PackageImpl_H
+#define zypp_repo_cached_PackageImpl_H
+
+#include "zypp/detail/PackageImpl.h"
+#include "zypp/repo/cached/RepoImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+namespace repo
+{ /////////////////////////////////////////////////////////////////
+namespace cached
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //        CLASS NAME : PackageImpl
+  //
+  class PackageImpl : public detail::PackageImplIf
+  {
+  public:
+
+    PackageImpl( const data::RecordId &id, repo::cached::RepoImpl::Ptr repository_r );
+    
+    virtual TranslatedText summary() const;
+    virtual TranslatedText description() const;
+    virtual ByteCount size() const;
+    virtual PackageGroup group() const;
+    virtual ByteCount archivesize() const;
+    virtual Pathname location() const;
+    virtual bool installOnly() const;
+    virtual Repository repository() const;
+    virtual unsigned repositoryMediaNr() const;
+    virtual Vendor vendor() const;
+
+  protected:
+    repo::cached::RepoImpl::Ptr _repository;
+    TranslatedText _summary;
+    TranslatedText _description;
+    PackageGroup _group;
+    Pathname _location;
+    bool _install_only;
+    unsigned _media_nr;
+
+    ByteCount _size_installed;
+    ByteCount _size_archive;
+
+    bool _data_loaded;
+    data::RecordId _id;
+  };
+  /////////////////////////////////////////////////////////////////
+} // namespace cached
+} // namespace repository
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZMD_BACKEND_DBSOURCE_DBPACKAGEIMPL_H
+
diff --git a/zypp/repo/cached/RepoImpl.cc b/zypp/repo/cached/RepoImpl.cc
new file mode 100644 (file)
index 0000000..5d109b4
--- /dev/null
@@ -0,0 +1,190 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#include <iostream>
+#include <map>
+
+#include "zypp/base/Logger.h"
+#include "zypp/base/Measure.h"
+#include "zypp/capability/Capabilities.h"
+#include "zypp/cache/ResolvableQuery.h"
+#include "zypp/detail/ResImplTraits.h"
+#include "zypp/CapFactory.h"
+
+#include "zypp/repo/cached/RepoImpl.h"
+#include "zypp/repo/cached/PackageImpl.h"
+
+
+using namespace zypp::detail;
+using namespace zypp::cache;
+using namespace std;
+using namespace sqlite3x;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace repo
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+namespace cached
+{ /////////////////////////////////////////////////////////////////
+
+RepoImpl::RepoImpl( const RepoInfo &repoinfo, const Pathname &dbdir, const data::RecordId &repository_id )
+  : RepositoryImpl(repoinfo),
+    _dbdir(dbdir),
+    _type_cache(dbdir),
+    _repository_id(repository_id),
+    _rquery(dbdir)
+{
+
+}
+
+RepoImpl::~RepoImpl()
+{
+
+}
+
+
+void RepoImpl::factoryInit()
+{
+  MIL << "Plaindir repository initialized." << std::endl;
+}
+
+void read_capabilities( sqlite3_connection &con, map<data::RecordId, NVRAD> &nvras );
+
+
+void RepoImpl::createResolvables()
+{
+  debug::Measure m("create resolvables");
+  CapFactory capfactory;
+  try
+  { 
+    sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
+    con.executenonquery("PRAGMA cache_size=8000;");
+    con.executenonquery("BEGIN;");
+
+    sqlite3_command cmd( con, "select id,name,version,release,epoch,arch,kind from resolvables where repository_id=:repository_id;");
+    cmd.bind(":repository_id", _repository_id);
+    map<data::RecordId, NVRAD> nvras;
+    
+    sqlite3_reader reader = cmd.executereader();
+    while(reader.read())
+    {
+      long long id = reader.getint64(0);
+      Dependencies deps;
+      
+      // Collect basic Resolvable data
+      nvras[id] = NVRAD( reader.getstring(1),
+                       Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ),
+                       _type_cache.archFor(reader.getint(5)),
+                       deps
+                     );
+    }
+    
+    MIL << "Done reading resolvables nvra" << endl;
+    
+    read_capabilities( con, nvras);
+    
+    for ( map<data::RecordId, NVRAD>::const_iterator it = nvras.begin(); it != nvras.end(); ++it )
+    {
+      ResImplTraits<cached::PackageImpl>::Ptr impl = new cached::PackageImpl(it->first, this);
+      Package::Ptr package = detail::makeResolvableFromImpl( it->second, impl );
+      _store.insert (package);
+    }
+    con.executenonquery("COMMIT;");
+  }
+  catch(exception &ex) {
+      cerr << "Exception Occured: " << ex.what() << endl;
+   }
+  //extract_packages_from_directory( _store, thePath, selfRepositoryRef(), true );
+   
+}
+
+
+ResolvableQuery RepoImpl::resolvableQuery()
+{
+  return _rquery;
+}
+
+void RepoImpl::read_capabilities( sqlite3_connection &con, map<data::RecordId, NVRAD> &nvras )
+{
+  CapFactory capfactory;
+  
+  
+  // precompile statements
+  
+  
+  
+//   map<data::RecordId, capability::CapabilityImpl::Ptr> named_caps;
+//   sqlite3_command select_named_cmd( con, "select v.id, c.refers_kind, n.name, v.version, v.release, v.epoch, v.relation named_capabilities v, capabilities c, names n where v.name_id=n.id and c.id=ncc.capability_id and ncc.named_capability_id=v.id;");
+//   {
+//     debug::Measure mnc("read named capabilities");
+//     sqlite3_reader reader = select_named_cmd.executereader();
+//     while  ( reader.read() )
+//     {
+//       
+//     }
+//   }
+  sqlite3_command select_named_cmd( con, "select v.refers_kind, n.name, v.version, v.release, v.epoch, v.relation, v.dependency_type, v.resolvable_id from named_capabilities v, names n where v.name_id=n.id;");
+  sqlite3_command select_file_cmd( con, "select fc.refers_kind, dn.name, fn.name, fc.dependency_type, fc.resolvable_id from file_capabilities fc, files f, dir_names dn, file_names fn where f.id=fc.file_id and f.dir_name_id=dn.id and f.file_name_id=fn.id;");
+  
+  {
+    debug::Measure mnc("read named capabilities");
+    sqlite3_reader reader = select_named_cmd.executereader();
+    while  ( reader.read() )
+    {
+      
+      Resolvable::Kind refer = _type_cache.kindFor(reader.getint(0));
+      Rel rel = _type_cache.relationFor(reader.getint(5));
+      
+      data::RecordId rid = reader.getint64(7);
+  
+      if ( rel == zypp::Rel::NONE )
+      {
+        capability::NamedCap *ncap = new capability::NamedCap( refer, reader.getstring(1) );
+        zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(6));  
+        nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(ncap) ) ); 
+      }
+      else
+      {
+        capability::VersionedCap *vcap = new capability::VersionedCap( refer, reader.getstring(1), /* rel */ rel, Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ) );
+        zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(6));
+        nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(vcap) ) ); 
+      }
+    }
+  }
+  
+  {
+    debug::Measure mnf("read file capabilities");
+    sqlite3_reader reader = select_file_cmd.executereader();
+    while  ( reader.read() )
+    {
+      Resolvable::Kind refer = _type_cache.kindFor(reader.getint(0));
+      capability::FileCap *fcap = new capability::FileCap( refer, reader.getstring(1) + "/" + reader.getstring(2) );
+      zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(3));
+      data::RecordId rid = reader.getint64(4);
+      nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(fcap) ) ); 
+    }
+  }
+  
+  MIL << nvras.size() << " capabilities" << endl;
+}
+
+
+/////////////////////////////////////////////////////////////////
+} // namespace plaindir
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace repository
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
diff --git a/zypp/repo/cached/RepoImpl.h b/zypp/repo/cached/RepoImpl.h
new file mode 100644 (file)
index 0000000..74d9027
--- /dev/null
@@ -0,0 +1,81 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_RepoImpl_H
+#define ZYPP_RepoImpl_H
+
+#include <iosfwd>
+#include <map>
+#include "zypp/Arch.h"
+#include "zypp/Rel.h"
+#include "zypp/Pathname.h"
+#include "zypp/data/RecordId.h"
+#include "zypp/repo/RepositoryImpl.h"
+#include "zypp/ResStore.h"
+#include "zypp/cache/sqlite3x/sqlite3x.hpp"
+#include "zypp/cache/CacheTypes.h"
+#include "zypp/cache/ResolvableQuery.h"
+#include "zypp/RepoInfo.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace repo
+  { /////////////////////////////////////////////////////////////////
+    ///////////////////////////////////////////////////////////////////
+    namespace cached
+    { /////////////////////////////////////////////////////////////////
+
+      ///////////////////////////////////////////////////////////////////
+      //
+      //       CLASS NAME : RepoImpl
+      //
+      /** */
+      class RepoImpl : public repo::RepositoryImpl
+      {
+      public:
+        typedef intrusive_ptr<RepoImpl>       Ptr;
+        typedef intrusive_ptr<const RepoImpl> constPtr;
+
+      public:
+        /** Default ctor */
+        RepoImpl( const RepoInfo &repoinfo, const Pathname &dbdir, const data::RecordId &repository_id );
+        /** Dtor */
+        ~RepoImpl();
+        void factoryInit();
+      public:
+        
+        cache::ResolvableQuery resolvableQuery();
+        void createResolvables();
+        
+      protected:
+        void read_capabilities( sqlite3x::sqlite3_connection &con, std::map<data::RecordId, NVRAD> &nvras );
+        Pathname _dbdir;
+        cache::CacheTypes _type_cache;
+        data::RecordId _repository_id;
+        
+        cache::ResolvableQuery _rquery;
+      };
+      ///////////////////////////////////////////////////////////////////
+
+      /////////////////////////////////////////////////////////////////
+    } // namespace cached
+    ///////////////////////////////////////////////////////////////////
+
+    using cached::RepoImpl;
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace source
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SOURCE_PLAINDIR_PLAINDIRIMPL_H
+
diff --git a/zypp/repo/cached/SrcPackageImpl.cc b/zypp/repo/cached/SrcPackageImpl.cc
new file mode 100644 (file)
index 0000000..e9fc15a
--- /dev/null
@@ -0,0 +1,97 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zmd/backend/dbsource/SrcPackageImpl.h
+ *
+*/
+
+#include "SrcPackageImpl.h"
+#include "zypp/source/SourceImpl.h"
+#include "zypp/TranslatedText.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Logger.h"
+
+using namespace std;
+using namespace zypp::detail;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp { namespace repo { namespace cached {
+
+///////////////////////////////////////////////////////////////////
+//
+//        CLASS NAME : SrcPackageImpl
+//
+///////////////////////////////////////////////////////////////////
+
+/** Default ctor
+*/
+SrcPackageImpl::SrcPackageImpl (Source_Ref source_r)
+    : _source (source_r)
+    , _install_only(false)
+    , _size_installed(0)
+    , _size_archive(0)
+    , _data_loaded(false)
+{}
+
+Source_Ref
+SrcPackageImpl::source() const
+{
+  return _source;
+}
+
+/** Package summary */
+TranslatedText SrcPackageImpl::summary() const
+{
+  return _summary;
+}
+
+/** Package description */
+TranslatedText SrcPackageImpl::description() const
+{
+  return _description;
+}
+
+PackageGroup SrcPackageImpl::group() const
+{
+  return _group;
+}
+
+Pathname SrcPackageImpl::location() const
+{
+  return _location;
+}
+
+ByteCount SrcPackageImpl::size() const
+{
+  return _size_installed;
+}
+
+/** */
+ByteCount SrcPackageImpl::archivesize() const
+{
+  return _size_archive;
+}
+
+bool SrcPackageImpl::installOnly() const
+{
+  return _install_only;
+}
+
+unsigned SrcPackageImpl::sourceMediaNr() const
+{
+  return _media_nr;
+}
+
+Vendor SrcPackageImpl::vendor() const
+{
+  return "suse";
+}
+
+/////////////////////////////////////////////////////////////////
+} } } // namespace zypp.repo.cached
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/repo/cached/SrcPackageImpl.h b/zypp/repo/cached/SrcPackageImpl.h
new file mode 100644 (file)
index 0000000..d07d6f3
--- /dev/null
@@ -0,0 +1,65 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#ifndef CachedRepoSrcPackageImpl_H
+#define CachedRepoSrcPackageImpl_H
+
+#include "zypp/detail/PackageImpl.h"
+#include "zypp/Source.h"
+//#include <sqlite3.h>
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+namespace repo
+{
+namespace cached
+{
+  ///////////////////////////////////////////////////////////////////
+  //
+  //        CLASS NAME : CachedSourcePackageImpl
+  //
+  class SrcPackageImpl : public detail::SrcPackageImplIf
+  {
+  public:
+
+    SrcPackageImpl( Source_Ref source_r );
+    
+    virtual TranslatedText summary() const;
+    virtual TranslatedText description() const;
+    virtual ByteCount size() const;
+    virtual PackageGroup group() const;
+    virtual ByteCount archivesize() const;
+    virtual Pathname location() const;
+    virtual bool installOnly() const;
+    virtual Source_Ref source() const;
+    virtual unsigned sourceMediaNr() const;
+    virtual Vendor vendor() const;
+
+  protected:
+    Source_Ref _source;
+    TranslatedText _summary;
+    TranslatedText _description;
+    PackageGroup _group;
+    Pathname _location;
+    bool _install_only;
+    unsigned _media_nr;
+
+    ByteCount _size_installed;
+    ByteCount _size_archive;
+
+    bool _data_loaded;
+  };
+  /////////////////////////////////////////////////////////////////
+} // ns cached
+} // ns repo
+} // namespace zypp
+
+///////////////////////////////////////////////////////////////////
+#endif // ZMD_BACKEND_DBSOURCE_DBPACKAGEIMPL_H
diff --git a/zypp/repo/dummy.cc b/zypp/repo/dummy.cc
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/zypp/repo/memory/PackageImpl.cc b/zypp/repo/memory/PackageImpl.cc
new file mode 100644 (file)
index 0000000..d55d04e
--- /dev/null
@@ -0,0 +1,242 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/repo/memory/PackageImpl.cc
+ *
+*/
+
+#include "zypp/repo/memory/PackageImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace repo
+{ /////////////////////////////////////////////////////////////////
+namespace memory
+{ /////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+//     METHOD NAME : PackageImpl::PackageImpl
+//     METHOD TYPE : Ctor
+//
+PackageImpl::PackageImpl(data::Package_Ptr ptr)
+    : 
+      _summary(ptr->summary),
+      _description(ptr->description),
+      _insnotify(ptr->insnotify),
+      _delnotify(ptr->delnotify),
+      _license_to_confirm(ptr->licenseToConfirm),
+      _group(ptr->group),
+      _keywords(),
+      _authors(ptr->authors),
+      _size(ptr->installedSize),
+      _archivesize(ptr->repositoryLocation.fileSize),
+      _vendor(ptr->vendor),
+      _license(ptr->license),
+      _buildtime(ptr->buildTime),
+      _media_number(ptr->repositoryLocation.mediaNr),
+      _location(ptr->repositoryLocation.filePath),
+      _diskusage(),
+      _checksum(ptr->repositoryLocation.fileChecksum)
+{
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//     METHOD NAME : PackageImpl::~PackageImpl
+//     METHOD TYPE : Dtor
+//
+PackageImpl::~PackageImpl()
+{}
+
+TranslatedText PackageImpl::summary() const
+{
+  return _summary;
+}
+
+TranslatedText PackageImpl::description() const
+{
+  return _description;
+}
+
+TranslatedText PackageImpl::insnotify() const
+{
+  return _insnotify;
+}
+
+TranslatedText PackageImpl::delnotify() const
+{
+  return _delnotify;
+}
+
+TranslatedText PackageImpl::licenseToConfirm() const
+{
+  return _license_to_confirm;
+}
+
+Source_Ref PackageImpl::source() const
+{
+  return Source_Ref::noSource;
+}
+
+unsigned PackageImpl::sourceMediaNr() const
+{
+  return _media_number;
+}
+
+CheckSum PackageImpl::checksum() const
+{
+  return _checksum;
+}
+
+Date PackageImpl::buildtime() const
+{
+  return _buildtime;
+}
+
+string PackageImpl::buildhost() const
+{
+  return string();
+}
+
+Date PackageImpl::installtime() const
+{
+  return Date();
+}                              // it was never installed
+
+string PackageImpl::distribution() const
+{
+  return string();
+}
+
+Vendor PackageImpl::vendor() const
+{
+  return string();
+}
+
+Label PackageImpl::license() const
+{
+  return _license;
+}
+
+string PackageImpl::packager() const
+{
+  return string();
+}
+
+PackageGroup PackageImpl::group() const
+{
+  return _group;
+}
+
+PackageImpl::Keywords PackageImpl::keywords() const
+{
+  return _keywords;
+}
+
+Changelog PackageImpl::changelog() const
+{
+  return Changelog();
+}
+
+Pathname PackageImpl::location() const
+{
+  return _location;
+}
+
+string PackageImpl::url() const
+{
+  return string();
+}
+
+string PackageImpl::os() const
+{
+  return string();
+}
+
+Text PackageImpl::prein() const
+{
+  return Text();
+}
+
+Text PackageImpl::postin() const
+{
+  return Text();
+}
+
+Text PackageImpl::preun() const
+{
+  return Text();
+}
+
+Text PackageImpl::postun() const
+{
+  return Text();
+}
+
+ByteCount PackageImpl::size() const
+{
+  return _size;
+}
+
+ByteCount PackageImpl::sourcesize() const
+// FIXME
+{
+  return 0;
+}
+
+ByteCount PackageImpl::archivesize() const
+{
+  return _archivesize;
+}
+
+DiskUsage PackageImpl::diskusage() const
+{
+  return _diskusage;
+}
+
+list<string> PackageImpl::authors() const
+{
+  return list<string>();
+}
+
+list<string> PackageImpl::filenames() const
+{
+  return list<string>();
+}
+
+list<detail::PackageImplIf::DeltaRpm> PackageImpl::deltaRpms() const
+{
+  return detail::PackageImplIf::deltaRpms();
+}
+
+list<detail::PackageImplIf::PatchRpm> PackageImpl::patchRpms() const
+{
+  return detail::PackageImplIf::patchRpms();
+}
+
+bool PackageImpl::installOnly() const
+{
+  return false;
+}
+
+/////////////////////////////////////////////////////////////////
+} // namespace memory
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
diff --git a/zypp/repo/memory/PackageImpl.h b/zypp/repo/memory/PackageImpl.h
new file mode 100644 (file)
index 0000000..ee31e1b
--- /dev/null
@@ -0,0 +1,111 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/repo/memory/PackageImpl.h
+ *
+*/
+#ifndef ZYPP_SOURCE_MEMORYPACKAGEIMPL_H
+#define ZYPP_SOURCE_MEMORYPACKAGEIMPL_H
+
+#include "zypp/detail/PackageImplIf.h"
+#include "zypp/Source.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/DiskUsage.h"
+#include "zypp/CheckSum.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace repo
+  { /////////////////////////////////////////////////////////////////
+    namespace memory
+    { /////////////////////////////////////////////////////////////////
+
+      DEFINE_PTR_TYPE(DImpl);
+
+      ///////////////////////////////////////////////////////////////////
+      //
+      //       CLASS NAME : PackageImpl
+      //
+      /**
+      */
+      struct PackageImpl : public zypp::detail::PackageImplIf
+      {
+        PackageImpl( data::Package_Ptr ptr );
+        virtual ~PackageImpl();
+
+        /** \name ResObject attributes. */
+        //@{
+        virtual TranslatedText summary() const;
+        virtual TranslatedText description() const;
+        virtual TranslatedText insnotify() const;
+        virtual TranslatedText delnotify() const;
+        virtual TranslatedText licenseToConfirm() const;
+        virtual Source_Ref source() const;
+        virtual unsigned sourceMediaNr() const;
+        //@}
+
+        virtual CheckSum checksum() const;
+        virtual Date buildtime() const;
+        virtual std::string buildhost() const;
+        virtual Date installtime() const;
+        virtual std::string distribution() const;
+        virtual Vendor vendor() const;
+        virtual Label license() const;
+        virtual std::string packager() const;
+        virtual PackageGroup group() const;
+        virtual Keywords keywords() const;
+       virtual Changelog changelog() const;
+        virtual Pathname location() const;
+        virtual std::string url() const;
+        virtual std::string os() const;
+        virtual Text prein() const;
+        virtual Text postin() const;
+        virtual Text preun() const;
+        virtual Text postun() const;
+        virtual ByteCount size() const;
+        virtual ByteCount sourcesize() const;
+        virtual ByteCount archivesize() const;
+        virtual DiskUsage diskusage() const;
+        virtual std::list<std::string> authors() const;
+        virtual std::list<std::string> filenames() const;
+        virtual std::list<DeltaRpm> deltaRpms() const;
+        virtual std::list<PatchRpm> patchRpms() const;
+        virtual bool installOnly() const;
+
+        TranslatedText _summary;
+        TranslatedText _description;
+        TranslatedText _insnotify;
+        TranslatedText _delnotify;
+        TranslatedText _license_to_confirm;
+        
+        PackageGroup _group;
+       Keywords _keywords;
+        std::list<std::string> _authors;
+        ByteCount _size;
+        ByteCount _archivesize;
+        Vendor _vendor;
+        Label _license;
+        Date _buildtime;
+        unsigned _media_number;
+        Pathname _location;
+        DiskUsage _diskusage;
+        CheckSum _checksum;
+private:
+      };
+      ///////////////////////////////////////////////////////////////////
+      /////////////////////////////////////////////////////////////////
+    } // namespace memory
+    /////////////////////////////////////////////////////////////////
+  } // namespace repository
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_PACKAGEIMPL_H
diff --git a/zypp/repo/memory/PatternImpl.cc b/zypp/repo/memory/PatternImpl.cc
new file mode 100644 (file)
index 0000000..ba46a21
--- /dev/null
@@ -0,0 +1,81 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/repository/memory/PatternImpl.cc
+ *
+*/
+#include "zypp/repo/memory/PatternImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace repo
+{ /////////////////////////////////////////////////////////////////
+namespace memory
+{
+///////////////////////////////////////////////////////////////////
+//
+//     METHOD NAME : PatternImpl::PatternImpl
+//     METHOD TYPE : Ctor
+//
+PatternImpl::PatternImpl(data::Pattern_Ptr ptr)
+{}
+
+///////////////////////////////////////////////////////////////////
+//
+//     METHOD NAME : PatternImpl::~PatternImpl
+//     METHOD TYPE : Dtor
+//
+PatternImpl::~PatternImpl()
+{}
+
+Source_Ref PatternImpl::source() const
+{
+  return Source_Ref::noSource;
+}
+
+TranslatedText PatternImpl::summary() const
+{
+  return _summary;
+}
+
+TranslatedText PatternImpl::description() const
+{
+  return _description;
+}
+
+TranslatedText PatternImpl::category() const
+{
+  return _category;
+}
+
+bool PatternImpl::userVisible() const
+{
+  return _visible;
+}
+
+Label PatternImpl::order() const
+{
+  return _order;
+}
+
+Pathname PatternImpl::icon() const
+{
+  return _icon;
+}
+
+/////////////////////////////////////////////////////////////////
+} // namespace detail
+///////////////////////////////////////////////////////////////////
+}
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/repo/memory/PatternImpl.h b/zypp/repo/memory/PatternImpl.h
new file mode 100644 (file)
index 0000000..10c8fff
--- /dev/null
@@ -0,0 +1,64 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/repository/memory/PatternImpl.h
+ *
+*/
+#ifndef ZYPP_DETAIL_MEMORY_PATTERNIMPL_H
+#define ZYPP_DETAIL_MEMORY_PATTERNIMPL_H
+
+#include "zypp/detail/PatternImplIf.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/Source.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace repo
+  { /////////////////////////////////////////////////////////////////
+    namespace memory
+    {
+
+      ///////////////////////////////////////////////////////////////////
+      //
+      //       CLASS NAME : PatternImpl
+      //
+      /**
+      */
+      struct PatternImpl : public zypp::detail::PatternImplIf
+      {
+public:
+        PatternImpl(data::Pattern_Ptr ptr);
+        virtual ~PatternImpl();
+
+        virtual TranslatedText summary() const;
+        virtual TranslatedText description() const;
+        virtual TranslatedText category() const;
+        virtual bool userVisible() const;
+        virtual Label order() const;
+        virtual Pathname icon() const;
+        virtual Source_Ref source() const;
+        
+        TranslatedText _summary;
+        TranslatedText _description;
+        TranslatedText _category;
+        bool           _visible;
+        std::string    _order;
+        Pathname       _icon;
+      };
+      ///////////////////////////////////////////////////////////////////
+
+      /////////////////////////////////////////////////////////////////
+    } // namespace memory
+    ///////////////////////////////////////////////////////////////////
+  } // namespace repository
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_PATTERNIMPL_H
diff --git a/zypp/repo/memory/ProductImpl.cc b/zypp/repo/memory/ProductImpl.cc
new file mode 100644 (file)
index 0000000..7f6dd79
--- /dev/null
@@ -0,0 +1,111 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/repo/memory/ProductImpl.cc
+ *
+*/
+#include "zypp/repo/memory/ProductImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace repo
+  { /////////////////////////////////////////////////////////////////
+    ///////////////////////////////////////////////////////////////////
+    namespace memory
+    { /////////////////////////////////////////////////////////////////
+
+      ///////////////////////////////////////////////////////////////////
+      //
+      //       METHOD NAME : ProductImpl::ProductImpl
+      //       METHOD TYPE : Ctor
+      //
+      ProductImpl::ProductImpl(data::Product_Ptr ptr)
+      {}
+
+      ///////////////////////////////////////////////////////////////////
+      //
+      //       METHOD NAME : ProductImpl::~ProductImpl
+      //       METHOD TYPE : Dtor
+      //
+      ProductImpl::~ProductImpl()
+      {}
+
+
+      std::string ProductImpl::category() const
+      {
+        return _category;
+      }
+
+      Label ProductImpl::vendor() const
+      {
+        return _vendor;
+      }
+
+      TranslatedText ProductImpl::summary() const
+      {
+        return _summary;
+      }
+
+      Source_Ref ProductImpl::source() const
+      {
+        return Source_Ref::noSource;
+      }
+
+      Url ProductImpl::releaseNotesUrl() const
+      {
+        return _release_notes_url;
+      }
+
+      std::list<Url> ProductImpl::updateUrls() const
+      {
+        return _update_urls;
+      }
+
+      std::list<Url> ProductImpl::extraUrls() const
+      {
+        return _extra_urls;
+      }
+      
+      std::list<Url> ProductImpl::optionalUrls() const
+      {
+        return _optional_urls;
+      }
+      
+      std::list<std::string> ProductImpl::flags() const
+      {
+        return _flags;
+      }
+
+      TranslatedText ProductImpl::shortName() const
+      {
+        return TranslatedText(_shortlabel);
+      }
+
+      std::string ProductImpl::distributionName() const
+      {
+        return _dist_name;
+      }
+
+      Edition ProductImpl::distributionEdition() const
+      {
+        return _dist_version;
+      }
+
+      /////////////////////////////////////////////////////////////////
+    } // namespace memory
+    ///////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////
+  } // namespace repository
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/repo/memory/ProductImpl.h b/zypp/repo/memory/ProductImpl.h
new file mode 100644 (file)
index 0000000..b779569
--- /dev/null
@@ -0,0 +1,102 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/repo/memory/ProductImpl.h
+ *
+*/
+#ifndef ZYPP_DETAIL_MEMORY_PRODUCTIMPL_H
+#define ZYPP_DETAIL_MEMORY_PRODUCTIMPL_H
+
+#include <map>
+
+#include "zypp/CheckSum.h"
+#include "zypp/CapSet.h"
+#include "zypp/detail/ProductImplIf.h"
+#include "zypp/Source.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/TranslatedText.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace repo
+  { /////////////////////////////////////////////////////////////////
+    ///////////////////////////////////////////////////////////////////
+    namespace memory
+    { /////////////////////////////////////////////////////////////////
+
+      ///////////////////////////////////////////////////////////////////
+      //
+      //       CLASS NAME : ProductImpl
+      //
+      /**
+      */
+      struct ProductImpl : public zypp::detail::ProductImplIf
+      {
+      public:
+        ProductImpl(data::Product_Ptr ptr);
+        virtual ~ProductImpl();
+
+        virtual std::string category() const;
+        virtual Label vendor() const;
+        virtual TranslatedText summary() const;
+        virtual Source_Ref source() const;
+        virtual Url releaseNotesUrl() const;
+        
+        virtual std::list<Url> updateUrls() const;
+        virtual std::list<Url> extraUrls() const;
+        virtual std::list<Url> optionalUrls() const;
+        
+        virtual std::list<std::string> flags() const;
+        virtual TranslatedText shortName() const;
+        virtual std::string distributionName() const;
+        virtual Edition distributionEdition() const;
+
+        std::string _category;
+
+        std::string _name;
+        std::string _version;
+        std::string _dist_name;
+        Edition     _dist_version;
+
+        std::string _base_product;
+        std::string _base_version;
+        std::string _you_type;
+        std::string _shortlabel;
+        std::string _vendor;
+        Url _release_notes_url;
+        
+        std::list<Url> _update_urls;
+        std::list<Url> _extra_urls;
+        std::list<Url> _optional_urls;
+        
+        std::map< std::string, std::list<std::string> > _arch; // map of 'arch : "arch1 arch2 arch3"', arch1 being 'best', arch3 being 'noarch' (ususally)
+        std::string _default_base;
+        Dependencies _deps;
+        std::list<std::string> _languages;
+        TranslatedText _summary;
+        std::string _description_dir;
+        std::string _data_dir;
+        std::list<std::string> _flags;
+        std::string _language;
+        std::string _timezone;
+
+        std::map<std::string, CheckSum> _descr_files_checksums;
+        std::map<std::string, CheckSum> _signing_keys;
+      };
+      ///////////////////////////////////////////////////////////////////
+
+      /////////////////////////////////////////////////////////////////
+    } // namespace memory
+    ///////////////////////////////////////////////////////////////////
+  } // namespace repository
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_PRODUCTIMPL_H
diff --git a/zypp/repo/memory/SrcPackageImpl.cc b/zypp/repo/memory/SrcPackageImpl.cc
new file mode 100644 (file)
index 0000000..ab8e770
--- /dev/null
@@ -0,0 +1,77 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/repo/memory/SrcPackageImpl.cc
+ *
+*/
+#include "zypp/repo/memory/SrcPackageImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace repo
+{ /////////////////////////////////////////////////////////////////
+namespace memory
+{ /////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+//     METHOD NAME : SrcPackageImpl::SrcPackageImpl
+//     METHOD TYPE : Ctor
+//
+SrcPackageImpl::SrcPackageImpl(data::SrcPackage_Ptr ptr)
+    : _media_number( 1 )
+{}
+
+///////////////////////////////////////////////////////////////////
+//
+//     METHOD NAME : SrcPackageImpl::~SrcPackageImpl
+//     METHOD TYPE : Dtor
+//
+SrcPackageImpl::~SrcPackageImpl()
+{}
+
+
+Pathname SrcPackageImpl::location() const
+{
+  return _location;
+}
+
+ByteCount SrcPackageImpl::archivesize() const
+{
+  return _archivesize;
+}
+
+DiskUsage SrcPackageImpl::diskusage() const
+{
+  return _diskusage;
+}
+
+Source_Ref SrcPackageImpl::source() const
+{
+  return Source_Ref::noSource;
+}
+
+unsigned SrcPackageImpl::sourceMediaNr() const
+{
+  return _media_number;
+}
+
+/////////////////////////////////////////////////////////////////
+} // namespace memory
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/repo/memory/SrcPackageImpl.h b/zypp/repo/memory/SrcPackageImpl.h
new file mode 100644 (file)
index 0000000..0ce90c0
--- /dev/null
@@ -0,0 +1,66 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/repository/memory/SrcPackageImpl.h
+ *
+*/
+#ifndef ZYPP_SOURCE_MEMORYSRCPackageIMPL_H
+#define ZYPP_SOURCE_MEMORYSRCPackageIMPL_H
+
+#include "zypp/detail/SrcPackageImplIf.h"
+#include "zypp/Source.h"
+#include "zypp/DiskUsage.h"
+#include "zypp/data/ResolvableData.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace repo
+  { /////////////////////////////////////////////////////////////////
+    namespace memory
+    { /////////////////////////////////////////////////////////////////
+
+      ///////////////////////////////////////////////////////////////////
+      //
+      //       CLASS NAME : SrcPackageImpl
+      //
+      /**
+      */
+      struct SrcPackageImpl : public zypp::detail::SrcPackageImplIf
+      {
+        SrcPackageImpl(data::SrcPackage_Ptr ptr);
+        virtual ~SrcPackageImpl();
+
+        /** */
+        virtual Pathname location() const;
+        /** */
+        virtual ByteCount archivesize() const;
+        /** */
+        virtual DiskUsage diskusage() const;
+        /** */
+        virtual unsigned sourceMediaNr() const;
+
+private:
+        ByteCount _archivesize;
+        unsigned _media_number;
+        Pathname _location;
+        DiskUsage _diskusage;
+public:
+        Source_Ref source() const;
+      };
+      ///////////////////////////////////////////////////////////////////
+      /////////////////////////////////////////////////////////////////
+    } // namespace memory
+    /////////////////////////////////////////////////////////////////
+  } // namespace repository
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SOURCE_MEMORY_SRCPACKAGEIMPL_H