- Install a sample /etc/zypp.conf. (#306615)
[platform/upstream/libzypp.git] / devel / devel.ma / Parse.cc
index 5d14eec..c9dcf1a 100644 (file)
-#include <ctime>
-
-#include <iostream>
-#include <list>
-#include <map>
-#include <set>
-
-#include "Measure.h"
-#include "Printing.h"
 #include "Tools.h"
 
-#include <zypp/base/Logger.h>
-#include <zypp/base/LogControl.h>
-#include <zypp/base/String.h>
-#include <zypp/base/Exception.h>
 #include <zypp/base/PtrTypes.h>
-#include <zypp/base/Iterator.h>
-#include <zypp/base/Algorithm.h>
-#include <zypp/base/Functional.h>
-#include <zypp/base/ProvideNumericId.h>
+#include <zypp/base/Exception.h>
+#include <zypp/base/LogTools.h>
 #include <zypp/base/ProvideNumericId.h>
+#include <zypp/AutoDispose.h>
+
+#include "zypp/ZYppFactory.h"
+#include "zypp/ResPoolProxy.h"
+#include <zypp/CapMatchHelper.h>
 
+#include "zypp/ZYppCallbacks.h"
 #include "zypp/NVRAD.h"
 #include "zypp/ResPool.h"
 #include "zypp/ResFilters.h"
 #include "zypp/CapFilters.h"
 #include "zypp/Package.h"
+#include "zypp/Pattern.h"
 #include "zypp/Language.h"
+#include "zypp/Digest.h"
+#include "zypp/PackageKeyword.h"
 #include "zypp/NameKindProxy.h"
+#include "zypp/pool/GetResolvablesToInsDel.h"
 
-#include <zypp/SourceManager.h>
-#include <zypp/SourceFactory.h>
-#include <zypp/source/susetags/SuseTagsImpl.h>
+#include "zypp/parser/TagParser.h"
+#include "zypp/parser/susetags/PackagesFileReader.h"
+#include "zypp/parser/susetags/PackagesLangFileReader.h"
+#include "zypp/parser/susetags/PatternFileReader.h"
+#include "zypp/parser/susetags/ContentFileReader.h"
+#include "zypp/parser/susetags/RepoIndex.h"
+#include "zypp/parser/susetags/RepoParser.h"
+#include "zypp/cache/CacheStore.h"
+#include "zypp/RepoManager.h"
+#include "zypp/RepoInfo.h"
 
-#include "zypp/ZYppFactory.h"
-#include "zypp/ResPoolProxy.h"
-#include "zypp/ResPoolProxy.h"
-#include "zypp/target/rpm/RpmDb.h"
+#include "zypp/ui/PatchContents.h"
 
 using namespace std;
 using namespace zypp;
-using namespace zypp::ui;
 using namespace zypp::functor;
 
+using zypp::parser::TagParser;
+
 ///////////////////////////////////////////////////////////////////
 
 static const Pathname sysRoot( "/Local/ROOT" );
-static const Url      instSrc( "dir:/Local/SLES10" );
-//static const Url      instSrc( "dir:/Local/FACTORY" );
 
 ///////////////////////////////////////////////////////////////////
 
-namespace container
+struct Xprint
 {
-  template<class _Tp>
-    bool isIn( const std::set<_Tp> & cont, const typename std::set<_Tp>::value_type & val )
-    { return cont.find( val ) != cont.end(); }
-}
-
-///////////////////////////////////////////////////////////////////
-
-template<class _Condition>
-  struct SetTrue
+  bool operator()( const PoolItem & obj_r )
   {
-    SetTrue( _Condition cond_r )
-    : _cond( cond_r )
-    {}
+    //handle( asKind<Package>( obj_r ) );
+    //handle( asKind<Patch>( obj_r ) );
+    handle( asKind<Pattern>( obj_r ) );
+    handle( asKind<Product>( obj_r ) );
+    return true;
+  }
 
-    template<class _Tp>
-      bool operator()( _Tp t ) const
-      {
-        _cond( t );
-        return true;
-      }
+  void handle( const Package_constPtr & p )
+  {
+    if ( !p )
+      return;
 
-    _Condition _cond;
-  };
+    MIL << p->diskusage() << endl;
+  }
 
-template<class _Condition>
-  inline SetTrue<_Condition> setTrue_c( _Condition cond_r )
+  void handle( const Patch_constPtr & p )
   {
-    return SetTrue<_Condition>( cond_r );
+    if ( !p )
+      return;
   }
 
-template <class _Iterator, class _Filter, class _Function>
-  inline _Function for_each_if( _Iterator begin_r, _Iterator end_r,
-                                _Filter filter_r,
-                                _Function fnc_r )
+  void handle( const Pattern_constPtr & p )
   {
-    for ( _Iterator it = begin_r; it != end_r; ++it )
-      {
-        if ( filter_r( *it ) )
-          {
-            fnc_r( *it );
-          }
-      }
-    return fnc_r;
+    if ( !p )
+      return;
+
+    if ( p->vendor().empty() )
+      ERR << p << endl;
+    else if ( p->vendor() == "SUSE (assumed)" )
+      SEC << p << endl;
   }
 
-struct PrintPoolItem
-{
-  void operator()( const PoolItem & pi ) const
+  void handle( const Product_constPtr & p )
   {
-    USR << "S" << pi->source().numericId()
-        << "/M" << mediaId(pi)
-        << " " << pi << endl;
+    if ( !p )
+      return;
+
+    USR << p << endl;
+    USR << p->vendor() << endl;
+    USR << p->type() << endl;
   }
-  unsigned mediaId( const PoolItem & pi ) const
+
+  template<class _C>
+  bool operator()( const _C & obj_r )
   {
-    Package::constPtr pkg( asKind<Package>(pi.resolvable()) );
-    if ( pkg )
-      return pkg->mediaId();
-    return 0;
+    return true;
   }
 };
 
-template <class _Iterator>
-  std::ostream & vdumpPoolStats( std::ostream & str,
-                                 _Iterator begin_r, _Iterator end_r )
-  {
-    pool::PoolStats stats;
-    std::for_each( begin_r, end_r,
+///////////////////////////////////////////////////////////////////
+struct SetTransactValue
+{
+  SetTransactValue( ResStatus::TransactValue newVal_r, ResStatus::TransactByValue causer_r )
+  : _newVal( newVal_r )
+  , _causer( causer_r )
+  {}
 
-                   functor::chain( setTrue_c(PrintPoolItem()),
-                                   setTrue_c(functor::functorRef<void,ResObject::constPtr>(stats)) )
+  ResStatus::TransactValue   _newVal;
+  ResStatus::TransactByValue _causer;
 
-                 );
-    return str << stats;
+  bool operator()( const PoolItem & pi ) const
+  {
+    bool ret = pi.status().setTransactValue( _newVal, _causer );
+    if ( ! ret )
+      ERR << _newVal <<  _causer << " " << pi << endl;
+    return ret;
   }
+};
 
-struct PoolItemSelect
+struct StatusReset : public SetTransactValue
 {
-  void operator()( const PoolItem & pi ) const
-  {
-    if ( pi->source().numericId() == 2 )
-      pi.status().setTransact( true, ResStatus::USER );
-  }
+  StatusReset()
+  : SetTransactValue( ResStatus::KEEP_STATE, ResStatus::USER )
+  {}
 };
 
-///////////////////////////////////////////////////////////////////
-typedef std::list<PoolItem> PoolItemList;
-typedef std::set<PoolItem>  PoolItemSet;
-#include "zypp/solver/detail/InstallOrder.h"
-using zypp::solver::detail::InstallOrder;
-#include "Iorder.h"
+struct StatusInstall : public SetTransactValue
+{
+  StatusInstall()
+  : SetTransactValue( ResStatus::TRANSACT, ResStatus::USER )
+  {}
+};
 
-///////////////////////////////////////////////////////////////////
-namespace zypp
+inline bool g( const NameKindProxy & nkp, Arch arch = Arch() )
 {
-  struct CollectTransacting
+  if ( nkp.availableEmpty() )
   {
-    typedef std::list<PoolItem> PoolItemList;
+    ERR << "No Item to select: " << nkp << endl;
+    return false;
+    ZYPP_THROW( Exception("No Item to select") );
+  }
 
-    void operator()( const PoolItem & pi )
+  if ( arch != Arch() )
+  {
+    typeof( nkp.availableBegin() ) it =  nkp.availableBegin();
+    for ( ; it != nkp.availableEnd(); ++it )
     {
-      if ( pi.status().isToBeInstalled() )
-        {
-          _toInstall.insert( pi );
-        }
-      else if ( pi.status().isToBeUninstalled() )
-        {
-          if ( pi.status().isToBeUninstalledDueToObsolete()
-               || pi.status().isToBeUninstalledDueToUpgrade() )
-            _skipToDelete.insert( pi );
-          else
-            _toDelete.insert( pi );
-        }
+      if ( (*it)->arch() == arch )
+       return (*it).status().setTransact( true, ResStatus::USER );
     }
-
-    PoolItemSet _toInstall;
-    PoolItemSet _toDelete;
-    PoolItemSet _skipToDelete;
-  };
-
-  std::ostream & operator<<( std::ostream & str, const CollectTransacting & obj )
-  {
-    str << "CollectTransacting:" << endl;
-    dumpPoolStats( str << " toInstall: ",
-                   obj._toInstall.begin(), obj._toInstall.end() ) << endl;
-    dumpPoolStats( str << " toDelete: ",
-                   obj._toDelete.begin(), obj._toDelete.end() ) << endl;
-    dumpPoolStats( str << " skipToDelete: ",
-                   obj._skipToDelete.begin(), obj._skipToDelete.end() ) << endl;
-    return str;
   }
+
+  return nkp.availableBegin()->status().setTransact( true, ResStatus::USER );
 }
 
 ///////////////////////////////////////////////////////////////////
-#if 0
-template<class _InstIterator, class _DelIterator, class _OutputIterator>
-void strip_obsoleted_to_delete( _InstIterator instBegin_r, _InstIterator instEnd_r,
-                                _DelIterator  delBegin_r,  _DelIterator  delEnd_r,
-                                _OutputIterator skip_r )
-  {
-    if ( instBegin_r == instEnd_r
-         || delBegin_r == delEnd_r )
-    return; // ---> nothing to do
 
-    // build obsoletes from inst
-    CapSet obsoletes;
-    for ( /**/; instBegin_r != instEnd_r; ++instBegin_r )
+bool solve( bool establish = false )
+{
+  if ( establish )
+  {
+    bool eres = false;
     {
-      //xxxxx
-      //PoolItem_Ref item( *it );
-      //obsoletes.insert( item->dep(Dep::OBSOLETES).begin(), item->dep(Dep::OBSOLETES).end() );
+      zypp::base::LogControl::TmpLineWriter shutUp;
+      eres = getZYpp()->resolver()->establishPool();
     }
-  if ( obsoletes.size() == 0 )
-    return; // ---> nothing to do
-
-  // match them... ;(
-  PoolItemList undelayed;
-  // forall applDelete Packages...
-  for ( PoolItemList::iterator it = deleteList_r.begin();
-       it != deleteList_r.end(); ++it )
+    if ( ! eres )
     {
-      PoolItem_Ref ipkg( *it );
-      bool delayPkg = false;
-      // ...check whether an obsoletes....
-      for ( CapSet::iterator obs = obsoletes.begin();
-            ! delayPkg && obs != obsoletes.end(); ++obs )
-        {
-          // ...matches anything provided by the package?
-          for ( CapSet::const_iterator prov = ipkg->dep(Dep::PROVIDES).begin();
-                prov != ipkg->dep(Dep::PROVIDES).end(); ++prov )
-            {
-              if ( obs->matches( *prov ) == CapMatch::yes )
-                {
-                  // if so, delay package deletion
-                  DBG << "Ignore appl_delete (should be obsoleted): " << ipkg << endl;
-                  delayPkg = true;
-                  ipkg.status().setTransact( false, ResStatus::USER );
-                  break;
-                }
-            }
-        }
-      if ( ! delayPkg ) {
-        DBG << "undelayed " << ipkg << endl;
-        undelayed.push_back( ipkg );
-      }
+      ERR << "establish " << eres << endl;
+      return false;
     }
-  // Puhh...
-  deleteList_r.swap( undelayed );
+    MIL << "establish " << eres << endl;
+  }
 
+  bool rres = false;
+  {
+    zypp::base::LogControl::TmpLineWriter shutUp;
+    rres = getZYpp()->resolver()->resolvePool();
+  }
+  if ( ! rres )
+  {
+    ERR << "resolve " << rres << endl;
+    return false;
+  }
+  MIL << "resolve " << rres << endl;
+  return true;
 }
-#endif
+
 ///////////////////////////////////////////////////////////////////
 
-struct SetTransactValue
+struct ConvertDbReceive : public callback::ReceiveReport<target::ScriptResolvableReport>
 {
-  SetTransactValue( ResStatus::TransactValue newVal_r, ResStatus::TransactByValue causer_r )
-  : _newVal( newVal_r )
-  , _causer( causer_r )
-  {}
+  virtual void start( const Resolvable::constPtr & script_r,
+                      const Pathname & path_r,
+                      Task task_r )
+  {
+    SEC << __FUNCTION__ << endl
+    << "  " << script_r << endl
+    << "  " << path_r   << endl
+    << "  " << task_r   << endl;
+  }
 
-  ResStatus::TransactValue   _newVal;
-  ResStatus::TransactByValue _causer;
+  virtual bool progress( Notify notify_r, const std::string & text_r )
+  {
+    SEC << __FUNCTION__ << endl
+    << "  " << notify_r << endl
+    << "  " << text_r   << endl;
+    return true;
+  }
 
-  bool operator()( const PoolItem & pi ) const
-  { return pi.status().setTransactValue( _newVal, _causer ); }
+  virtual void problem( const std::string & description_r )
+  {
+    SEC << __FUNCTION__ << endl
+    << "  " << description_r << endl;
+  }
+
+  virtual void finish()
+  {
+    SEC << __FUNCTION__ << endl;
+  }
+
+};
+///////////////////////////////////////////////////////////////////
+
+struct DigestReceive : public callback::ReceiveReport<DigestReport>
+{
+  DigestReceive()
+  {
+    connect();
+  }
+
+  virtual bool askUserToAcceptNoDigest( const zypp::Pathname &file )
+  {
+    USR << endl;
+    return false;
+  }
+  virtual bool askUserToAccepUnknownDigest( const Pathname &file, const std::string &name )
+  {
+    USR << endl;
+    return false;
+  }
+  virtual bool askUserToAcceptWrongDigest( const Pathname &file, const std::string &requested, const std::string &found )
+  {
+    USR << "fle " << PathInfo(file) << endl;
+    USR << "req " << requested << endl;
+    USR << "fnd " << found << endl;
+
+    waitForInput();
+
+    return false;
+  }
 };
 
-struct StatusReset : public SetTransactValue
+struct KeyRingSignalsReceive : public callback::ReceiveReport<KeyRingSignals>
 {
-  StatusReset()
-  : SetTransactValue( ResStatus::KEEP_STATE, ResStatus::USER )
-  {}
+  KeyRingSignalsReceive()
+  {
+    connect();
+  }
+  virtual void trustedKeyAdded( const PublicKey &/*key*/ )
+  {
+    USR << endl;
+  }
+  virtual void trustedKeyRemoved( const PublicKey &/*key*/ )
+  {
+    USR << endl;
+  }
 };
 
-inline Source_Ref XcreateSource( const Url & url_r )
+///////////////////////////////////////////////////////////////////
+
+struct MediaChangeReceive : public callback::ReceiveReport<media::MediaChangeReport>
 {
-  Source_Ref ret;
-  string a( "createSource: 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345" );
-  //Measure x( a );
-  //Measure x( "createSource: " );//+ url_r.asString() );
-  try
-    {
-      ret = SourceFactory().createFrom( url_r, "/", Date::now().asSeconds() );
-    }
-  catch ( const Exception & )
-    {
-      return Source_Ref::noSource;
-    }
-  //x.start( "parseSource: " + url_r.asString() );
+  virtual Action requestMedia( Url & source
+                               , unsigned mediumNr
+                               , Error error
+                               , const std::string & description )
   {
-    //zypp::base::LogControl::TmpLineWriter shutUp;
-    ret.resolvables();
+    SEC << __FUNCTION__ << endl
+    << "  " << source << endl
+    << "  " << mediumNr << endl
+    << "  " << error << endl
+    << "  " << description << endl;
+    return IGNORE;
   }
-  //x.stop();
-  MIL << "Content " << ret << "{" << endl;
-  rstats( ret.resolvables() );
-  MIL << "}" << endl;
+};
+
+///////////////////////////////////////////////////////////////////
 
-  return ret;
+namespace container
+{
+  template<class _Tp>
+    bool isIn( const std::set<_Tp> & cont, const typename std::set<_Tp>::value_type & val )
+    { return cont.find( val ) != cont.end(); }
 }
 
-void checkSource( const Url & url )
+///////////////////////////////////////////////////////////////////
+
+struct AddResolvables
 {
-  Source_Ref src( XcreateSource( url ) );
+  bool operator()( const Repository & src ) const
+  {
+    getZYpp()->addResolvables( src.resolvables() );
+    return true;
+  }
+};
+
+///////////////////////////////////////////////////////////////////
+
+
+std::ostream & operator<<( std::ostream & str, const iostr::EachLine & obj )
+{
+  str << "(" << obj.valid() << ")[" << obj.lineNo() << "|" << obj.lineStart() << "]{" << *obj << "}";
+  return str;
+
 }
-void checkSource( const std::string & urlstr )
-{ checkSource( Url(urlstr) ); }
+
+///////////////////////////////////////////////////////////////////
+
+#define for_(IT,BEG,END) for ( typeof(BEG) IT = BEG; IT != END; ++IT )
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
 
 
+  void Vtst( const std::string & lhs, const std::string & rhs )
+  {
+    (VendorAttr::instance().equivalent( lhs, rhs )?MIL:ERR) << lhs << " <==> "<< rhs << endl;
+
+  }
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
+using namespace zypp;
+
 /******************************************************************
 **
 **      FUNCTION NAME : main
@@ -308,124 +347,87 @@ void checkSource( const std::string & urlstr )
 */
 int main( int argc, char * argv[] )
 {
-  //zypp::base::LogControl::instance().logfile( "xxx" );
+  //zypp::base::LogControl::instance().logfile( "log.restrict" );
   INT << "===[START]==========================================" << endl;
-  ResPool pool( getZYpp()->pool() );
+  setenv( "ZYPP_CONF", "/Local/ROOT/zypp.conf", 1 );
 
-  checkSource( "ftp://ftp.gwdg.de/pub/linux/misc/suser-guru/rpm/10.0" );
-  return 0;
+  DigestReceive foo;
+  KeyRingSignalsReceive baa;
 
-  if ( 0 )
-    {
-      Measure x( "initTarget " + sysRoot.asString() );
-      getZYpp()->initTarget( sysRoot );
-      getZYpp()->addResolvables( getZYpp()->target()->resolvables(), true );
-      INT << "Added target: " << pool << endl;
-    }
-
-  if ( 0 ) {
-    SourceManager::sourceManager()->restore( sysRoot );
-    if ( SourceManager::sourceManager()->allSources().empty() )
-      {
-        Source_Ref src( createSource( instSrc ) );
-        SourceManager::sourceManager()->addSource( src );
-        SourceManager::sourceManager()->store( sysRoot, true );
-      }
+  RepoManager repoManager( makeRepoManager( "/Local/ROOT" ) );
+  RepoInfoList repos = repoManager.knownRepositories();
+  SEC << repos << endl;
 
-    Source_Ref src( *SourceManager::sourceManager()->Source_begin() );
-    getZYpp()->addResolvables( src.resolvables() );
-    INT << "Added source: " << pool << endl;
+  if ( repos.empty() )
+  {
+    RepoInfo nrepo;
+    nrepo
+       .setAlias( "factorytest" )
+       .setName( "Test Repo for factory." )
+       .setEnabled( true )
+       .setAutorefresh( false )
+       .addBaseUrl( Url("http://dist.suse.de/install/stable-x86/") );
+
+    repoManager.addRepository( nrepo );
+    SEC << "refreshMetadat" << endl;
+    repoManager.refreshMetadata( nrepo );
+    SEC << "buildCache" << endl;
+    repoManager.buildCache( nrepo );
+    SEC << "------" << endl;
+    repos = repoManager.knownRepositories();
   }
 
+  ResPool pool( getZYpp()->pool() );
+  vdumpPoolStats( USR << "Initial pool:" << endl,
+                 pool.begin(),
+                 pool.end() ) << endl;
 
-  Source_Ref src2( createSource( "dir:/Local/SUSE-Linux-10.1-Build_830-i386/CD1" ) );
-  Source_Ref src1( createSource( "dir:/Local/SUSE-Linux-10.1-Build_830-Addon-BiArch/CD1" ) );
-  INT << "Pool: " << pool << endl;
-  getZYpp()->addResolvables( src1.resolvables() );
-  INT << "Added source1: " << pool << endl;
-  getZYpp()->addResolvables( src2.resolvables() );
-  INT << "Added source2: " << pool << endl;
-
-  vdumpPoolStats( INT,
-                  make_filter_begin<resfilter::ByTransact>(pool),
-                  make_filter_end<resfilter::ByTransact>(pool) ) << endl;
-  MIL << endl;
-  std::for_each( pool.begin(), pool.end(), SetTransactValue( ResStatus::TRANSACT, ResStatus::USER ) );
-  vdumpPoolStats( INT,
-                  make_filter_begin<resfilter::ByTransact>(pool),
-                  make_filter_end<resfilter::ByTransact>(pool) ) << endl;
-  MIL << endl;
-  std::for_each( pool.begin(), pool.end(), StatusReset() );
-  vdumpPoolStats( INT,
-                  make_filter_begin<resfilter::ByTransact>(pool),
-                  make_filter_end<resfilter::ByTransact>(pool) ) << endl;
-  MIL << endl;
-
-  return 0;
+  for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
+  {
+    RepoInfo & nrepo( *it );
+    if ( ! nrepo.enabled() )
+      continue;
 
-  NameKindProxy s( nameKindProxy<Selection>( pool, "default" ) );
-  MIL << s << endl;
-  if ( ! s.availableEmpty() )
+    if ( ! repoManager.isCached( nrepo ) || 0 )
     {
-      PoolItem def( * s.availableBegin() );
-      def.status().setTransact( true, ResStatus::USER );
+      if ( repoManager.isCached( nrepo ) )
+      {
+       SEC << "cleanCache" << endl;
+       repoManager.cleanCache( nrepo );
+      }
+      SEC << "refreshMetadata" << endl;
+      repoManager.refreshMetadata( nrepo, RepoManager::RefreshForced );
+      SEC << "buildCache" << endl;
+      repoManager.buildCache( nrepo );
     }
 
-  bool eres, rres;
-  {
-    zypp::base::LogControl::TmpLineWriter shutUp;
-    eres = getZYpp()->resolver()->establishPool();
-    rres = getZYpp()->resolver()->resolvePool();
-  }
-  MIL << "est " << eres << " slv " << rres << endl;
+    SEC << nrepo << endl;
+    Repository nrep( repoManager.createFromCache( nrepo ) );
+    const zypp::ResStore & store( nrep.resolvables() );
 
+    dumpPoolStats( SEC << "Store: " << endl,
+                  store.begin(), store.end() ) << endl;
+    getZYpp()->addResolvables( store );
+  }
 
-  for_each( pool.byKindBegin<Package>(), pool.byKindEnd<Package>(),
-            PoolItemSelect() );
-  INT << "FIN: " << pool << endl;
-  vdumpPoolStats( INT,
-                  make_filter_begin<resfilter::ByTransact>(pool),
-                  make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+  USR << "pool: " << pool << endl;
+  SEC << pool.knownRepositoriesSize() << endl;
 
   if ( 1 )
+  {
     {
-      PoolItemList errors_r;
-      PoolItemList remaining_r;
-      PoolItemList srcremaining_r;
-      commit( pool, 0, errors_r, remaining_r, srcremaining_r, false );
-
-      dumpPoolStats( WAR << "remaining_r ", remaining_r.begin(), remaining_r.end() ) << endl;
-      dumpPoolStats( WAR << "srcremaining_r ", srcremaining_r.begin(), srcremaining_r.end() ) << endl;
-    }
-  else
-    {
-      CollectTransacting toTransact;
-      std::for_each( make_filter_begin<resfilter::ByTransact>(pool),
-                     make_filter_end<resfilter::ByTransact>(pool),
-                     functor::functorRef<void,PoolItem>(toTransact) );
-      MIL << toTransact;
+      zypp::base::LogControl::TmpLineWriter shutUp;
+      //getZYpp()->initTarget( sysRoot );
+      getZYpp()->initTarget( "/" );
     }
+    MIL << "Added target: " << pool << endl;
+  }
 
-#if 0
-  Source_Ref src( *SourceManager::sourceManager()->Source_begin() );
-  const std::list<Pathname> srcKeys( src.publicKeys() );
-  MIL << src << endl;
-  DBG << srcKeys << endl;
-
-  target::rpm::RpmDb rpm;
-  rpm.initDatabase( sysRoot );
-  std::set<Edition> rpmKeys( rpm.pubkeys() );
-  MIL << rpm << endl;
-  DBG << rpmKeys << endl;
-
-  ResPool pool( getZYpp()->pool() );
-  getZYpp()->addResolvables( src.resolvables() );
-  SEC << pool << endl;
-
-  rpm.closeDatabase();
-#endif
+  std::for_each( pool.begin(), pool.end(), Xprint() );
 
+  ///////////////////////////////////////////////////////////////////
   INT << "===[END]============================================" << endl << endl;
+  zypp::base::LogControl::instance().logNothing();
   return 0;
 }