backup
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Wed, 13 Jun 2007 16:24:34 +0000 (16:24 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Wed, 13 Jun 2007 16:24:34 +0000 (16:24 +0000)
18 files changed:
zypp/CMakeLists.txt
zypp/cache/schema/schema.sql
zypp/repo/PackageProvider.cc [new file with mode: 0644]
zypp/repo/PackageProvider.h [new file with mode: 0644]
zypp/repo/memory/AtomImpl.cc [new file with mode: 0644]
zypp/repo/memory/AtomImpl.h [new file with mode: 0644]
zypp/repo/memory/MessageImpl.cc [new file with mode: 0644]
zypp/repo/memory/MessageImpl.h [new file with mode: 0644]
zypp/repo/memory/PackageImpl.cc
zypp/repo/memory/PackageImpl.h
zypp/repo/memory/PatchImpl.cc [new file with mode: 0644]
zypp/repo/memory/PatchImpl.h [new file with mode: 0644]
zypp/repo/memory/PatternImpl.cc
zypp/repo/memory/PatternImpl.h
zypp/repo/memory/RepoImpl.cc [new file with mode: 0644]
zypp/repo/memory/RepoImpl.h [new file with mode: 0644]
zypp/repo/memory/ScriptImpl.cc [new file with mode: 0644]
zypp/repo/memory/ScriptImpl.h [new file with mode: 0644]

index fb8b4ea..88f5fef 100644 (file)
@@ -1115,15 +1115,19 @@ SET( zypp_repo_susetags_HEADERS
 
 SET( zypp_repo_data_SRCS
   repo/memory/PackageImpl.cc
-  repo/memory/PatternImpl.cc
-  repo/memory/ProductImpl.cc
+# repo/memory/PatternImpl.cc
+#  repo/memory/ProductImpl.cc
+#  repo/memory/PatchImpl.cc
+#  repo/memory/RepoImpl.cc
   repo/memory/SrcPackageImpl.cc
 )
 
 SET( zypp_repo_data_HEADERS
   repo/memory/PackageImpl.h
-  repo/memory/PatternImpl.h
-  repo/memory/ProductImpl.h
+#  repo/memory/PatternImpl.h
+#  repo/memory/ProductImpl.h
+#  repo/memory/PatchImpl.h
+#  repo/memory/RepoImpl.h
   repo/memory/SrcPackageImpl.h
 )
 
index 07d3be4..b443dee 100644 (file)
@@ -40,7 +40,7 @@ DROP INDEX IF EXISTS named_capabilities_name;
 CREATE TABLE db_info (
   version INTEGER
 );
-
+--INSERT INTO db_info (version) VALUES ('
 ------------------------------------------------
 -- Basic types like archs, attributes, languages
 ------------------------------------------------
@@ -168,7 +168,7 @@ CREATE TABLE delta_packages (
   , baseversion_checksum TEXT
   , baseversion_build_time INTEGER
   , baseversion_sequence_info TEXT
-
+  , repository_id INTEGER REFERENCES repositories(id)
 );
 
 CREATE TABLE patch_packages (
@@ -178,7 +178,7 @@ CREATE TABLE patch_packages (
   , checksum TEXT
   , download_size INTEGER
   , build_time INTEGER
-
+  , repository_id INTEGER REFERENCES repositories(id)
 );
 
 CREATE TABLE patch_packages_baseversions (
@@ -187,7 +187,6 @@ CREATE TABLE patch_packages_baseversions (
   , version TEXT
   , release TEXT
   , epoch INTEGER
-
 );
 
 ------------------------------------------------
diff --git a/zypp/repo/PackageProvider.cc b/zypp/repo/PackageProvider.cc
new file mode 100644 (file)
index 0000000..5ef49ba
--- /dev/null
@@ -0,0 +1,325 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/source/PackageProvider.cc
+ *
+*/
+#include <iostream>
+#include <sstream>
+#include "zypp/base/Logger.h"
+#include "zypp/base/Gettext.h"
+
+#include "zypp/Source.h"
+#include "zypp/source/PackageProvider.h"
+#include "zypp/source/SourceProvideFile.h"
+#include "zypp/source/Applydeltarpm.h"
+#include "zypp/source/PackageDelta.h"
+#include "zypp/detail/ImplConnect.h"
+
+#include "zypp/RepoInfo.h"
+#include "zypp/Repository.h"
+#include "zypp/media/MediaManager.h"
+
+using std::endl;
+using zypp::media::MediaManager;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace source
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : PackageProviderPolicy
+    //
+    ///////////////////////////////////////////////////////////////////
+
+    bool PackageProviderPolicy::queryInstalled( const std::string & name_r,
+                                                const Edition &     ed_r,
+                                                const Arch &        arch_r ) const
+    {
+      if ( _queryInstalledCB )
+        return _queryInstalledCB( name_r, ed_r, arch_r );
+      return false;
+    }
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : PackageProvider
+    //
+    ///////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    namespace
+    { /////////////////////////////////////////////////////////////////
+
+      inline std::string defRpmFileName( const Package::constPtr & package )
+      {
+        std::ostringstream ret;
+        ret << package->name() << '-' << package->edition() << '.' << package->arch() << ".rpm";
+        return ret.str();
+      }
+
+      /////////////////////////////////////////////////////////////////
+    } // namespace source
+    ///////////////////////////////////////////////////////////////////
+    PackageProvider::PackageProvider( const Package::constPtr & package,
+                                      const PackageProviderPolicy & policy_r )
+    : _policy( policy_r )
+    , _package( package )
+    , _implPtr( detail::ImplConnect::resimpl( _package ) )
+    {}
+
+    PackageProvider::~PackageProvider()
+    {}
+
+    ManagedFile PackageProvider::providePackage() const
+    {
+      Url url;
+      RepoInfo info = _package->repository().info();
+      // FIXME we only support the first url for now.
+      if ( info.baseUrls().empty() )
+        ZYPP_THROW(Exception("No url in repository."));
+      else
+        url = * info.baseUrls().begin();
+
+      MIL << "provide Package " << _package << endl;
+      ScopedGuard guardReport( newReport() );
+      ManagedFile ret;
+      do {
+        _retry = false;
+        report()->start( _package, url );
+        try  // ELIMINATE try/catch by providing a log-guard
+          {
+            ret = doProvidePackage();
+          }
+        catch ( const Exception & excpt )
+          {
+            ERR << "Failed to provide Package " << _package << endl;
+            if ( ! _retry )
+              {
+                ZYPP_RETHROW( excpt );
+              }
+          }
+      } while ( _retry );
+
+      report()->finish( _package, source::DownloadResolvableReport::NO_ERROR, std::string() );
+      MIL << "provided Package " << _package << " at " << ret << endl;
+      return ret;
+    }
+
+    ManagedFile PackageProvider::doProvidePackage() const
+    {
+      Url url;
+      RepoInfo info = _package->repository().info();
+      // FIXME we only support the first url for now.
+      if ( info.baseUrls().empty() )
+        ZYPP_THROW(Exception("No url in repository."));
+      else
+        url = * info.baseUrls().begin();
+
+      // check whether to process patch/delta rpms
+      if ( MediaManager::downloads(url) )
+        {
+          std::list<DeltaRpm> deltaRpms( _implPtr->deltaRpms() );
+          std::list<PatchRpm> patchRpms( _implPtr->patchRpms() );
+
+          if ( ! ( deltaRpms.empty() && patchRpms.empty() )
+               && queryInstalled() )
+            {
+              if ( ! deltaRpms.empty() && applydeltarpm::haveApplydeltarpm() )
+                {
+                  for( std::list<DeltaRpm>::const_iterator it = deltaRpms.begin();
+                       it != deltaRpms.end(); ++it )
+                    {
+                      DBG << "tryDelta " << *it << endl;
+                      ManagedFile ret( tryDelta( *it ) );
+                      if ( ! ret->empty() )
+                        return ret;
+                    }
+                }
+
+              if ( ! patchRpms.empty() )
+                {
+                  for( std::list<PatchRpm>::const_iterator it = patchRpms.begin();
+                       it != patchRpms.end(); ++it )
+                    {
+                      DBG << "tryPatch " << *it << endl;
+                      ManagedFile ret( tryPatch( *it ) );
+                      if ( ! ret->empty() )
+                        return ret;
+                    }
+                }
+            }
+        }
+      else
+        {
+          // allow patch rpm from local source
+          std::list<PatchRpm> patchRpms( _implPtr->patchRpms() );
+          if ( ! patchRpms.empty() && queryInstalled() )
+            {
+              for( std::list<PatchRpm>::const_iterator it = patchRpms.begin();
+                   it != patchRpms.end(); ++it )
+                {
+                  DBG << "tryPatch " << *it << endl;
+                  ManagedFile ret( tryPatch( *it ) );
+                  if ( ! ret->empty() )
+                    return ret;
+                }
+            }
+        }
+
+      // no patch/delta -> provide full package
+      ManagedFile ret;
+      OnMediaLocation loc;
+      loc.medianr( _package->mediaNr() )
+      .filename( _package->location() )
+      .checksum( _package->checksum() )
+      .downloadsize( _package->archivesize() );
+
+      ProvideFilePolicy policy;
+      policy.progressCB( bind( &PackageProvider::progressPackageDownload, this, _1 ) );
+      policy.failOnChecksumErrorCB( bind( &PackageProvider::failOnChecksumError, this ) );
+
+      return source::provideFile( url, loc, policy );
+    }
+
+    ManagedFile PackageProvider::tryDelta( const DeltaRpm & delta_r ) const
+    {
+      if ( delta_r.baseversion().edition() != Edition::noedition
+           && ! queryInstalled( delta_r.baseversion().edition() ) )
+        return ManagedFile();
+
+      if ( ! applydeltarpm::quickcheck( delta_r.baseversion().sequenceinfo() ) )
+        return ManagedFile();
+
+      report()->startDeltaDownload( delta_r.location().filename(),
+                                    delta_r.location().downloadsize() );
+      ManagedFile delta;
+      try
+        {
+          ProvideFilePolicy policy;
+          policy.progressCB( bind( &PackageProvider::progressDeltaDownload, this, _1 ) );
+          delta = source::provideFile( Url(), delta_r.location(), policy );
+        }
+      catch ( const Exception & excpt )
+        {
+          report()->problemDeltaDownload( excpt.asUserString() );
+          return ManagedFile();
+        }
+      report()->finishDeltaDownload();
+
+      report()->startDeltaApply( delta );
+      if ( ! applydeltarpm::check( delta_r.baseversion().sequenceinfo() ) )
+        {
+          report()->problemDeltaApply( _("applydeltarpm check failed.") );
+          return ManagedFile();
+        }
+
+      Pathname destination( Pathname::dirname( delta ) / defRpmFileName( _package ) );
+      /* just to ease testing with non remote sources */
+      if ( ! _package->source().remote() )
+        destination = Pathname("/tmp") / defRpmFileName( _package );
+      /**/
+
+      if ( ! applydeltarpm::provide( delta, destination,
+                                     bind( &PackageProvider::progressDeltaApply, this, _1 ) ) )
+        {
+          report()->problemDeltaApply( _("applydeltarpm failed.") );
+          return ManagedFile();
+        }
+      report()->finishDeltaApply();
+
+      return ManagedFile( destination, filesystem::unlink );
+    }
+
+    ManagedFile PackageProvider::tryPatch( const PatchRpm & patch_r ) const
+    {
+      // installed edition is in baseversions?
+      const PatchRpm::BaseVersions & baseversions( patch_r.baseversions() );
+
+      if ( std::find_if( baseversions.begin(), baseversions.end(),
+                         bind( &PackageProvider::queryInstalled, this, _1 ) )
+           == baseversions.end() )
+        return ManagedFile();
+
+      report()->startPatchDownload( patch_r.location().filename(),
+                                    patch_r.location().downloadsize() );
+      ManagedFile patch;
+      try
+        {
+          ProvideFilePolicy policy;
+          policy.progressCB( bind( &PackageProvider::progressPatchDownload, this, _1 ) );
+          patch = source::provideFile( Url(), patch_r.location(), policy );
+        }
+      catch ( const Exception & excpt )
+        {
+          report()->problemPatchDownload( excpt.asUserString() );
+          return ManagedFile();
+        }
+      report()->finishPatchDownload();
+
+      return patch;
+    }
+
+    PackageProvider::ScopedGuard PackageProvider::newReport() const
+    {
+      _report.reset( new Report );
+      return shared_ptr<void>( static_cast<void*>(0),
+                               // custom deleter calling _report.reset()
+                               // (cast required as reset is overloaded)
+                               bind( mem_fun_ref( static_cast<void (shared_ptr<Report>::*)()>(&shared_ptr<Report>::reset) ),
+                                     ref(_report) ) );
+    }
+
+    PackageProvider::Report & PackageProvider::report() const
+    { return *_report; }
+
+    bool PackageProvider::progressDeltaDownload( int value ) const
+    { return report()->progressDeltaDownload( value ); }
+
+    void PackageProvider::progressDeltaApply( int value ) const
+    { return report()->progressDeltaApply( value ); }
+
+    bool PackageProvider::progressPatchDownload( int value ) const
+    { return report()->progressPatchDownload( value ); }
+
+    bool PackageProvider::progressPackageDownload( int value ) const
+    { return report()->progress( value, _package ); }
+
+    bool PackageProvider::failOnChecksumError() const
+    {
+      std::string package_str = _package->name() + "-" + _package->edition().asString();
+
+      // TranslatorExplanation %s = package being checked for integrity
+      switch ( report()->problem( _package, source::DownloadResolvableReport::INVALID, str::form(_("Package %s fails integrity check. Do you want to retry?"), package_str.c_str() ) ) )
+        {
+        case source::DownloadResolvableReport::RETRY:
+          _retry = true;
+          break;
+          case source::DownloadResolvableReport::IGNORE:
+          ZYPP_THROW(source::SkipRequestedException("User requested skip of corrupted file"));
+          break;
+        default:
+          break;
+        }
+      return true; // anyway a failure
+    }
+
+    bool PackageProvider::queryInstalled( const Edition & ed_r ) const
+    { return _policy.queryInstalled( _package->name(), ed_r, _package->arch() ); }
+
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace source
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/repo/PackageProvider.h b/zypp/repo/PackageProvider.h
new file mode 100644 (file)
index 0000000..1ea4d2d
--- /dev/null
@@ -0,0 +1,116 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/source/PackageProvider.h
+ *
+*/
+#ifndef ZYPP_SOURCE_PACKAGEPROVIDER_H
+#define ZYPP_SOURCE_PACKAGEPROVIDER_H
+
+#include <iosfwd>
+
+#include "zypp/base/NonCopyable.h"
+
+#include "zypp/ZYppCallbacks.h"
+#include "zypp/Source.h"
+#include "zypp/Package.h"
+#include "zypp/ManagedFile.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace source
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : PackageProviderPolicy
+    //
+    /** */
+    class PackageProviderPolicy
+    {
+    public:
+      /** Get installed Editions callback signature. */
+      typedef function<bool ( const std::string &, const Edition &, const Arch & )> QueryInstalledCB;
+
+      /** Set callback. */
+      PackageProviderPolicy & queryInstalledCB( QueryInstalledCB queryInstalledCB_r )
+      { _queryInstalledCB = queryInstalledCB_r; return *this; }
+
+      /** Evaluate callback. */
+      bool queryInstalled( const std::string & name_r,
+                           const Edition &     ed_r,
+                           const Arch &        arch_r ) const;
+
+    private:
+      QueryInstalledCB _queryInstalledCB;
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : PackageProvider
+    //
+    /** Provide a package from a Source.
+     * Use available delta/patch-rpm if apropriate.
+    */
+    class PackageProvider : private base::NonCopyable
+    {
+      typedef shared_ptr<void>                                       ScopedGuard;
+      typedef callback::SendReport<source::DownloadResolvableReport> Report;
+
+      typedef detail::ResImplTraits<Package::Impl>::constPtr PackageImpl_constPtr;
+      typedef packagedelta::DeltaRpm                         DeltaRpm;
+      typedef packagedelta::PatchRpm                         PatchRpm;
+
+
+    public:
+      /** Ctor taking the Package to provide. */
+      PackageProvider( const Package::constPtr & package,
+                       const PackageProviderPolicy & policy_r = PackageProviderPolicy() );
+      ~PackageProvider();
+
+    public:
+      /** Provide the package.
+       * \throws Exception.
+      */
+      ManagedFile providePackage() const;
+
+    private:
+      ManagedFile doProvidePackage() const;
+      ManagedFile tryDelta( const DeltaRpm & delta_r ) const;
+      ManagedFile tryPatch( const PatchRpm & patch_r ) const;
+
+    private:
+      ScopedGuard newReport() const;
+      Report & report() const;
+      bool progressDeltaDownload( int value ) const;
+      void progressDeltaApply( int value ) const;
+      bool progressPatchDownload( int value ) const;
+      bool progressPackageDownload( int value ) const;
+      bool failOnChecksumError() const;
+      bool queryInstalled( const Edition & ed_r = Edition() ) const;
+
+    private:
+      PackageProviderPolicy      _policy;
+      Package::constPtr          _package;
+      PackageImpl_constPtr       _implPtr;
+      mutable bool               _retry;
+      mutable shared_ptr<Report> _report;
+
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace source
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SOURCE_PACKAGEPROVIDER_H
diff --git a/zypp/repo/memory/AtomImpl.cc b/zypp/repo/memory/AtomImpl.cc
new file mode 100644 (file)
index 0000000..28b55f7
--- /dev/null
@@ -0,0 +1,124 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#include "zypp/TranslatedText.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Logger.h"
+#include "zypp/repo/RepositoryImpl.h"
+#include "AtomImpl.h"
+
+
+using namespace std;
+using namespace zypp::detail;
+using namespace::zypp::repo;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp { namespace repo { namespace memory {
+
+///////////////////////////////////////////////////////////////////
+//
+//        CLASS NAME : AtomImpl
+//
+///////////////////////////////////////////////////////////////////
+
+/** Default ctor
+*/
+AtomImpl::AtomImpl (const data::RecordId &id, memory::RepoImpl::Ptr repository_r)
+    : _repository (repository_r),
+      _id(id)
+{}
+
+Repository
+AtomImpl::repository() const
+{
+  return _repository->selfRepository();
+}
+
+///////////////////////////////////////////////////
+// ResObject Attributes
+///////////////////////////////////////////////////
+
+TranslatedText AtomImpl::summary()
+{
+  return _summary;
+}
+
+TranslatedText AtomImpl::description()
+{
+  return _description;
+}
+
+TranslatedText AtomImpl::insnotify()
+{
+  return _insnotify;
+}
+
+TranslatedText AtomImpl::delnotify()
+{
+  return _delnotify;
+}
+
+TranslatedText AtomImpl::licenseToConfirm()
+{
+  return _license_to_confirm;
+}
+
+Vendor AtomImpl::vendor()
+{
+  return _vendor;
+}
+
+ByteCount AtomImpl::size()
+{
+  return _size;
+}
+
+ByteCount AtomImpl::archivesize()
+{
+  return _archivesize;
+}
+
+bool AtomImpl::installOnly()
+{
+  return _install_only;
+}
+
+Date AtomImpl::buildtime()
+{
+  return _buildtime;
+}
+
+Date AtomImpl::installtime()
+{
+  return _installtime;
+}
+
+unsigned AtomImpl::mediaNr()
+{
+  return _media_nr;
+}
+
+//////////////////////////////////////////
+// DEPRECATED
+//////////////////////////////////////////
+
+Source_Ref AtomImpl::source() const
+{
+  return Source_Ref::noSource;
+}
+
+unsigned AtomImpl::mediaNr() const
+{
+  return 1;
+}
+
+/////////////////////////////////////////////////////////////////
+} } } // namespace zypp::repo::memory
+///////////////////////////////////////////////////////////////////
+
diff --git a/zypp/repo/memory/AtomImpl.h b/zypp/repo/memory/AtomImpl.h
new file mode 100644 (file)
index 0000000..135bf4d
--- /dev/null
@@ -0,0 +1,74 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#ifndef zypp_repo_memory_AtomImpl_H
+#define zypp_repo_memory_AtomImpl_H
+
+#include "zypp/detail/AtomImpl.h"
+#include "zypp/repo/memory/RepoImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+namespace repo
+{ /////////////////////////////////////////////////////////////////
+namespace memory
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //        CLASS NAME : AtomImpl
+  //
+  class AtomImpl : public detail::AtomImplIf
+  {
+  public:
+
+    AtomImpl( const data::RecordId &id, repo::memory::RepoImpl::Ptr repository_r );
+    
+    virtual TranslatedText summary() const;
+    virtual TranslatedText description() const;
+    virtual TranslatedText insnotify() const;
+    virtual TranslatedText delnotify() const;
+    virtual TranslatedText licenseToConfirm() const;
+    virtual Vendor vendor() const;
+    virtual ByteCount size() const;
+    virtual ByteCount archivesize() const;
+    virtual bool installOnly() const;
+    virtual Date buildtime() const;
+    virtual Date installtime() const;
+    
+    virtual Source_Ref source() const;
+    virtual unsigned mediaNr() const;
+
+    virtual Repository repository() const;
+    
+  protected:
+    repo::memory::RepoImpl::Ptr _repository;
+    
+    //ResObject
+    TranslatedText _summary;
+    TranslatedText _description;
+    TranslatedText _insnotify;
+    TranslatedText _delnotify;
+    TranslatedText _license_to_confirm;
+    Vendor _vendor;
+    ByteCount _size;
+    ByteCount _archivesize;
+    bool _install_only;
+    Date _buildtime;
+    Date _installtime;
+    unsigned _media_nr;
+  };
+  /////////////////////////////////////////////////////////////////
+} // namespace memory
+} // namespace repository
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZMD_BACKEND_DBSOURCE_DBPACKAGEIMPL_H
+
diff --git a/zypp/repo/memory/MessageImpl.cc b/zypp/repo/memory/MessageImpl.cc
new file mode 100644 (file)
index 0000000..b40fa33
--- /dev/null
@@ -0,0 +1,139 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#include "zypp/TranslatedText.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Logger.h"
+#include "zypp/repo/RepositoryImpl.h"
+#include "MessageImpl.h"
+
+
+using namespace std;
+using namespace zypp::detail;
+using namespace::zypp::repo;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp { namespace repo { namespace memory {
+
+///////////////////////////////////////////////////////////////////
+//
+//        CLASS NAME : MessageImpl
+//
+///////////////////////////////////////////////////////////////////
+
+/** Default ctor
+*/
+MessageImpl::MessageImpl (const data::RecordId &id, memory::RepoImpl::Ptr repository_r)
+    : _repository (repository_r),
+      _id(id)
+{}
+
+Repository
+MessageImpl::repository() const
+{
+  return _repository->selfRepository();
+}
+
+///////////////////////////////////////////////////
+// ResObject Attributes
+///////////////////////////////////////////////////
+
+TranslatedText MessageImpl::summary()
+{
+  return _summary;
+}
+
+TranslatedText MessageImpl::description()
+{
+  return _description;
+}
+
+TranslatedText MessageImpl::insnotify()
+{
+  return _insnotify;
+}
+
+TranslatedText MessageImpl::delnotify()
+{
+  return _delnotify;
+}
+
+TranslatedText MessageImpl::licenseToConfirm()
+{
+  return _license_to_confirm;
+}
+
+Vendor MessageImpl::vendor()
+{
+  return _vendor;
+}
+
+ByteCount MessageImpl::size()
+{
+  return _size;
+}
+
+ByteCount MessageImpl::archivesize()
+{
+  return _archivesize;
+}
+
+bool MessageImpl::installOnly()
+{
+  return _install_only;
+}
+
+Date MessageImpl::buildtime()
+{
+  return _buildtime;
+}
+
+Date MessageImpl::installtime()
+{
+  return _installtime;
+}
+
+unsigned MessageImpl::mediaNr()
+{
+  return _media_nr;
+}
+}
+
+//////////////////////////////////////////
+// DEPRECATED
+//////////////////////////////////////////
+
+Source_Ref MessageImpl::source() const
+{
+  return Source_Ref::noSource;
+}
+
+unsigned MessageImpl::mediaNr() const
+{
+  return 1;
+}
+
+//////////////////////////////////////////
+// MESSAGE
+/////////////////////////////////////////
+
+TranslatedText MessageImpl::text() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "Message", "text" );
+}
+
+Patch::constPtr MessageImpl::patch() const
+{
+  return 0;
+}
+    
+/////////////////////////////////////////////////////////////////
+} } } // namespace zypp::repo::memory
+///////////////////////////////////////////////////////////////////
+
diff --git a/zypp/repo/memory/MessageImpl.h b/zypp/repo/memory/MessageImpl.h
new file mode 100644 (file)
index 0000000..688ecbc
--- /dev/null
@@ -0,0 +1,78 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#ifndef zypp_repo_memory_MessageImpl_H
+#define zypp_repo_memory_MessageImpl_H
+
+#include "zypp/detail/MessageImpl.h"
+#include "zypp/repo/memory/RepoImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+namespace repo
+{ /////////////////////////////////////////////////////////////////
+namespace memory
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //        CLASS NAME : MessageImpl
+  //
+  class MessageImpl : public detail::MessageImplIf
+  {
+  public:
+
+    MessageImpl( const data::RecordId &id, repo::memory::RepoImpl::Ptr repository_r );
+    
+    virtual TranslatedText summary() const;
+    virtual TranslatedText description() const;
+    virtual TranslatedText insnotify() const;
+    virtual TranslatedText delnotify() const;
+    virtual TranslatedText licenseToConfirm() const;
+    virtual Vendor vendor() const;
+    virtual ByteCount size() const;
+    virtual ByteCount archivesize() const;
+    virtual bool installOnly() const;
+    virtual Date buildtime() const;
+    virtual Date installtime() const;
+    
+    virtual Source_Ref source() const;
+    virtual unsigned mediaNr() const;
+    
+    // MESSAGE
+    virtual TranslatedText text() const;
+    virtual Patch::constPtr patch() const;
+    
+    virtual Repository repository() const;
+    
+  protected:
+    repo::memory::RepoImpl::Ptr _repository;
+    
+    //ResObject
+    TranslatedText _summary;
+    TranslatedText _description;
+    TranslatedText _insnotify;
+    TranslatedText _delnotify;
+    TranslatedText _license_to_confirm;
+    Vendor _vendor;
+    ByteCount _size;
+    ByteCount _archivesize;
+    bool _install_only;
+    Date _buildtime;
+    Date _installtime;
+    unsigned _media_nr;
+  };
+  /////////////////////////////////////////////////////////////////
+} // namespace memory
+} // namespace repository
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZMD_BACKEND_DBSOURCE_DBPACKAGEIMPL_H
+
index d55d04e..5d961c8 100644 (file)
@@ -28,25 +28,29 @@ 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)
+PackageImpl::PackageImpl( repo::memory::RepoImpl::Ptr repo, data::Package_Ptr ptr)
+    : _repository(repo),
+                  
+    _summary(ptr->summary),
+    _description(ptr->description),
+    _insnotify(ptr->insnotify),
+    _delnotify(ptr->delnotify),
+    _license_to_confirm(ptr->licenseToConfirm),
+    _vendor(ptr->vendor),
+    _size(ptr->installedSize),
+    _archivesize(ptr->repositoryLocation.fileSize),
+    _install_only(false),
+    _buildtime(ptr->buildTime),
+    _media_nr(ptr->repositoryLocation.mediaNr),
+
+    _group(ptr->group),
+    _keywords(),
+    _authors(ptr->authors),
+    _license(ptr->license),
+    _buildtime(ptr->buildTime),
+    _location(ptr->repositoryLocation.filePath),
+    _diskusage(),
+    _checksum(ptr->repositoryLocation.fileChecksum)
 {
 }
 
@@ -58,39 +62,81 @@ PackageImpl::PackageImpl(data::Package_Ptr ptr)
 PackageImpl::~PackageImpl()
 {}
 
-TranslatedText PackageImpl::summary() const
+Repository
+PackageImpl::repository() const
+{
+  return _repository->selfRepository();
+}
+
+///////////////////////////////////////////////////
+// ResObject Attributes
+///////////////////////////////////////////////////
+
+TranslatedText PackageImpl::summary()
 {
   return _summary;
 }
 
-TranslatedText PackageImpl::description() const
+TranslatedText PackageImpl::description()
 {
   return _description;
 }
 
-TranslatedText PackageImpl::insnotify() const
+TranslatedText PackageImpl::insnotify()
 {
   return _insnotify;
 }
 
-TranslatedText PackageImpl::delnotify() const
+TranslatedText PackageImpl::delnotify()
 {
   return _delnotify;
 }
 
-TranslatedText PackageImpl::licenseToConfirm() const
+TranslatedText PackageImpl::licenseToConfirm()
 {
   return _license_to_confirm;
 }
 
-Source_Ref PackageImpl::source() const
+Vendor PackageImpl::vendor()
 {
-  return Source_Ref::noSource;
+  return _vendor;
+}
+
+ByteCount PackageImpl::size()
+{
+  return _size;
+}
+
+ByteCount PackageImpl::archivesize()
+{
+  return _archivesize;
+}
+
+bool PackageImpl::installOnly()
+{
+  return _install_only;
+}
+
+Date PackageImpl::buildtime()
+{
+  return _buildtime;
+}
+
+Date PackageImpl::installtime()
+{
+  return _installtime;
 }
 
-unsigned PackageImpl::sourceMediaNr() const
+unsigned PackageImpl::mediaNr()
 {
-  return _media_number;
+  return _media_nr;
+}
+
+////////////////////////////////////////////////////
+
+Source_Ref PackageImpl::source() const
+{
+  return Source_Ref::noSource;
 }
 
 CheckSum PackageImpl::checksum() const
@@ -183,22 +229,12 @@ 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;
@@ -214,21 +250,6 @@ 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
 ///////////////////////////////////////////////////////////////////
index ee31e1b..da11505 100644 (file)
@@ -17,6 +17,8 @@
 #include "zypp/data/ResolvableData.h"
 #include "zypp/DiskUsage.h"
 #include "zypp/CheckSum.h"
+#include "zypp/Repository.h"
+#include "zypp/repo/memory/RepoImpl.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -29,34 +31,29 @@ namespace zypp
 
       DEFINE_PTR_TYPE(DImpl);
 
-      ///////////////////////////////////////////////////////////////////
-      //
-      //       CLASS NAME : PackageImpl
-      //
-      /**
-      */
       struct PackageImpl : public zypp::detail::PackageImplIf
       {
-        PackageImpl( data::Package_Ptr ptr );
+        PackageImpl(  repo::memory::RepoImpl::Ptr repo, data::Package_Ptr ptr );
         virtual ~PackageImpl();
 
-        /** \name ResObject attributes. */
-        //@{
+        virtual Repository repository() const;
+        
         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 Vendor vendor() const;
+        virtual ByteCount size() const;
+        virtual ByteCount archivesize() const;
+        virtual bool installOnly() const;
+        virtual Date buildtime() const;
+        virtual Date installtime() const;
+        virtual unsigned mediaNr() 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;
@@ -69,31 +66,31 @@ namespace zypp
         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;
-
+        
+        repo::memory::RepoImpl::Ptr _repository;
+        
+        //ResObject
         TranslatedText _summary;
         TranslatedText _description;
         TranslatedText _insnotify;
         TranslatedText _delnotify;
         TranslatedText _license_to_confirm;
+        Vendor _vendor;
+        ByteCount _size;
+        ByteCount _archivesize;
+        bool _install_only;
+        Date _buildtime;
+        Date _installtime;
+        unsigned _media_nr;
         
         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;
diff --git a/zypp/repo/memory/PatchImpl.cc b/zypp/repo/memory/PatchImpl.cc
new file mode 100644 (file)
index 0000000..54a760d
--- /dev/null
@@ -0,0 +1,143 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#include "zypp/TranslatedText.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Logger.h"
+#include "zypp/repo/RepositoryImpl.h"
+#include "PatchImpl.h"
+
+
+using namespace std;
+using namespace zypp::detail;
+using namespace::zypp::repo;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp { namespace repo { namespace memory {
+
+///////////////////////////////////////////////////////////////////
+//
+//        CLASS NAME : PatchImpl
+//
+///////////////////////////////////////////////////////////////////
+
+/** Default ctor
+*/
+PatchImpl::PatchImpl ( repo::memory::RepoImpl::Ptr repo, data::Patch_Ptr ptr)
+  : _repository(repo)
+{}
+
+Repository
+PatchImpl::repository() const
+{
+  return _repository->selfRepository();
+}
+
+///////////////////////////////////////////////////
+// ResObject Attributes
+///////////////////////////////////////////////////
+
+TranslatedText PatchImpl::summary()
+{
+  return _summary;
+}
+
+TranslatedText PatchImpl::description()
+{
+  return _description;
+}
+
+TranslatedText PatchImpl::insnotify()
+{
+  return _insnotify;
+}
+
+TranslatedText PatchImpl::delnotify()
+{
+  return _delnotify;
+}
+
+TranslatedText PatchImpl::licenseToConfirm()
+{
+  return _license_to_confirm;
+}
+
+Vendor PatchImpl::vendor()
+{
+  return _vendor;
+}
+
+ByteCount PatchImpl::size()
+{
+  return _size;
+}
+
+ByteCount PatchImpl::archivesize()
+{
+  return _archivesize;
+}
+
+bool PatchImpl::installOnly()
+{
+  return _install_only;
+}
+
+Date PatchImpl::buildtime()
+{
+  return _buildtime;
+}
+
+Date PatchImpl::installtime()
+{
+  return _installtime;
+}
+
+unsigned PatchImpl::mediaNr()
+{
+  return _media_nr;
+}
+
+//////////////////////////////////////////
+// PATCH
+/////////////////////////////////////////
+
+std::string PatchImpl::id() const
+{
+  return _repository->resolvableQuery().queryStringAttribute( _id, "Patch", "id" );
+}
+
+Date PatchImpl::timestamp() const
+{
+  return _patch_id;
+}
+
+std::string PatchImpl::category() const
+{
+  return _category;
+}
+
+bool PatchImpl::reboot_needed() const
+{
+  return _reboot_nedeed;
+}
+
+bool PatchImpl::affects_pkg_manager() const
+{
+  return _affects_pkg_manager;
+}
+
+PatchImpl::AtomList PatchImpl::all_atoms() const
+{
+  return _atoms;
+}
+
+/////////////////////////////////////////////////////////////////
+} } } // namespace zypp::repo::memory
+///////////////////////////////////////////////////////////////////
+
diff --git a/zypp/repo/memory/PatchImpl.h b/zypp/repo/memory/PatchImpl.h
new file mode 100644 (file)
index 0000000..8eebcad
--- /dev/null
@@ -0,0 +1,89 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#ifndef zypp_repo_memory_PatchImpl_H
+#define zypp_repo_memory_PatchImpl_H
+
+#include "zypp/detail/PatchImpl.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/repo/memory/RepoImpl.h"
+#include "zypp/Repository.h"
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+namespace repo
+{ /////////////////////////////////////////////////////////////////
+namespace memory
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //        CLASS NAME : PatchImpl
+  //
+  class PatchImpl : public detail::PatchImplIf
+  {
+  public:
+
+    PatchImpl( repo::memory::RepoImpl::Ptr repo, data::Patch_Ptr ptr);
+    
+    virtual TranslatedText summary() const;
+    virtual TranslatedText description() const;
+    virtual TranslatedText insnotify() const;
+    virtual TranslatedText delnotify() const;
+    virtual TranslatedText licenseToConfirm() const;
+    virtual Vendor vendor() const;
+    virtual ByteCount size() const;
+    virtual ByteCount archivesize() const;
+    virtual bool installOnly() const;
+    virtual Date buildtime() const;
+    virtual Date installtime() const;
+    virtual unsigned mediaNr() const;
+    
+    // PATCH
+    virtual std::string id() const;
+    virtual Date timestamp() const;
+    virtual std::string category() const;
+    virtual bool reboot_needed() const;
+    virtual bool affects_pkg_manager() const;
+    virtual AtomList all_atoms() const;
+       
+    virtual Repository repository() const;
+    
+  protected:
+    repo::memory::RepoImpl::Ptr _repository;
+    
+    //ResObject
+    TranslatedText _summary;
+    TranslatedText _description;
+    TranslatedText _insnotify;
+    TranslatedText _delnotify;
+    TranslatedText _license_to_confirm;
+    Vendor _vendor;
+    ByteCount _size;
+    ByteCount _archivesize;
+    bool _install_only;
+    Date _buildtime;
+    Date _installtime;
+    unsigned _media_nr;
+    
+    // patch
+    std::string _patch_id;
+    Date _timestamp;
+    std::string _category;
+    bool _reboot_needed;
+    bool _affects_pkg_manager;
+    AtomList _atoms;
+  };
+  /////////////////////////////////////////////////////////////////
+} // namespace memory
+} // namespace repository
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZMD_BACKEND_DBSOURCE_DBPACKAGEIMPL_H
+
index ba46a21..1eda2c8 100644 (file)
@@ -26,8 +26,11 @@ namespace memory
 //     METHOD NAME : PatternImpl::PatternImpl
 //     METHOD TYPE : Ctor
 //
-PatternImpl::PatternImpl(data::Pattern_Ptr ptr)
-{}
+PatternImpl::PatternImpl( repo::memory::RepoImpl::Ptr repo, data::Pattern_Ptr ptr)
+  : _repository(repo)
+{
+
+}
 
 ///////////////////////////////////////////////////////////////////
 //
@@ -37,37 +40,84 @@ PatternImpl::PatternImpl(data::Pattern_Ptr ptr)
 PatternImpl::~PatternImpl()
 {}
 
-Source_Ref PatternImpl::source() const
+TranslatedText PatternImpl::summary()
 {
-  return Source_Ref::noSource;
+  return _summary;
 }
 
-TranslatedText PatternImpl::summary() const
+TranslatedText PatternImpl::description()
 {
-  return _summary;
+  return _description;
 }
 
-TranslatedText PatternImpl::description() const
+TranslatedText PatternImpl::insnotify()
 {
-  return _description;
+  return _insnotify;
+}
+
+TranslatedText PatternImpl::delnotify()
+{
+  return _delnotify;
+}
+
+TranslatedText PatternImpl::licenseToConfirm()
+{
+  return _license_to_confirm;
+}
+
+Vendor PatternImpl::vendor()
+{
+  return _vendor;
+}
+
+ByteCount PatternImpl::size()
+{
+  return _size;
+}
+
+ByteCount PatternImpl::archivesize()
+{
+  return _archivesize;
+}
+
+bool PatternImpl::installOnly()
+{
+  return _install_only;
+}
+
+Date PatternImpl::buildtime()
+{
+  return _buildtime;
+}
+
+Date PatternImpl::installtime()
+{
+  return _installtime;
 }
 
-TranslatedText PatternImpl::category() const
+unsigned PatternImpl::mediaNr()
+{
+  return _media_nr;
+}
+
+///////////////////////////////////////
+
+TranslatedText PatternImpl::category()
 {
   return _category;
 }
 
-bool PatternImpl::userVisible() const
+bool PatternImpl::userVisible()
 {
   return _visible;
 }
 
-Label PatternImpl::order() const
+Label PatternImpl::order()
 {
   return _order;
 }
 
-Pathname PatternImpl::icon() const
+Pathname PatternImpl::icon()
 {
   return _icon;
 }
index 10c8fff..ec7c1b8 100644 (file)
@@ -33,20 +33,43 @@ namespace zypp
       */
       struct PatternImpl : public zypp::detail::PatternImplIf
       {
-public:
-        PatternImpl(data::Pattern_Ptr ptr);
+      public:
+        PatternImpl( repo::memory::RepoImpl::Ptr repo, data::Pattern_Ptr ptr);
         virtual ~PatternImpl();
 
         virtual TranslatedText summary() const;
         virtual TranslatedText description() const;
-        virtual TranslatedText category() const;
+        virtual TranslatedText insnotify() const;
+        virtual TranslatedText delnotify() const;
+        virtual TranslatedText licenseToConfirm() const;
+        virtual Vendor vendor() const;
+        virtual ByteCount size() const;
+        virtual ByteCount archivesize() const;
+        virtual bool installOnly() const;
+        virtual Date buildtime() const;
+        virtual Date installtime() const;
+        virtual unsigned mediaNr() const;
+        
         virtual bool userVisible() const;
         virtual Label order() const;
         virtual Pathname icon() const;
-        virtual Source_Ref source() const;
+      private:
         
+        //ResObject
         TranslatedText _summary;
         TranslatedText _description;
+        TranslatedText _insnotify;
+        TranslatedText _delnotify;
+        TranslatedText _license_to_confirm;
+        Vendor _vendor;
+        ByteCount _size;
+        ByteCount _archivesize;
+        bool _install_only;
+        Date _buildtime;
+        Date _installtime;
+        unsigned _media_nr;
+        
+        // Pattern
         TranslatedText _category;
         bool           _visible;
         std::string    _order;
diff --git a/zypp/repo/memory/RepoImpl.cc b/zypp/repo/memory/RepoImpl.cc
new file mode 100644 (file)
index 0000000..c94431a
--- /dev/null
@@ -0,0 +1,83 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ 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/Package.h"
+#include "zypp/Pattern.h"
+#include "zypp/Patch.h"
+#include "zypp/Message.h"
+#include "zypp/Script.h"
+#include "zypp/Atom.h"
+
+#include "zypp/repo/memory/RepoImpl.h"
+
+#include "zypp/repo/memory/PackageImpl.h"
+#include "zypp/repo/memory/PatternImpl.h"
+#include "zypp/repo/memory/PatchImpl.h"
+#include "zypp/repo/memory/MessageImpl.h"
+#include "zypp/repo/memory/ScriptImpl.h"
+#include "zypp/repo/memory/AtomImpl.h"
+
+using namespace zypp::detail;
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace repo
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+namespace memory
+{ /////////////////////////////////////////////////////////////////
+
+RepoImpl::RepoImpl( const RepoInfo &repoinfo )
+  : RepositoryImpl(repoinfo)
+{
+
+}
+
+RepoImpl::~RepoImpl()
+{
+
+}
+
+
+void RepoImpl::factoryInit()
+{
+  MIL << "in-memory repository initialized." << std::endl;
+}
+
+void RepoImpl::createResolvables()
+{
+}
+
+void RepoImpl::createPatchAndDeltas()
+{
+}
+
+/////////////////////////////////////////////////////////////////
+} // namespace memory
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace repository
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
diff --git a/zypp/repo/memory/RepoImpl.h b/zypp/repo/memory/RepoImpl.h
new file mode 100644 (file)
index 0000000..9f9a76c
--- /dev/null
@@ -0,0 +1,70 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_RepoImpl_H
+#define ZYPP_RepoImpl_H
+
+#include <iosfwd>
+#include <map>
+#include <utility>
+#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 memory
+    { /////////////////////////////////////////////////////////////////
+
+      class RepoImpl : public repo::RepositoryImpl
+      {
+      public:
+        typedef intrusive_ptr<RepoImpl>       Ptr;
+        typedef intrusive_ptr<const RepoImpl> constPtr;
+
+      public:
+        /** Default ctor */
+        RepoImpl( const RepoInfo &repoinfo);
+        /** Dtor */
+        ~RepoImpl();
+        void factoryInit();
+      public:
+        
+        void createResolvables();
+        void createPatchAndDeltas();
+      protected:
+      };
+      ///////////////////////////////////////////////////////////////////
+
+      /////////////////////////////////////////////////////////////////
+    } // namespace memory
+    ///////////////////////////////////////////////////////////////////
+
+    using memory::RepoImpl;
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace source
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif
+
diff --git a/zypp/repo/memory/ScriptImpl.cc b/zypp/repo/memory/ScriptImpl.cc
new file mode 100644 (file)
index 0000000..21fc8ba
--- /dev/null
@@ -0,0 +1,130 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#include "zypp/TranslatedText.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Logger.h"
+#include "zypp/repo/RepositoryImpl.h"
+#include "ScriptImpl.h"
+
+
+using namespace std;
+using namespace zypp::detail;
+using namespace::zypp::repo;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp { namespace repo { namespace memory {
+
+///////////////////////////////////////////////////////////////////
+//
+//        CLASS NAME : ScriptImpl
+//
+///////////////////////////////////////////////////////////////////
+
+/** Default ctor
+*/
+ScriptImpl::ScriptImpl (const data::RecordId &id, memory::RepoImpl::Ptr repository_r)
+    : _repository (repository_r),
+      _id(id)
+{}
+
+Repository
+ScriptImpl::repository() const
+{
+  return _repository->selfRepository();
+}
+
+///////////////////////////////////////////////////
+// ResObject Attributes
+///////////////////////////////////////////////////
+
+TranslatedText ScriptImpl::summary()
+{
+  return _summary;
+}
+
+TranslatedText ScriptImpl::description()
+{
+  return _description;
+}
+
+TranslatedText ScriptImpl::insnotify()
+{
+  return _insnotify;
+}
+
+TranslatedText ScriptImpl::delnotify()
+{
+  return _delnotify;
+}
+
+TranslatedText ScriptImpl::licenseToConfirm()
+{
+  return _license_to_confirm;
+}
+
+Vendor ScriptImpl::vendor()
+{
+  return _vendor;
+}
+
+ByteCount ScriptImpl::size()
+{
+  return _size;
+}
+
+ByteCount ScriptImpl::archivesize()
+{
+  return _archivesize;
+}
+
+bool ScriptImpl::installOnly()
+{
+  return _install_only;
+}
+
+Date ScriptImpl::buildtime()
+{
+  return _buildtime;
+}
+
+Date ScriptImpl::installtime()
+{
+  return _installtime;
+}
+
+unsigned ScriptImpl::mediaNr()
+{
+  return _media_nr;
+}
+
+//////////////////////////////////////////
+// MESSAGE
+/////////////////////////////////////////
+
+Pathname ScriptImpl::do_script() const
+{
+  return Pathname();
+}
+
+Pathname ScriptImpl::undo_script() const
+{
+  return Pathname();
+}
+
+bool ScriptImpl::undo_available() const
+{
+  return false;
+}
+    
+
+/////////////////////////////////////////////////////////////////
+} } } // namespace zypp::repo::memory
+///////////////////////////////////////////////////////////////////
+
diff --git a/zypp/repo/memory/ScriptImpl.h b/zypp/repo/memory/ScriptImpl.h
new file mode 100644 (file)
index 0000000..2deccff
--- /dev/null
@@ -0,0 +1,79 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#ifndef zypp_repo_memory_ScriptImpl_H
+#define zypp_repo_memory_ScriptImpl_H
+
+#include "zypp/detail/ScriptImpl.h"
+#include "zypp/repo/memory/RepoImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+namespace repo
+{ /////////////////////////////////////////////////////////////////
+namespace memory
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //        CLASS NAME : ScriptImpl
+  //
+  class ScriptImpl : public detail::ScriptImplIf
+  {
+  public:
+
+    ScriptImpl( const data::RecordId &id, repo::memory::RepoImpl::Ptr repository_r );
+    
+    virtual TranslatedText summary() const;
+    virtual TranslatedText description() const;
+    virtual TranslatedText insnotify() const;
+    virtual TranslatedText delnotify() const;
+    virtual TranslatedText licenseToConfirm() const;
+    virtual Vendor vendor() const;
+    virtual ByteCount size() const;
+    virtual ByteCount archivesize() const;
+    virtual bool installOnly() const;
+    virtual Date buildtime() const;
+    virtual Date installtime() const;
+    
+    virtual Source_Ref source() const;
+    virtual unsigned mediaNr() const;
+    
+    // SCRIPT
+    virtual Pathname do_script() const;
+    virtual Pathname undo_script() const;
+    virtual bool undo_available() const;
+      
+    virtual Repository repository() const;
+    
+  protected:
+    repo::memory::RepoImpl::Ptr _repository;
+    
+    //ResObject
+    TranslatedText _summary;
+    TranslatedText _description;
+    TranslatedText _insnotify;
+    TranslatedText _delnotify;
+    TranslatedText _license_to_confirm;
+    Vendor _vendor;
+    ByteCount _size;
+    ByteCount _archivesize;
+    bool _install_only;
+    Date _buildtime;
+    Date _installtime;
+    unsigned _media_nr;
+  };
+  /////////////////////////////////////////////////////////////////
+} // namespace memory
+} // namespace repository
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZMD_BACKEND_DBSOURCE_DBPACKAGEIMPL_H
+