1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/RepoManager.cc
17 #include "zypp/base/InputStream.h"
18 #include "zypp/base/Logger.h"
19 #include "zypp/base/Gettext.h"
20 #include "zypp/base/Function.h"
21 #include "zypp/PathInfo.h"
22 #include "zypp/TmpPath.h"
24 #include "zypp/repo/RepoException.h"
25 #include "zypp/RepoManager.h"
27 #include "zypp/cache/CacheStore.h"
28 #include "zypp/repo/cached/RepoImpl.h"
29 #include "zypp/media/MediaManager.h"
30 #include "zypp/MediaSetAccess.h"
32 #include "zypp/parser/RepoFileReader.h"
33 #include "zypp/repo/yum/Downloader.h"
34 #include "zypp/parser/yum/RepoParser.h"
35 #include "zypp/parser/plaindir/RepoParser.h"
36 #include "zypp/repo/susetags/Downloader.h"
37 #include "zypp/parser/susetags/RepoParser.h"
39 #include "zypp/ZYppCallbacks.h"
43 using namespace zypp::repo;
44 using namespace zypp::filesystem;
46 using namespace zypp::repo;
48 ///////////////////////////////////////////////////////////////////
50 { /////////////////////////////////////////////////////////////////
52 ///////////////////////////////////////////////////////////////////
54 // CLASS NAME : RepoManagerOptions
56 ///////////////////////////////////////////////////////////////////
58 RepoManagerOptions::RepoManagerOptions()
60 repoCachePath = ZConfig::instance().defaultRepoCachePath();
61 repoRawCachePath = ZConfig::instance().defaultRepoMetadataPath();
62 knownReposPath = ZConfig::instance().defaultKnownReposPath();
65 ////////////////////////////////////////////////////////////////////////////
68 * \short Simple callback to collect the results
70 * Classes like RepoFileParser call the callback
71 * once per each repo in a file.
73 * Passing this functor as callback, you can collect
74 * all resuls at the end, without dealing with async
89 bool collect( const RepoInfo &repo )
91 //MIL << "here in collector: " << repo.alias() << endl;
92 repos.push_back(repo);
93 //MIL << "added: " << repo.alias() << endl;
100 ////////////////////////////////////////////////////////////////////////////
103 * Reads RepoInfo's from a repo file.
105 * \param file pathname of the file to read.
107 static std::list<RepoInfo> repositories_in_file( const Pathname & file )
109 MIL << "repo file: " << file << endl;
110 RepoCollector collector;
111 parser::RepoFileReader parser( file, bind( &RepoCollector::collect, &collector, _1 ) );
112 return collector.repos;
115 ////////////////////////////////////////////////////////////////////////////
117 std::list<RepoInfo> readRepoFile(const Url & repo_file)
119 // no interface to download a specific file, using workaround:
120 //! \todo add MediaManager::provideFile(Url file_url) to easily access any file URLs? (no need for media access id or media_nr)
122 Pathname path(url.getPathName());
123 url.setPathName ("/");
124 MediaSetAccess access(url);
125 Pathname local = access.provideFile(path);
127 DBG << "reading repo file " << repo_file << ", local path: " << local << endl;
129 return repositories_in_file(local);
132 ////////////////////////////////////////////////////////////////////////////
135 * \short List of RepoInfo's from a directory
137 * Goes trough every file in a directory and adds all
138 * RepoInfo's contained in that file.
140 * \param dir pathname of the directory to read.
142 static std::list<RepoInfo> repositories_in_dir( const Pathname &dir )
144 MIL << "directory " << dir << endl;
145 list<RepoInfo> repos;
146 list<Pathname> entries;
147 if ( filesystem::readdir( entries, Pathname(dir), false ) != 0 )
148 ZYPP_THROW(Exception("failed to read directory"));
150 for ( list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
152 list<RepoInfo> tmp = repositories_in_file( *it );
153 repos.insert( repos.end(), tmp.begin(), tmp.end() );
155 //std::copy( collector.repos.begin(), collector.repos.end(), std::back_inserter(repos));
156 //MIL << "ok" << endl;
161 ////////////////////////////////////////////////////////////////////////////
163 static void assert_alias( const RepoInfo &info )
165 if (info.alias().empty())
166 ZYPP_THROW(RepoNoAliasException());
169 ////////////////////////////////////////////////////////////////////////////
171 static void assert_urls( const RepoInfo &info )
173 if (info.baseUrls().empty())
174 ZYPP_THROW(RepoNoUrlException());
177 ////////////////////////////////////////////////////////////////////////////
180 * \short Calculates the raw cache path for a repository
182 static Pathname rawcache_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
185 return opt.repoRawCachePath + info.alias();
188 ///////////////////////////////////////////////////////////////////
190 // CLASS NAME : RepoManager::Impl
192 ///////////////////////////////////////////////////////////////////
195 * \short RepoManager implementation.
197 struct RepoManager::Impl
199 Impl( const RepoManagerOptions &opt )
210 RepoManagerOptions options;
213 /** Offer default Impl. */
214 static shared_ptr<Impl> nullimpl()
216 static shared_ptr<Impl> _nullimpl( new Impl );
221 friend Impl * rwcowClone<Impl>( const Impl * rhs );
222 /** clone for RWCOW_pointer */
224 { return new Impl( *this ); }
226 ///////////////////////////////////////////////////////////////////
228 /** \relates RepoManager::Impl Stream output */
229 inline std::ostream & operator<<( std::ostream & str, const RepoManager::Impl & obj )
231 return str << "RepoManager::Impl";
234 ///////////////////////////////////////////////////////////////////
236 // CLASS NAME : RepoManager
238 ///////////////////////////////////////////////////////////////////
240 RepoManager::RepoManager( const RepoManagerOptions &opt )
241 : _pimpl( new Impl(opt) )
244 ////////////////////////////////////////////////////////////////////////////
246 RepoManager::~RepoManager()
249 ////////////////////////////////////////////////////////////////////////////
251 std::list<RepoInfo> RepoManager::knownRepositories() const
255 if ( PathInfo(_pimpl->options.knownReposPath).isExist() )
256 return repositories_in_dir(_pimpl->options.knownReposPath);
258 return std::list<RepoInfo>();
263 ////////////////////////////////////////////////////////////////////////////
265 RepoStatus RepoManager::metadataStatus( const RepoInfo &info ) const
267 Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
268 RepoType repokind = info.type();
271 switch ( repokind.toEnum() )
273 case RepoType::NONE_e:
274 // unknown, probe the local metadata
275 repokind = probe(rawpath.asUrl());
281 switch ( repokind.toEnum() )
283 case RepoType::RPMMD_e :
285 status = RepoStatus( rawpath + "/repodata/repomd.xml");
289 case RepoType::YAST2_e :
291 status = RepoStatus( rawpath + "/content");
295 case RepoType::RPMPLAINDIR_e :
297 if ( PathInfo(Pathname(rawpath + "/cookie")).isExist() )
298 status = RepoStatus( rawpath + "/cookie");
302 case RepoType::NONE_e :
303 // Return default RepoStatus in case of RepoType::NONE
304 // indicating it should be created?
305 // ZYPP_THROW(RepoUnknownTypeException());
311 void RepoManager::refreshMetadata( const RepoInfo &info,
312 RawMetadataRefreshPolicy policy,
313 const ProgressData::ReceiverFnc & progress )
318 RepoStatus oldstatus;
319 RepoStatus newstatus;
320 // try urls one by one
321 for ( RepoInfo::urls_const_iterator it = info.baseUrlsBegin(); it != info.baseUrlsEnd(); ++it )
326 filesystem::TmpDir tmpdir;
328 repo::RepoType repokind = info.type();
330 // if the type is unknown, try probing.
331 switch ( repokind.toEnum() )
333 case RepoType::NONE_e:
335 repokind = probe(*it);
341 Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
342 filesystem::assert_dir(rawpath);
343 oldstatus = metadataStatus(info);
345 if ( ( repokind.toEnum() == RepoType::RPMMD_e ) ||
346 ( repokind.toEnum() == RepoType::YAST2_e ) )
348 MediaSetAccess media(url);
349 shared_ptr<repo::Downloader> downloader_ptr;
351 if ( repokind.toEnum() == RepoType::RPMMD_e )
352 downloader_ptr.reset(new yum::Downloader(info.path()));
354 downloader_ptr.reset( new susetags::Downloader(info.path()));
357 * Given a downloader, sets the other repos raw metadata
358 * path as cache paths for the fetcher, so if another
359 * repo has the same file, it will not download it
360 * but copy it from the other repository
362 std::list<RepoInfo> repos = knownRepositories();
363 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
367 downloader_ptr->addCachePath(rawcache_path_for_repoinfo( _pimpl->options, *it ));
370 RepoStatus newstatus = downloader_ptr->status(media);
371 bool refresh = false;
372 if ( oldstatus.checksum() == newstatus.checksum() )
374 MIL << "repo has not changed" << endl;
375 if ( policy == RefreshForced )
377 MIL << "refresh set to forced" << endl;
386 downloader_ptr->download( media, tmpdir.path());
391 else if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e )
393 RepoStatus newstatus = parser::plaindir::dirStatus(url.getPathName());
394 bool refresh = false;
395 if ( oldstatus.checksum() == newstatus.checksum() )
397 MIL << "repo has not changed" << endl;
398 if ( policy == RefreshForced )
400 MIL << "refresh set to forced" << endl;
411 std::ofstream file(( tmpdir.path() + "/cookie").c_str());
413 ZYPP_THROW (Exception( "Can't open " + tmpdir.path().asString() + "/cookie" ) );
416 file << newstatus.checksum() << endl;
426 ZYPP_THROW(RepoUnknownTypeException());
429 // ok we have the metadata, now exchange
432 filesystem::rename( rawpath, oldmetadata.path() );
433 // move the just downloaded there
434 filesystem::rename( tmpdir.path(), rawpath );
438 catch ( const Exception &e )
441 ERR << "Trying another url..." << endl;
444 ERR << "No more urls..." << endl;
445 ZYPP_THROW(RepoException("Cant refresh metadata"));
448 ////////////////////////////////////////////////////////////////////////////
450 void RepoManager::cleanMetadata( const RepoInfo &info,
451 const ProgressData::ReceiverFnc & progress )
453 filesystem::recursive_rmdir(rawcache_path_for_repoinfo(_pimpl->options, info));
456 void RepoManager::buildCache( const RepoInfo &info,
457 CacheBuildPolicy policy,
458 const ProgressData::ReceiverFnc & progressrcv )
460 ProgressData progress(100);
461 callback::SendReport<ProgressReport> report;
462 progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
463 progress.name(str::form(_("Building repository '%s' cache"), info.alias().c_str()));
467 Pathname rawpath = rawcache_path_for_repoinfo(_pimpl->options, info);
469 cache::CacheStore store(_pimpl->options.repoCachePath);
471 RepoStatus raw_metadata_status = metadataStatus(info);
472 if ( raw_metadata_status.empty() )
474 ZYPP_THROW(RepoMetadataException(info));
477 if ( store.isCached( info.alias() ) )
479 MIL << info.alias() << " is already cached." << endl;
480 data::RecordId id = store.lookupRepository(info.alias());
481 RepoStatus cache_status = store.repositoryStatus(id);
483 if ( cache_status.checksum() == raw_metadata_status.checksum() )
485 MIL << info.alias() << " cache is up to date with metadata." << endl;
486 if ( policy == BuildIfNeeded ) {
491 MIL << info.alias() << " cache rebuild is forced" << endl;
494 MIL << info.alias() << " cleaning cache..." << endl;
495 store.cleanRepository(id);
498 MIL << info.alias() << " building cache..." << endl;
499 data::RecordId id = store.lookupOrAppendRepository(info.alias());
501 repo::RepoType repokind = info.type();
503 // if the type is unknown, try probing.
504 switch ( repokind.toEnum() )
506 case RepoType::NONE_e:
507 // unknown, probe the local metadata
508 repokind = probe(rawpath.asUrl());
514 CombinedProgressData subprogrcv( progress, 100);
516 switch ( repokind.toEnum() )
518 case RepoType::RPMMD_e :
520 parser::yum::RepoParser parser(id, store, parser::yum::RepoParserOpts(), subprogrcv);
521 parser.parse(rawpath);
525 case RepoType::YAST2_e :
527 parser::susetags::RepoParser parser(id, store, subprogrcv);
528 parser.parse(rawpath);
532 case RepoType::RPMPLAINDIR_e :
534 InputStream is(rawpath + "cookie");
536 getline( is.stream(), buffer);
538 parser::plaindir::RepoParser parser(id, store, subprogrcv);
539 parser.parse(url.getPathName());
543 ZYPP_THROW(RepoUnknownTypeException());
546 // update timestamp and checksum
547 store.updateRepositoryStatus(id, raw_metadata_status);
549 MIL << "Commit cache.." << endl;
554 ////////////////////////////////////////////////////////////////////////////
556 repo::RepoType RepoManager::probe( const Url &url ) const
558 if ( url.getScheme() == "dir" && ! PathInfo( url.getPathName() ).isDir() )
560 // Handle non existing local directory in advance, as
561 // MediaSetAccess does not support it.
562 return repo::RepoType::NONE;
565 MediaSetAccess access(url);
566 if ( access.doesFileExist("/repodata/repomd.xml") )
567 return repo::RepoType::RPMMD;
568 if ( access.doesFileExist("/content") )
569 return repo::RepoType::YAST2;
571 // if it is a local url of type dir
572 if ( (! media::MediaManager::downloads(url)) && ( url.getScheme() == "dir" ) )
574 Pathname path = Pathname(url.getPathName());
575 if ( PathInfo(path).isDir() )
577 // allow empty dirs for now
578 return repo::RepoType::RPMPLAINDIR;
582 return repo::RepoType::NONE;
585 ////////////////////////////////////////////////////////////////////////////
587 void RepoManager::cleanCache( const RepoInfo &info,
588 const ProgressData::ReceiverFnc & progressrcv )
590 ProgressData progress(100);
591 callback::SendReport<ProgressReport> report;
592 progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
593 progress.name(str::form(_("Cleaning repository '%s' cache"), info.alias().c_str()));
596 cache::CacheStore store(_pimpl->options.repoCachePath);
598 data::RecordId id = store.lookupRepository(info.alias());
599 store.cleanRepository(id);
603 ////////////////////////////////////////////////////////////////////////////
605 bool RepoManager::isCached( const RepoInfo &info ) const
607 cache::CacheStore store(_pimpl->options.repoCachePath);
608 return store.isCached(info.alias());
611 RepoStatus RepoManager::cacheStatus( const RepoInfo &info ) const
613 cache::CacheStore store(_pimpl->options.repoCachePath);
614 data::RecordId id = store.lookupRepository(info.alias());
615 RepoStatus cache_status = store.repositoryStatus(id);
619 Repository RepoManager::createFromCache( const RepoInfo &info,
620 const ProgressData::ReceiverFnc & progressrcv )
622 callback::SendReport<ProgressReport> report;
623 ProgressData progress;
624 progress.sendTo(ProgressReportAdaptor( progressrcv, report ));
625 progress.sendTo( progressrcv );
626 progress.name(str::form(_("Reading repository '%s' cache"), info.alias().c_str()));
629 cache::CacheStore store(_pimpl->options.repoCachePath);
631 if ( ! store.isCached( info.alias() ) )
632 ZYPP_THROW(RepoNotCachedException());
634 MIL << "Repository " << info.alias() << " is cached" << endl;
636 data::RecordId id = store.lookupRepository(info.alias());
638 repo::cached::RepoOptions opts( info, _pimpl->options.repoCachePath, id );
639 opts.readingResolvablesProgress = progressrcv;
640 repo::cached::RepoImpl::Ptr repoimpl =
641 new repo::cached::RepoImpl( opts );
643 repoimpl->resolvables();
644 // read the resolvables from cache
645 return Repository(repoimpl);
648 ////////////////////////////////////////////////////////////////////////////
651 * Generate a non existing filename in a directory, using a base
652 * name. For example if a directory contains 3 files
658 * If you try to generate a unique filename for this directory,
659 * based on "ruu" you will get "ruu", but if you use the base
660 * "foo" you will get "foo_1"
662 * \param dir Directory where the file needs to be unique
663 * \param basefilename string to base the filename on.
665 static Pathname generate_non_existing_name( const Pathname &dir,
666 const std::string &basefilename )
668 string final_filename = basefilename;
670 while ( PathInfo(dir + final_filename).isExist() )
672 final_filename = basefilename + "_" + str::numstring(counter);
675 return dir + Pathname(final_filename);
678 ////////////////////////////////////////////////////////////////////////////
681 * \short Generate a related filename from a repo info
683 * From a repo info, it will try to use the alias as a filename
684 * escaping it if necessary. Other fallbacks can be added to
685 * this function in case there is no way to use the alias
687 static std::string generate_filename( const RepoInfo &info )
691 std::string filename = info.alias();
692 // replace slashes with underscores
693 size_t pos = filename.find(fnd);
694 while(pos!=string::npos)
696 filename.replace(pos,fnd.length(),rep);
697 pos = filename.find(fnd,pos+rep.length());
699 filename = Pathname(filename).extend(".repo").asString();
700 MIL << "generating filename for repo [" << info.alias() << "] : '" << filename << "'" << endl;
705 ////////////////////////////////////////////////////////////////////////////
707 void RepoManager::addRepository( const RepoInfo &info,
708 const ProgressData::ReceiverFnc & progressrcv )
712 ProgressData progress(100);
713 callback::SendReport<ProgressReport> report;
714 progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
715 progress.name(str::form(_("Adding repository '%s'"), info.alias().c_str()));
718 std::list<RepoInfo> repos = knownRepositories();
719 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
723 if ( info.alias() == (*it).alias() )
724 ZYPP_THROW(RepoAlreadyExistsException(info.alias()));
729 // assert the directory exists
730 filesystem::assert_dir(_pimpl->options.knownReposPath);
732 Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath,
733 generate_filename(info));
734 // now we have a filename that does not exists
735 MIL << "Saving repo in " << repofile << endl;
737 std::ofstream file(repofile.c_str());
739 ZYPP_THROW (Exception( "Can't open " + repofile.asString() ) );
742 info.dumpRepoOn(file);
744 MIL << "done" << endl;
747 void RepoManager::addRepositories( const Url &url,
748 const ProgressData::ReceiverFnc & progressrcv )
750 std::list<RepoInfo> knownrepos = knownRepositories();
751 std::list<RepoInfo> repos = readRepoFile(url);
752 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
756 // look if the alias is in the known repos.
757 for ( std::list<RepoInfo>::const_iterator kit = knownrepos.begin();
758 kit != knownrepos.end();
761 if ( (*it).alias() == (*kit).alias() )
763 ERR << "To be added repo " << (*it).alias() << " conflicts with existing repo " << (*kit).alias() << endl;
764 ZYPP_THROW(RepoAlreadyExistsException((*it).alias()));
769 string filename = Pathname(url.getPathName()).basename();
771 if ( filename == Pathname() )
772 ZYPP_THROW(RepoException("Invalid repo file name at " + url.asString() ));
774 // assert the directory exists
775 filesystem::assert_dir(_pimpl->options.knownReposPath);
777 Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath, filename);
778 // now we have a filename that does not exists
779 MIL << "Saving " << repos.size() << " repo" << ( repos.size() ? "s" : "" ) << " in " << repofile << endl;
781 std::ofstream file(repofile.c_str());
783 ZYPP_THROW (Exception( "Can't open " + repofile.asString() ) );
786 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
790 MIL << "Saving " << (*it).alias() << endl;
791 (*it).dumpRepoOn(file);
793 MIL << "done" << endl;
796 ////////////////////////////////////////////////////////////////////////////
798 void RepoManager::removeRepository( const RepoInfo & info,
799 const ProgressData::ReceiverFnc & progressrcv)
801 MIL << "Going to delete repo " << info.alias() << endl;
803 std::list<RepoInfo> repos = knownRepositories();
804 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
808 // they can be the same only if the provided is empty, that means
809 // the provided repo has no alias
811 if ( (!info.alias().empty()) && ( info.alias() != (*it).alias() ) )
816 // we have a matcing repository, now we need to know
817 // where it does come from.
818 RepoInfo todelete = *it;
819 if (todelete.filepath().empty())
821 ZYPP_THROW(RepoException("Can't figure where the repo is stored"));
825 // figure how many repos are there in the file:
826 std::list<RepoInfo> filerepos = repositories_in_file(todelete.filepath());
827 if ( (filerepos.size() == 1) && ( filerepos.front().alias() == todelete.alias() ) )
829 // easy, only this one, just delete the file
830 if ( filesystem::unlink(todelete.filepath()) != 0 )
832 ZYPP_THROW(RepoException("Can't delete " + todelete.filepath().asString()));
834 MIL << todelete.alias() << " sucessfully deleted." << endl;
839 // there are more repos in the same file
840 // write them back except the deleted one.
842 //std::ofstream file(tmp.path().c_str());
844 // assert the directory exists
845 filesystem::assert_dir(todelete.filepath().dirname());
847 std::ofstream file(todelete.filepath().c_str());
849 //ZYPP_THROW (Exception( "Can't open " + tmp.path().asString() ) );
850 ZYPP_THROW (Exception( "Can't open " + todelete.filepath().asString() ) );
852 for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
853 fit != filerepos.end();
856 if ( (*fit).alias() != todelete.alias() )
857 (*fit).dumpRepoOn(file);
860 cache::CacheStore store(_pimpl->options.repoCachePath);
862 if ( store.isCached( todelete.alias() ) ) {
863 MIL << "repository was cached. cleaning cache" << endl;
864 store.cleanRepository(todelete.alias());
867 MIL << todelete.alias() << " sucessfully deleted." << endl;
870 } // else filepath is empty
873 // should not be reached on a sucess workflow
874 ZYPP_THROW(RepoNotFoundException(info));
877 ////////////////////////////////////////////////////////////////////////////
879 void RepoManager::modifyRepository( const std::string &alias,
880 const RepoInfo & newinfo,
881 const ProgressData::ReceiverFnc & progressrcv )
883 RepoInfo toedit = getRepositoryInfo(alias);
885 if (toedit.filepath().empty())
887 ZYPP_THROW(RepoException("Can't figure where the repo is stored"));
891 // figure how many repos are there in the file:
892 std::list<RepoInfo> filerepos = repositories_in_file(toedit.filepath());
894 // there are more repos in the same file
895 // write them back except the deleted one.
897 //std::ofstream file(tmp.path().c_str());
899 // assert the directory exists
900 filesystem::assert_dir(toedit.filepath().dirname());
902 std::ofstream file(toedit.filepath().c_str());
904 //ZYPP_THROW (Exception( "Can't open " + tmp.path().asString() ) );
905 ZYPP_THROW (Exception( "Can't open " + toedit.filepath().asString() ) );
907 for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
908 fit != filerepos.end();
911 // if the alias is different, dump the original
912 // if it is the same, dump the provided one
913 if ( (*fit).alias() != toedit.alias() )
914 (*fit).dumpRepoOn(file);
916 newinfo.dumpRepoOn(file);
921 ////////////////////////////////////////////////////////////////////////////
923 RepoInfo RepoManager::getRepositoryInfo( const std::string &alias,
924 const ProgressData::ReceiverFnc & progressrcv )
926 std::list<RepoInfo> repos = knownRepositories();
927 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
931 if ( (*it).alias() == alias )
935 info.setAlias(info.alias());
936 ZYPP_THROW(RepoNotFoundException(info));
939 ////////////////////////////////////////////////////////////////////////////
941 RepoInfo RepoManager::getRepositoryInfo( const Url & url,
942 const url::ViewOption & urlview,
943 const ProgressData::ReceiverFnc & progressrcv )
945 std::list<RepoInfo> repos = knownRepositories();
946 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
950 for(RepoInfo::urls_const_iterator urlit = (*it).baseUrlsBegin();
951 urlit != (*it).baseUrlsEnd();
954 if ((*urlit).asString(urlview) == url.asString(urlview))
959 info.setAlias(info.alias());
960 info.setBaseUrl(url);
961 ZYPP_THROW(RepoNotFoundException(info));
964 ////////////////////////////////////////////////////////////////////////////
966 std::ostream & operator<<( std::ostream & str, const RepoManager & obj )
968 return str << *obj._pimpl;
971 /////////////////////////////////////////////////////////////////
973 ///////////////////////////////////////////////////////////////////