[zypp-commit] r5655 - in /trunk/libzypp: devel/devel.dmacvicar/CachedSource_tp.cc devel/devel.dmacvicar/RepositoryManager_tp.cc zypp/Url.cc zypp/Url.h zypp2/RepoInfo.cc zypp2/RepoManager.cc
Author: dmacvicar Date: Thu May 31 18:17:48 2007 New Revision: 5655 URL: http://svn.opensuse.org/viewcvs/zypp?rev=5655&view=rev Log: - add operator < to use Url in std::set - First repomanager that can list repos from /etc/repos.d ;-) Modified: trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc trunk/libzypp/zypp/Url.cc trunk/libzypp/zypp/Url.h trunk/libzypp/zypp2/RepoInfo.cc trunk/libzypp/zypp2/RepoManager.cc Modified: trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc?rev=5655&r1=5654&r2=5655&view=diff ============================================================================== --- trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc (original) +++ trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc Thu May 31 18:17:48 2007 @@ -11,13 +11,13 @@ #include "zypp/detail/PackageImplIf.h" #include "zypp/Package.h" #include "zypp2/RepositoryFactory.h" -#include "zypp2/repository/cached/CachedRepositoryImpl.h" +#include "zypp2/repo/cached/RepoImpl.h" #include "zypp/data/ResolvableData.h" using namespace std; using namespace zypp; -using namespace zypp::repository; -using namespace zypp::repository::cached; +using namespace zypp::repo; +using namespace zypp::repo::cached; int main(int argc, char **argv) Modified: trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc?rev=5655&r1=5654&r2=5655&view=diff ============================================================================== --- trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc (original) +++ trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc Thu May 31 18:17:48 2007 @@ -12,13 +12,13 @@ #include "zypp/detail/PackageImplIf.h" #include "zypp/Package.h" #include "zypp2/RepositoryFactory.h" -#include "zypp2/RepositoryInfo.h" +#include "zypp2/RepoInfo.h" -#include "zypp2/repository/cached/CachedRepositoryImpl.h" +#include "zypp2/repo/cached/RepoImpl.h" #include "zypp/data/ResolvableData.h" -#include "zypp2/RepositoryManager.h" -#include "zypp2/RepositoryInfo.h" +#include "zypp2/RepoManager.h" +#include "zypp2/RepoInfo.h" using namespace std; @@ -34,10 +34,10 @@ Pathname dbpath = Pathname(getenv("PWD")); - RepositoryManager manager; - RepositoryInfoList repos = manager.knownRepositories(); + RepoManager manager; + RepoInfoList repos = manager.knownRepositories(); - for ( RepositoryInfoList::const_iterator it = repos.begin(); it != repos.end(); ++it ) + for ( RepoInfoList::const_iterator it = repos.begin(); it != repos.end(); ++it ) { cout << *it << endl; } Modified: trunk/libzypp/zypp/Url.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Url.cc?rev=5655&r1=5654&r2=5655&view=diff ============================================================================== --- trunk/libzypp/zypp/Url.cc (original) +++ trunk/libzypp/zypp/Url.cc Thu May 31 18:17:48 2007 @@ -783,6 +783,10 @@ return str << url.asString(); } + bool operator<( const Url &lhs, const Url &rhs ) + { + return (lhs.asString() < rhs.asString()); + } //////////////////////////////////////////////////////////////////// } // namespace zypp Modified: trunk/libzypp/zypp/Url.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Url.h?rev=5655&r1=5654&r2=5655&view=diff ============================================================================== --- trunk/libzypp/zypp/Url.h (original) +++ trunk/libzypp/zypp/Url.h Thu May 31 18:17:48 2007 @@ -772,6 +772,11 @@ std::ostream & operator<<( std::ostream & str, const Url & url ); + /** + * needed for std::set + */ + bool operator<( const Url &lhs, const Url &rhs ); + //////////////////////////////////////////////////////////////////// } // namespace zypp ////////////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp2/RepoInfo.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepoInfo.cc?rev=5655&r1=5654&r2=5655&view=diff ============================================================================== --- trunk/libzypp/zypp2/RepoInfo.cc (original) +++ trunk/libzypp/zypp2/RepoInfo.cc Thu May 31 18:17:48 2007 @@ -162,7 +162,14 @@ { str << "--------------------------------------" << std::endl; str << "- alias : " << alias() << std::endl; - //str << "- url : " << baseUrl() << std::endl; + std::set<Url> url_set(urls()); + for ( std::set<Url>::const_iterator it = url_set.begin(); + it != url_set.end(); + ++it ) + { + str << "- url : " << *it << std::endl; + } + str << "- type : " << type() << std::endl; str << "- enabled : " << enabled() << std::endl; str << "- autorefresh : " << autorefresh() << std::endl; @@ -170,6 +177,11 @@ return str; } + std::ostream & operator<<( std::ostream & str, const RepoInfo & obj ) + { + return obj.dumpOn(str); + } + ///////////////////////////////////////////////////////////////// } // namespace zypp2 /////////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp2/RepoManager.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepoManager.cc?rev=5655&r1=5654&r2=5655&view=diff ============================================================================== --- trunk/libzypp/zypp2/RepoManager.cc (original) +++ trunk/libzypp/zypp2/RepoManager.cc Thu May 31 18:17:48 2007 @@ -44,7 +44,7 @@ ++it ) { - MIL << (*it).first << endl; + //MIL << (*it).first << endl; if (it->first == "name" ) info.setName(it-> second); else if ( it->first == "enabled" ) @@ -54,22 +54,10 @@ } // add it to the list. + repos.push_back(info); } -// dictionary *d = iniparser_new(file.c_str()); -// -// if ( d == NULL ) -// ZYPP_THROW(Exception("Failed creating dictionary")); -// -// int n = iniparser_getnsec(d); -// MIL << n << endl; -// -// for ( int i = 0; i < n; i++ ) -// { -// MIL << iniparser_getsecname(d, i) << endl; -// -// } - return std::list<RepoInfo>(); + return repos; } static std::list<RepoInfo> repositories_in_path( const Pathname &dir ) @@ -90,9 +78,7 @@ std::list<RepoInfo> RepoManager::knownRepositories() { - - - return std::list<RepoInfo>(); + return repositories_in_path("/etc/zypp/repos.d"); } } // ns zypp -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
dmacvicar@svn.opensuse.org