- Install a sample /etc/zypp.conf. (#306615)
[platform/upstream/libzypp.git] / devel / devel.ma / Parse.cc
index 46d10ce..c9dcf1a 100644 (file)
@@ -34,6 +34,8 @@
 #include "zypp/RepoManager.h"
 #include "zypp/RepoInfo.h"
 
+#include "zypp/ui/PatchContents.h"
+
 using namespace std;
 using namespace zypp;
 using namespace zypp::functor;
@@ -50,9 +52,10 @@ struct Xprint
 {
   bool operator()( const PoolItem & obj_r )
   {
-    handle( asKind<Package>( obj_r ) );
-    //handle( asKind<Pattern>( obj_r ) );
-    //handle( asKind<Product>( obj_r ) );
+    //handle( asKind<Package>( obj_r ) );
+    //handle( asKind<Patch>( obj_r ) );
+    handle( asKind<Pattern>( obj_r ) );
+    handle( asKind<Product>( obj_r ) );
     return true;
   }
 
@@ -61,7 +64,13 @@ struct Xprint
     if ( !p )
       return;
 
-    //MIL << p->diskusage() << endl;
+    MIL << p->diskusage() << endl;
+  }
+
+  void handle( const Patch_constPtr & p )
+  {
+    if ( !p )
+      return;
   }
 
   void handle( const Pattern_constPtr & p )
@@ -69,7 +78,10 @@ struct Xprint
     if ( !p )
       return;
 
-    MIL << p << endl;
+    if ( p->vendor().empty() )
+      ERR << p << endl;
+    else if ( p->vendor() == "SUSE (assumed)" )
+      SEC << p << endl;
   }
 
   void handle( const Product_constPtr & p )
@@ -77,8 +89,9 @@ struct Xprint
     if ( !p )
       return;
 
-    ERR << p << endl;
-    ERR << p->type() << endl;
+    USR << p << endl;
+    USR << p->vendor() << endl;
+    USR << p->type() << endl;
   }
 
   template<class _C>
@@ -262,7 +275,7 @@ struct KeyRingSignalsReceive : public callback::ReceiveReport<KeyRingSignals>
 
 struct MediaChangeReceive : public callback::ReceiveReport<media::MediaChangeReport>
 {
-  virtual Action requestMedia( Repository source
+  virtual Action requestMedia( Url & source
                                , unsigned mediumNr
                                , Error error
                                , const std::string & description )
@@ -315,6 +328,11 @@ namespace zypp
 { /////////////////////////////////////////////////////////////////
 
 
+  void Vtst( const std::string & lhs, const std::string & rhs )
+  {
+    (VendorAttr::instance().equivalent( lhs, rhs )?MIL:ERR) << lhs << " <==> "<< rhs << endl;
+
+  }
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
@@ -331,19 +349,7 @@ int main( int argc, char * argv[] )
 {
   //zypp::base::LogControl::instance().logfile( "log.restrict" );
   INT << "===[START]==========================================" << endl;
-
-  {
-    AutoDispose<int> fd( 0 );
-    SEC << fd << endl;
-    fd = ::open( "/tmp/foo", 1 );
-    SEC << fd << endl;
-
-    if ( fd == -1 )
-        ; // error report
-      else
-        fd.setDispose( ::close );
-  }
-  return 0;
+  setenv( "ZYPP_CONF", "/Local/ROOT/zypp.conf", 1 );
 
   DigestReceive foo;
   KeyRingSignalsReceive baa;
@@ -407,17 +413,16 @@ int main( int argc, char * argv[] )
   USR << "pool: " << pool << endl;
   SEC << pool.knownRepositoriesSize() << endl;
 
-  if ( 0 )
+  if ( 1 )
   {
     {
       zypp::base::LogControl::TmpLineWriter shutUp;
-      getZYpp()->initTarget( sysRoot );
+      //getZYpp()->initTarget( sysRoot );
+      getZYpp()->initTarget( "/" );
     }
     MIL << "Added target: " << pool << endl;
   }
 
-  INT << getZYpp()->diskUsage() << endl;
-
   std::for_each( pool.begin(), pool.end(), Xprint() );
 
   ///////////////////////////////////////////////////////////////////