Imported Upstream version 14.48.2
[platform/upstream/libzypp.git] / devel / devel.ma / Parse.cc
index 02c2c9d..c9e1a49 100644 (file)
@@ -8,21 +8,18 @@
 
 #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/ManagedFile.h"
-#include "zypp/NameKindProxy.h"
-#include "zypp/pool/GetResolvablesToInsDel.h"
+
 
 #include "zypp/parser/TagParser.h"
 #include "zypp/parser/susetags/PackagesFileReader.h"
@@ -35,7 +32,9 @@
 #include "zypp/RepoManager.h"
 #include "zypp/RepoInfo.h"
 
+#include "zypp/repo/DeltaCandidates.h"
 #include "zypp/repo/PackageProvider.h"
+#include "zypp/repo/SrcPackageProvider.h"
 
 #include "zypp/ui/PatchContents.h"
 #include "zypp/ResPoolProxy.h"
@@ -93,59 +92,6 @@ ManagedFile repoProvidePackage( const PoolItem & pi )
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-
-template<class _Res>
-Selectable::Ptr getSel( const std::string & name_r )
-{
-  ResPoolProxy uipool( getZYpp()->poolProxy() );
-  for_(it, uipool.byKindBegin<_Res>(), uipool.byKindEnd<_Res>() )
-  {
-    if ( (*it)->name() == name_r )
-      return (*it);
-  }
-  return 0;
-}
-
-template<class _Res>
-PoolItem getPi( const std::string & name_r, const Edition & ed_r, const Arch & arch_r )
-{
-  PoolItem ret;
-  ResPool pool( getZYpp()->pool() );
-  for_(it, pool.byNameBegin(name_r), pool.byNameEnd(name_r) )
-  {
-    if ( !ret && isKind<_Res>( (*it).resolvable() )
-         && ( ed_r == Edition() || ed_r == (*it)->edition() )
-         && ( arch_r == Arch()  || arch_r == (*it)->arch()  ) )
-    {
-      ret = (*it);
-      MIL << "    ->" << *it << endl;
-    }
-    else
-    {
-      DBG << "     ?" << *it << endl;
-    }
-  }
-  return ret;
-}
-template<class _Res>
-PoolItem getPi( const std::string & name_r )
-{
-  return getPi<_Res>( name_r, Edition(), Arch() );
-}
-template<class _Res>
-PoolItem getPi( const std::string & name_r, const Edition & ed_r )
-{
-  return getPi<_Res>( name_r, ed_r, Arch() );
-}
-template<class _Res>
-PoolItem getPi( const std::string & name_r, const Arch & arch_r )
-{
-  return getPi<_Res>( name_r, Edition(), arch_r );
-}
-
-
-
 
 void dbgDu( Selectable::Ptr sel )
 {
@@ -256,28 +202,6 @@ struct StatusInstall : public SetTransactValue
   {}
 };
 
-inline bool g( const NameKindProxy & nkp, Arch arch = Arch() )
-{
-  if ( nkp.availableEmpty() )
-  {
-    ERR << "No Item to select: " << nkp << endl;
-    return false;
-    ZYPP_THROW( Exception("No Item to select") );
-  }
-
-  if ( arch != Arch() )
-  {
-    typeof( nkp.availableBegin() ) it =  nkp.availableBegin();
-    for ( ; it != nkp.availableEnd(); ++it )
-    {
-      if ( (*it)->arch() == arch )
-       return (*it).status().setTransact( true, ResStatus::USER );
-    }
-  }
-
-  return nkp.availableBegin()->status().setTransact( true, ResStatus::USER );
-}
-
 ///////////////////////////////////////////////////////////////////
 
 bool solve( bool establish = false )
@@ -494,41 +418,10 @@ int main( int argc, char * argv[] )
   DigestReceive foo;
   KeyRingSignalsReceive baa;
 
-  DiskUsageCounter::MountPointSet fakePart;
-  fakePart.insert( DiskUsageCounter::MountPoint( "/",        1024, 10240, 5120, 0LL, false ) );
-//   fakePart.insert( DiskUsageCounter::MountPoint( "/usr",     1024, 10240, 5120, 0LL, false ) );
-  fakePart.insert( DiskUsageCounter::MountPoint( "/usr/lib", 1024, 10240, 5120, 0LL, false ) );
-  fakePart.insert( DiskUsageCounter::MountPoint( "/usr/bin", 1024, 10240, 5120, 0LL, false ) );
-  getZYpp()->setPartitions( fakePart );
-
-  ResPool pool( getZYpp()->pool() );
-  vdumpPoolStats( USR << "Initial pool:" << endl,
-                 pool.begin(),
-                 pool.end() ) << endl;
-
-
   RepoManager repoManager( makeRepoManager( "/Local/ROOT" ) );
-  RepoInfoList repos = repoManager.knownRepositories();
-  SEC << repos << 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();
-  }
+  RepoInfoList repos = repoManager.knownRepositories();
+  SEC << "/Local/ROOT " << repos << endl;
 
   for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
   {
@@ -559,25 +452,27 @@ int main( int argc, char * argv[] )
     getZYpp()->addResolvables( store );
   }
 
+  ResPool pool( getZYpp()->pool() );
   USR << "pool: " << pool << endl;
   SEC << pool.knownRepositoriesSize() << endl;
 
-  if ( 1 )
+  if ( 0 )
   {
     {
       zypp::base::LogControl::TmpLineWriter shutUp;
-      getZYpp()->initTarget( sysRoot );
-      //getZYpp()->initTarget( "/" );
+      //getZYpp()->initTarget( sysRoot );
+      getZYpp()->initTarget( "/" );
     }
     MIL << "Added target: " << pool << endl;
   }
 
-  std::for_each( pool.begin(), pool.end(), Xprint() );
 
-  //PoolItem pi = getPi<Package>( "update-test-affects-package-manager", Edition("99-99") );
-  //USR << pi << endl;
-  //pi.status().setTransact( true, ResStatus::USER );
+  //std::for_each( pool.begin(), pool.end(), Xprint() );
+
+  PoolItem pi = getPi<Patch>( "fetchmsttfonts.sh" );
+  USR << pi << endl;
 
+  //pi.status().setTransact( true, ResStatus::USER );
   //install();
 
  ///////////////////////////////////////////////////////////////////