Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / sat / Pool.cc
index 831c4af..35d8621 100644 (file)
@@ -9,19 +9,8 @@
 /** \file      zypp/sat/Pool.cc
  *
 */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-extern "C"
-{
-#include <solv/pool.h>
-#include <solv/repo.h>
-#include <solv/solvable.h>
-}
 
 #include <iostream>
-#include <fstream>
 
 #include "zypp/base/Easy.h"
 #include "zypp/base/Logger.h"
@@ -34,8 +23,6 @@ extern "C"
 #include "zypp/sat/Pool.h"
 #include "zypp/sat/LookupAttr.h"
 
-using std::endl;
-
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
@@ -46,7 +33,7 @@ namespace zypp
     const std::string & Pool::systemRepoAlias()
     { return detail::PoolImpl::systemRepoAlias(); }
 
-    detail::CPool * Pool::get() const
+    ::_Pool * Pool::get() const
     { return myPool().getPool(); }
 
     Pool::size_type Pool::capacity() const
@@ -58,6 +45,9 @@ namespace zypp
     void Pool::prepare() const
     { return myPool().prepare(); }
 
+    void Pool::prepareForSolving() const
+    { return myPool().prepareForSolving(); }
+
     Pathname Pool::rootDir() const
     { return myPool().rootDir(); }
 
@@ -224,18 +214,17 @@ namespace zypp
     bool Pool::isRequestedLocale( const Locale & locale_r ) const
     { return myPool().isRequestedLocale( locale_r ); }
 
-    void Pool::initRequestedLocales( const LocaleSet & locales_r )     { myPool().initRequestedLocales( locales_r ); }
-    const LocaleSet & Pool::getAddedRequestedLocales() const           { return myPool().getAddedRequestedLocales(); }
-    const LocaleSet & Pool::getRemovedRequestedLocales() const         { return myPool().getRemovedRequestedLocales(); }
-
     const LocaleSet & Pool::getAvailableLocales() const
     {  return myPool().getAvailableLocales(); }
 
     bool Pool::isAvailableLocale( const Locale & locale_r ) const
     { return myPool().isAvailableLocale( locale_r ); }
 
-    const  Pool::MultiversionList &  Pool::multiversion() const
-    { return myPool().multiversionList(); }
+    bool Pool::multiversionEmpty() const                       { return myPool().multiversionList().empty(); }
+    size_t Pool::multiversionSize() const                      { return myPool().multiversionList().size(); }
+    Pool::MultiversionIterator Pool::multiversionBegin() const { return myPool().multiversionList().begin(); }
+    Pool::MultiversionIterator Pool::multiversionEnd() const   { return myPool().multiversionList().end(); }
+    bool Pool::isMultiversion( IdString ident_r ) const                { return myPool().isMultiversion( ident_r ); }
 
     Queue Pool::autoInstalled() const                          { return myPool().autoInstalled(); }
     void Pool::setAutoInstalled( const Queue & autoInstalled_r ){ myPool().setAutoInstalled( autoInstalled_r ); }
@@ -254,65 +243,6 @@ namespace zypp
     }
 
     /////////////////////////////////////////////////////////////////
-    #undef ZYPP_BASE_LOGGER_LOGGROUP
-    #define ZYPP_BASE_LOGGER_LOGGROUP "solvidx"
-
-    void updateSolvFileIndex( const Pathname & solvfile_r )
-    {
-      AutoDispose<FILE*> solv( ::fopen( solvfile_r.c_str(), "re" ), ::fclose );
-      if ( solv == NULL )
-      {
-       solv.resetDispose();
-       ERR << "Can't open solv-file: " << solv << endl;
-       return;
-      }
-
-      std::string solvidxfile( solvfile_r.extend(".idx").asString() );
-      if ( ::unlink( solvidxfile.c_str() ) == -1 && errno != ENOENT )
-      {
-       ERR << "Can't unlink solv-idx: " << Errno() << endl;
-       return;
-      }
-      {
-       int fd = ::open( solvidxfile.c_str(), O_CREAT|O_EXCL|O_WRONLY|O_TRUNC, 0644 );
-       if ( fd == -1 )
-       {
-         ERR << "Can't create solv-idx: " << Errno() << endl;
-         return;
-       }
-       ::close( fd );
-      }
-      std::ofstream idx( solvidxfile.c_str() );
-
-
-      detail::CPool * _pool = ::pool_create();
-      detail::CRepo * _repo = ::repo_create( _pool, "" );
-      if ( ::repo_add_solv( _repo, solv, 0 ) == 0 )
-      {
-       int _id = 0;
-       detail::CSolvable * _solv = nullptr;
-       FOR_REPO_SOLVABLES( _repo, _id, _solv )
-       {
-         if ( _solv )
-         {
-#define SEP '\t'
-#define        idstr(V) pool_id2str( _pool, _solv->V )
-           if ( _solv->arch == ARCH_SRC || _solv->arch == ARCH_NOSRC )
-             idx << "srcpackage:" << idstr(name) << SEP << idstr(evr) << SEP << "noarch" << endl;
-           else
-             idx << idstr(name) << SEP << idstr(evr) << SEP << idstr(arch) << endl;
-         }
-       }
-      }
-      else
-      {
-       ERR << "Can't read solv-file: " << ::pool_errstr( _pool ) << endl;
-      }
-      ::repo_free( _repo, 0 );
-      ::pool_free( _pool );
-    }
-
-    /////////////////////////////////////////////////////////////////
   } // namespace sat
   ///////////////////////////////////////////////////////////////////
   /////////////////////////////////////////////////////////////////