Author: jkupec Date: Wed Jul 18 10:49:19 2007 New Revision: 6054 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6054&view=rev Log: getRepositoryInfo(Url,url::ViewOption) added Modified: trunk/libzypp/zypp/RepoManager.cc trunk/libzypp/zypp/RepoManager.h Modified: trunk/libzypp/zypp/RepoManager.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=6054&r1=6053&r2=6054&view=diff ============================================================================== --- trunk/libzypp/zypp/RepoManager.cc (original) +++ trunk/libzypp/zypp/RepoManager.cc Wed Jul 18 10:49:19 2007 @@ -911,6 +911,31 @@ //////////////////////////////////////////////////////////////////////////// + RepoInfo RepoManager::getRepositoryInfo( const Url & url, + const url::ViewOption & urlview, + const ProgressData::ReceiverFnc & progressrcv ) + { + std::list<RepoInfo> repos = knownRepositories(); + for ( std::list<RepoInfo>::const_iterator it = repos.begin(); + it != repos.end(); + ++it ) + { + for(RepoInfo::urls_const_iterator urlit = (*it).baseUrlsBegin(); + urlit != (*it).baseUrlsEnd(); + ++urlit) + { + if ((*urlit).asString(urlview) == url.asString(urlview)) + return *it; + } + } + RepoInfo info; + info.setAlias(info.alias()); + info.setBaseUrl(url); + ZYPP_THROW(RepoNotFoundException(info)); + } + + //////////////////////////////////////////////////////////////////////////// + std::ostream & operator<<( std::ostream & str, const RepoManager & obj ) { return str << *obj._pimpl; Modified: trunk/libzypp/zypp/RepoManager.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.h?rev=6054&r1=6053&r2=6054&view=diff ============================================================================== --- trunk/libzypp/zypp/RepoManager.h (original) +++ trunk/libzypp/zypp/RepoManager.h Wed Jul 18 10:49:19 2007 @@ -90,7 +90,7 @@ { }; - + /** * \short List known repositories. * @@ -257,6 +257,28 @@ RepoInfo getRepositoryInfo( const std::string &alias, const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); + /** + * \short Find repository info by URL. + * + * \param url URL to find. + * \param urlview url::ViewOption to influence URL matching. + * \param progressrcv Progress receiver function. + * + * \note if multple repositories incorrectly share the + * same URL, the first one found will be returned. + * + * \note the string representation of the URLs are compared. + * The \a urlview can be used to influence which + parts of the URL are to be compared. + * + * \throws RepoNotFoundException If no repo match + * \throws ParseException If the file parsing fails + * \throws Exception On other errors. + */ + RepoInfo getRepositoryInfo( const Url & url, + const url::ViewOption & urlview = url::ViewOption::DEFAULTS, + const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); + protected: RepoStatus rawMetadataStatus( const RepoInfo &info ); RepoStatus cacheStatus( const RepoInfo &info ); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org