- Add ResPool::reposFind to get repositories by alias.
authorMichael Andres <ma@suse.de>
Wed, 13 Aug 2008 13:13:59 +0000 (13:13 +0000)
committerMichael Andres <ma@suse.de>
Wed, 13 Aug 2008 13:13:59 +0000 (13:13 +0000)
VERSION.cmake
devel/devel.ma/NewPool.cc
package/libzypp.changes
zypp/ResPool.cc
zypp/ResPool.h
zypp/pool/PoolImpl.h

index 977bfc0..f560a2e 100644 (file)
@@ -61,7 +61,7 @@
 SET(LIBZYPP_MAJOR "5")
 SET(LIBZYPP_COMPATMINOR "4")
 SET(LIBZYPP_MINOR "4")
-SET(LIBZYPP_PATCH "0")
+SET(LIBZYPP_PATCH "1")
 #
 # LAST RELEASED: 5.4.0 (4)
 # (The number in parenthesis is LIBZYPP_COMPATMINOR)
index 85a5437..f3f5bf3 100644 (file)
@@ -523,6 +523,38 @@ try {
   ///////////////////////////////////////////////////////////////////
   ///////////////////////////////////////////////////////////////////
 
+  // ResPool   pool( ResPool::instance() );
+
+  // Iterate all repositories loaded to the pool
+  for_( it,  pool.knownRepositoriesBegin(), pool.knownRepositoriesEnd() )
+  {
+    MIL << *it << endl;
+  }
+
+  // some specific repo
+  Repository myRepo( *pool.knownRepositoriesBegin() );
+
+  // Iterate all packages named "amarok" (from all repos)
+  for_( it, pool.byIdentBegin( ResKind::package, "amarok" ), pool.byIdentEnd( ResKind::package, "amarok" ) )
+  {
+    MIL << "Check: " << *it << endl;
+    if ( (*it)->repository() == myRepo )
+    {
+      MIL << "  Found:      " << (*it)->name() << endl;
+      MIL << "  Version:    " << (*it)->edition() << endl;
+      MIL << "  Repository: " << (*it)->repository() << endl;
+    }
+
+  }
+
+
+
+   ///////////////////////////////////////////////////////////////////
+  INT << "===[END]============================================" << endl << endl;
+  zypp::base::LogControl::instance().logNothing();
+  return 0;
+
+
   ui::Selectable::Ptr item( ui::Selectable::get( "amarok" ) );
   item->setUpToDate();
   SEC << dump(item) << endl;
index c087fb3..e5cf56a 100644 (file)
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Wed Aug 13 15:12:45 CEST 2008 - ma@suse.de
+
+- Add ResPool::reposFind to get repositories by alias.
+- revision 10835
+
+-------------------------------------------------------------------
 Tue Aug 12 19:37:36 CEST 2008 - ma@suse.de
 
 - Advise rpmdb2solv to parse the product database.
index 63e9f37..78bc671 100644 (file)
@@ -76,6 +76,8 @@ namespace zypp
   ResPool::repository_iterator ResPool::knownRepositoriesEnd() const
   { return _pimpl->knownRepositoriesEnd(); }
 
+  Repository ResPool::reposFind( const std::string & alias_r ) const
+  { return _pimpl->reposFind( alias_r ); }
 
   bool ResPool::autoSoftLocksEmpty() const
   { return _pimpl->autoSoftLocks().empty(); }
index 5d29f8f..76e4baa 100644 (file)
@@ -224,6 +224,11 @@ namespace zypp
       repository_iterator knownRepositoriesBegin() const;
 
       repository_iterator knownRepositoriesEnd() const;
+
+      /** Find a \ref Repository named \c alias_r.
+       * Returns \ref Repository::norepository if there is no such \ref Repository.
+       */
+      Repository reposFind( const std::string & alias_r ) const;
       //@}
 
     public:
index 5363287..7968204 100644 (file)
@@ -208,6 +208,9 @@ namespace zypp
         repository_iterator knownRepositoriesEnd() const
         { checkSerial(); return satpool().reposEnd(); }
 
+        Repository reposFind( const std::string & alias_r ) const
+        { checkSerial(); return satpool().reposFind( alias_r ); }
+
         ///////////////////////////////////////////////////////////////////
         //
         ///////////////////////////////////////////////////////////////////