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()
61 repoCachePath = globalConfig.defaultRepoCachePath();
62 repoRawCachePath = globalConfig.defaultRepoRawCachePath();
63 knownReposPath = globalConfig.defaultKnownReposPath();
66 ////////////////////////////////////////////////////////////////////////////
69 * \short Simple callback to collect the results
71 * Classes like RepoFileParser call the callback
72 * once per each repo in a file.
74 * Passing this functor as callback, you can collect
75 * all resuls at the end, without dealing with async
90 bool collect( const RepoInfo &repo )
92 //MIL << "here in collector: " << repo.alias() << endl;
93 repos.push_back(repo);
94 //MIL << "added: " << repo.alias() << endl;
101 ////////////////////////////////////////////////////////////////////////////
104 * Reads RepoInfo's from a repo file.
106 * \param file pathname of the file to read.
108 static std::list<RepoInfo> repositories_in_file( const Pathname & file )
110 MIL << "repo file: " << file << endl;
111 RepoCollector collector;
112 parser::RepoFileReader parser( file, bind( &RepoCollector::collect, &collector, _1 ) );
113 return collector.repos;
116 ////////////////////////////////////////////////////////////////////////////
118 std::list<RepoInfo> readRepoFile(const Url & repo_file)
120 // no interface to download a specific file, using workaround:
121 //! \todo add MediaManager::provideFile(Url file_url) to easily access any file URLs? (no need for media access id or media_nr)
123 Pathname path(url.getPathName());
124 url.setPathName ("/");
125 MediaSetAccess access(url);
126 Pathname local = access.provideFile(path);
128 DBG << "reading repo file " << repo_file << ", local path: " << local << endl;
130 return repositories_in_file(local);
133 ////////////////////////////////////////////////////////////////////////////
136 * \short List of RepoInfo's from a directory
138 * Goes trough every file in a directory and adds all
139 * RepoInfo's contained in that file.
141 * \param dir pathname of the directory to read.
143 static std::list<RepoInfo> repositories_in_dir( const Pathname &dir )
145 MIL << "directory " << dir << endl;
146 list<RepoInfo> repos;
147 list<Pathname> entries;
148 if ( filesystem::readdir( entries, Pathname(dir), false ) != 0 )
149 ZYPP_THROW(Exception("failed to read directory"));
151 for ( list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
153 list<RepoInfo> tmp = repositories_in_file( *it );
154 repos.insert( repos.end(), tmp.begin(), tmp.end() );
156 //std::copy( collector.repos.begin(), collector.repos.end(), std::back_inserter(repos));
157 //MIL << "ok" << endl;
162 ////////////////////////////////////////////////////////////////////////////
164 static void assert_alias( const RepoInfo &info )
166 if (info.alias().empty())
167 ZYPP_THROW(RepoNoAliasException());
170 ////////////////////////////////////////////////////////////////////////////
172 static void assert_urls( const RepoInfo &info )
174 if (info.baseUrls().empty())
175 ZYPP_THROW(RepoNoUrlException());
178 ////////////////////////////////////////////////////////////////////////////
181 * \short Calculates the raw cache path for a repository
183 static Pathname rawcache_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
186 return opt.repoRawCachePath + info.alias();
189 ///////////////////////////////////////////////////////////////////
191 // CLASS NAME : RepoManager::Impl
193 ///////////////////////////////////////////////////////////////////
196 * \short RepoManager implementation.
198 struct RepoManager::Impl
200 Impl( const RepoManagerOptions &opt )
211 RepoManagerOptions options;
214 /** Offer default Impl. */
215 static shared_ptr<Impl> nullimpl()
217 static shared_ptr<Impl> _nullimpl( new Impl );
222 friend Impl * rwcowClone<Impl>( const Impl * rhs );
223 /** clone for RWCOW_pointer */
225 { return new Impl( *this ); }
227 ///////////////////////////////////////////////////////////////////
229 /** \relates RepoManager::Impl Stream output */
230 inline std::ostream & operator<<( std::ostream & str, const RepoManager::Impl & obj )
232 return str << "RepoManager::Impl";
235 ///////////////////////////////////////////////////////////////////
237 // CLASS NAME : RepoManager
239 ///////////////////////////////////////////////////////////////////
241 RepoManager::RepoManager( const RepoManagerOptions &opt )
242 : _pimpl( new Impl(opt) )
245 ////////////////////////////////////////////////////////////////////////////
247 RepoManager::~RepoManager()
250 ////////////////////////////////////////////////////////////////////////////
252 std::list<RepoInfo> RepoManager::knownRepositories() const
256 if ( PathInfo(_pimpl->options.knownReposPath).isExist() )
257 return repositories_in_dir(_pimpl->options.knownReposPath);
259 return std::list<RepoInfo>();
264 ////////////////////////////////////////////////////////////////////////////
266 RepoStatus RepoManager::rawMetadataStatus( const RepoInfo &info )
268 Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
269 RepoType repokind = info.type();
272 switch ( repokind.toEnum() )
274 case RepoType::NONE_e:
275 // unknown, probe the local metadata
276 repokind = probe(rawpath.asUrl());
282 switch ( repokind.toEnum() )
284 case RepoType::RPMMD_e :
286 status = RepoStatus( rawpath + "/repodata/repomd.xml");
290 case RepoType::YAST2_e :
292 status = RepoStatus( rawpath + "/content");
296 case RepoType::RPMPLAINDIR_e :
298 if ( PathInfo(Pathname(rawpath + "/cookie")).isExist() )
299 status = RepoStatus( rawpath + "/cookie");
303 case RepoType::NONE_e :
304 // Return default RepoStatus in case of RepoType::NONE
305 // indicating it should be created?
306 // ZYPP_THROW(RepoUnknownTypeException());
312 void RepoManager::refreshMetadata( const RepoInfo &info,
313 RawMetadataRefreshPolicy policy,
314 const ProgressData::ReceiverFnc & progress )
319 RepoStatus oldstatus;
320 RepoStatus newstatus;
321 // try urls one by one
322 for ( RepoInfo::urls_const_iterator it = info.baseUrlsBegin(); it != info.baseUrlsEnd(); ++it )
327 filesystem::TmpDir tmpdir;
329 repo::RepoType repokind = info.type();
331 // if the type is unknown, try probing.
332 switch ( repokind.toEnum() )
334 case RepoType::NONE_e:
336 repokind = probe(*it);
342 Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
343 oldstatus = rawMetadataStatus(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::assert_dir(rawpath);
433 filesystem::rename( rawpath, oldmetadata.path() );
434 // move the just downloaded there
435 filesystem::rename( tmpdir.path(), rawpath );
439 catch ( const Exception &e )
442 ERR << "Trying another url..." << endl;
445 ERR << "No more urls..." << endl;
446 ZYPP_THROW(RepoException("Cant refresh metadata"));
449 ////////////////////////////////////////////////////////////////////////////
451 void RepoManager::cleanMetadata( const RepoInfo &info,
452 const ProgressData::ReceiverFnc & progress )
454 filesystem::recursive_rmdir(rawcache_path_for_repoinfo(_pimpl->options, info));
457 void RepoManager::buildCache( const RepoInfo &info,
458 CacheBuildPolicy policy,
459 const ProgressData::ReceiverFnc & progressrcv )
461 ProgressData progress(100);
462 callback::SendReport<ProgressReport> report;
463 progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
464 progress.name(str::form(_("Building repository '%s' cache"), info.alias().c_str()));
468 Pathname rawpath = rawcache_path_for_repoinfo(_pimpl->options, info);
470 cache::CacheStore store(_pimpl->options.repoCachePath);
472 RepoStatus raw_metadata_status = rawMetadataStatus(info);
473 if ( raw_metadata_status.empty() )
475 ZYPP_THROW(RepoMetadataException(info));
478 if ( store.isCached( info.alias() ) )
480 MIL << info.alias() << " is already cached." << endl;
481 data::RecordId id = store.lookupRepository(info.alias());
482 RepoStatus cache_status = store.repositoryStatus(id);
484 if ( cache_status.checksum() == raw_metadata_status.checksum() )
486 MIL << info.alias() << " cache is up to date with metadata." << endl;
487 if ( policy == BuildIfNeeded ) {
492 MIL << info.alias() << " cache rebuild is forced" << endl;
495 MIL << info.alias() << " cleaning cache..." << endl;
496 store.cleanRepository(id);
499 MIL << info.alias() << " building cache..." << endl;
500 data::RecordId id = store.lookupOrAppendRepository(info.alias());
502 repo::RepoType repokind = info.type();
504 // if the type is unknown, try probing.
505 switch ( repokind.toEnum() )
507 case RepoType::NONE_e:
508 // unknown, probe the local metadata
509 repokind = probe(rawpath.asUrl());
515 CombinedProgressData subprogrcv( progress, 100);
517 switch ( repokind.toEnum() )
519 case RepoType::RPMMD_e :
521 parser::yum::RepoParser parser(id, store, parser::yum::RepoParserOpts(), subprogrcv);
522 parser.parse(rawpath);
526 case RepoType::YAST2_e :
528 parser::susetags::RepoParser parser(id, store, subprogrcv);
529 parser.parse(rawpath);
533 case RepoType::RPMPLAINDIR_e :
535 InputStream is(rawpath + "cookie");
537 getline( is.stream(), buffer);
539 parser::plaindir::RepoParser parser(id, store, subprogrcv);
540 parser.parse(url.getPathName());
544 ZYPP_THROW(RepoUnknownTypeException());
547 // update timestamp and checksum
548 store.updateRepositoryStatus(id, raw_metadata_status);
550 MIL << "Commit cache.." << endl;
555 ////////////////////////////////////////////////////////////////////////////
557 repo::RepoType RepoManager::probe( const Url &url )
559 if ( url.getScheme() == "dir" && ! PathInfo( url.getPathName() ).isDir() )
561 // Handle non existing local directory in advance, as
562 // MediaSetAccess does not support it.
563 return repo::RepoType::NONE;
566 MediaSetAccess access(url);
567 if ( access.doesFileExist("/repodata/repomd.xml") )
568 return repo::RepoType::RPMMD;
569 if ( access.doesFileExist("/content") )
570 return repo::RepoType::YAST2;
572 // if it is a local url of type dir
573 if ( (! media::MediaManager::downloads(url)) && ( url.getScheme() == "dir" ) )
575 Pathname path = Pathname(url.getPathName());
576 if ( PathInfo(path).isDir() )
578 // allow empty dirs for now
579 return repo::RepoType::RPMPLAINDIR;
583 return repo::RepoType::NONE;
586 ////////////////////////////////////////////////////////////////////////////
588 void RepoManager::cleanCache( const RepoInfo &info,
589 const ProgressData::ReceiverFnc & progressrcv )
591 ProgressData progress(100);
592 callback::SendReport<ProgressReport> report;
593 progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
594 progress.name(str::form(_("Cleaning repository '%s' cache"), info.alias().c_str()));
597 cache::CacheStore store(_pimpl->options.repoCachePath);
599 data::RecordId id = store.lookupRepository(info.alias());
600 store.cleanRepository(id);
604 ////////////////////////////////////////////////////////////////////////////
606 bool RepoManager::isCached( const RepoInfo &info ) const
608 cache::CacheStore store(_pimpl->options.repoCachePath);
609 return store.isCached(info.alias());
612 Repository RepoManager::createFromCache( const RepoInfo &info,
613 const ProgressData::ReceiverFnc & progressrcv )
615 callback::SendReport<ProgressReport> report;
616 ProgressData progress;
617 progress.sendTo(ProgressReportAdaptor( progressrcv, report ));
618 progress.sendTo( progressrcv );
619 progress.name(str::form(_("Reading repository '%s' cache"), info.alias().c_str()));
622 cache::CacheStore store(_pimpl->options.repoCachePath);
624 if ( ! store.isCached( info.alias() ) )
625 ZYPP_THROW(RepoNotCachedException());
627 MIL << "Repository " << info.alias() << " is cached" << endl;
629 data::RecordId id = store.lookupRepository(info.alias());
631 repo::cached::RepoOptions opts( info, _pimpl->options.repoCachePath, id );
632 opts.readingResolvablesProgress = progressrcv;
633 repo::cached::RepoImpl::Ptr repoimpl =
634 new repo::cached::RepoImpl( opts );
636 repoimpl->resolvables();
637 // read the resolvables from cache
638 return Repository(repoimpl);
641 ////////////////////////////////////////////////////////////////////////////
644 * Generate a non existing filename in a directory, using a base
645 * name. For example if a directory contains 3 files
651 * If you try to generate a unique filename for this directory,
652 * based on "ruu" you will get "ruu", but if you use the base
653 * "foo" you will get "foo_1"
655 * \param dir Directory where the file needs to be unique
656 * \param basefilename string to base the filename on.
658 static Pathname generate_non_existing_name( const Pathname &dir,
659 const std::string &basefilename )
661 string final_filename = basefilename;
663 while ( PathInfo(dir + final_filename).isExist() )
665 final_filename = basefilename + "_" + str::numstring(counter);
668 return dir + Pathname(final_filename);
671 ////////////////////////////////////////////////////////////////////////////
674 * \short Generate a related filename from a repo info
676 * From a repo info, it will try to use the alias as a filename
677 * escaping it if necessary. Other fallbacks can be added to
678 * this function in case there is no way to use the alias
680 static std::string generate_filename( const RepoInfo &info )
684 std::string filename = info.alias();
685 // replace slashes with underscores
686 size_t pos = filename.find(fnd);
687 while(pos!=string::npos)
689 filename.replace(pos,fnd.length(),rep);
690 pos = filename.find(fnd,pos+rep.length());
692 filename = Pathname(filename).extend(".repo").asString();
693 MIL << "generating filename for repo [" << info.alias() << "] : '" << filename << "'" << endl;
698 ////////////////////////////////////////////////////////////////////////////
700 void RepoManager::addRepository( const RepoInfo &info,
701 const ProgressData::ReceiverFnc & progressrcv )
705 ProgressData progress(100);
706 callback::SendReport<ProgressReport> report;
707 progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
708 progress.name(str::form(_("Adding repository '%s'"), info.alias().c_str()));
711 std::list<RepoInfo> repos = knownRepositories();
712 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
716 if ( info.alias() == (*it).alias() )
717 ZYPP_THROW(RepoAlreadyExistsException(info.alias()));
722 // assert the directory exists
723 filesystem::assert_dir(_pimpl->options.knownReposPath);
725 Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath,
726 generate_filename(info));
727 // now we have a filename that does not exists
728 MIL << "Saving repo in " << repofile << endl;
730 std::ofstream file(repofile.c_str());
732 ZYPP_THROW (Exception( "Can't open " + repofile.asString() ) );
735 info.dumpRepoOn(file);
737 MIL << "done" << endl;
740 void RepoManager::addRepositories( const Url &url,
741 const ProgressData::ReceiverFnc & progressrcv )
743 std::list<RepoInfo> knownrepos = knownRepositories();
744 std::list<RepoInfo> repos = readRepoFile(url);
745 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
749 // look if the alias is in the known repos.
750 for ( std::list<RepoInfo>::const_iterator kit = knownrepos.begin();
751 kit != knownrepos.end();
754 if ( (*it).alias() == (*kit).alias() )
756 ERR << "To be added repo " << (*it).alias() << " conflicts with existing repo " << (*kit).alias() << endl;
757 ZYPP_THROW(RepoAlreadyExistsException((*it).alias()));
762 string filename = Pathname(url.getPathName()).basename();
764 if ( filename == Pathname() )
765 ZYPP_THROW(RepoException("Invalid repo file name at " + url.asString() ));
767 // assert the directory exists
768 filesystem::assert_dir(_pimpl->options.knownReposPath);
770 Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath, filename);
771 // now we have a filename that does not exists
772 MIL << "Saving " << repos.size() << " repo" << ( repos.size() ? "s" : "" ) << " in " << repofile << endl;
774 std::ofstream file(repofile.c_str());
776 ZYPP_THROW (Exception( "Can't open " + repofile.asString() ) );
779 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
783 MIL << "Saving " << (*it).alias() << endl;
784 (*it).dumpRepoOn(file);
786 MIL << "done" << endl;
789 ////////////////////////////////////////////////////////////////////////////
791 void RepoManager::removeRepository( const RepoInfo & info,
792 const ProgressData::ReceiverFnc & progressrcv)
794 MIL << "Going to delete repo " << info.alias() << endl;
796 std::list<RepoInfo> repos = knownRepositories();
797 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
801 // they can be the same only if the provided is empty, that means
802 // the provided repo has no alias
804 if ( (!info.alias().empty()) && ( info.alias() != (*it).alias() ) )
809 // we have a matcing repository, now we need to know
810 // where it does come from.
811 RepoInfo todelete = *it;
812 if (todelete.filepath().empty())
814 ZYPP_THROW(RepoException("Can't figure where the repo is stored"));
818 // figure how many repos are there in the file:
819 std::list<RepoInfo> filerepos = repositories_in_file(todelete.filepath());
820 if ( (filerepos.size() == 1) && ( filerepos.front().alias() == todelete.alias() ) )
822 // easy, only this one, just delete the file
823 if ( filesystem::unlink(todelete.filepath()) != 0 )
825 ZYPP_THROW(RepoException("Can't delete " + todelete.filepath().asString()));
827 MIL << todelete.alias() << " sucessfully deleted." << endl;
832 // there are more repos in the same file
833 // write them back except the deleted one.
835 //std::ofstream file(tmp.path().c_str());
837 // assert the directory exists
838 filesystem::assert_dir(todelete.filepath().dirname());
840 std::ofstream file(todelete.filepath().c_str());
842 //ZYPP_THROW (Exception( "Can't open " + tmp.path().asString() ) );
843 ZYPP_THROW (Exception( "Can't open " + todelete.filepath().asString() ) );
845 for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
846 fit != filerepos.end();
849 if ( (*fit).alias() != todelete.alias() )
850 (*fit).dumpRepoOn(file);
853 cache::CacheStore store(_pimpl->options.repoCachePath);
855 if ( store.isCached( todelete.alias() ) ) {
856 MIL << "repository was cached. cleaning cache" << endl;
857 store.cleanRepository(todelete.alias());
860 MIL << todelete.alias() << " sucessfully deleted." << endl;
863 } // else filepath is empty
866 // should not be reached on a sucess workflow
867 ZYPP_THROW(RepoNotFoundException(info));
870 ////////////////////////////////////////////////////////////////////////////
872 void RepoManager::modifyRepository( const std::string &alias,
873 const RepoInfo & newinfo,
874 const ProgressData::ReceiverFnc & progressrcv )
876 RepoInfo toedit = getRepositoryInfo(alias);
878 if (toedit.filepath().empty())
880 ZYPP_THROW(RepoException("Can't figure where the repo is stored"));
884 // figure how many repos are there in the file:
885 std::list<RepoInfo> filerepos = repositories_in_file(toedit.filepath());
887 // there are more repos in the same file
888 // write them back except the deleted one.
890 //std::ofstream file(tmp.path().c_str());
892 // assert the directory exists
893 filesystem::assert_dir(toedit.filepath().dirname());
895 std::ofstream file(toedit.filepath().c_str());
897 //ZYPP_THROW (Exception( "Can't open " + tmp.path().asString() ) );
898 ZYPP_THROW (Exception( "Can't open " + toedit.filepath().asString() ) );
900 for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
901 fit != filerepos.end();
904 // if the alias is different, dump the original
905 // if it is the same, dump the provided one
906 if ( (*fit).alias() != toedit.alias() )
907 (*fit).dumpRepoOn(file);
909 newinfo.dumpRepoOn(file);
914 ////////////////////////////////////////////////////////////////////////////
916 RepoInfo RepoManager::getRepositoryInfo( const std::string &alias,
917 const ProgressData::ReceiverFnc & progressrcv )
919 std::list<RepoInfo> repos = knownRepositories();
920 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
924 if ( (*it).alias() == alias )
928 info.setAlias(info.alias());
929 ZYPP_THROW(RepoNotFoundException(info));
932 ////////////////////////////////////////////////////////////////////////////
934 RepoInfo RepoManager::getRepositoryInfo( const Url & url,
935 const url::ViewOption & urlview,
936 const ProgressData::ReceiverFnc & progressrcv )
938 std::list<RepoInfo> repos = knownRepositories();
939 for ( std::list<RepoInfo>::const_iterator it = repos.begin();
943 for(RepoInfo::urls_const_iterator urlit = (*it).baseUrlsBegin();
944 urlit != (*it).baseUrlsEnd();
947 if ((*urlit).asString(urlview) == url.asString(urlview))
952 info.setAlias(info.alias());
953 info.setBaseUrl(url);
954 ZYPP_THROW(RepoNotFoundException(info));
957 ////////////////////////////////////////////////////////////////////////////
959 std::ostream & operator<<( std::ostream & str, const RepoManager & obj )
961 return str << *obj._pimpl;
964 /////////////////////////////////////////////////////////////////
966 ///////////////////////////////////////////////////////////////////