[yast-commit] r40634 - in /trunk/pkg-bindings: package/yast2-pkg-bindings.changes src/Callbacks.cc
Author: lslezak Date: Thu Aug 30 20:01:50 2007 New Revision: 40634 URL: http://svn.opensuse.org/viewcvs/yast?rev=40634&view=rev Log: - preliminary fix for source redirection (compile fix only) (#294481) Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/Callbacks.cc Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bindings.changes?rev=40634&r1=40633&r2=40634&view=diff ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Thu Aug 30 20:01:50 2007 @@ -3,6 +3,8 @@ - don't log debug messages from zypp if debug logging is turned off (#306458) +- preliminary fix for source redirection (compile fix only) + (#294481) ------------------------------------------------------------------- Wed Aug 29 09:36:00 CEST 2007 - lslezak@suse.cz Modified: trunk/pkg-bindings/src/Callbacks.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Callbacks.cc?rev=40634&r1=40633&r2=40634&view=diff ============================================================================== --- trunk/pkg-bindings/src/Callbacks.cc (original) +++ trunk/pkg-bindings/src/Callbacks.cc Thu Aug 30 20:01:50 2007 @@ -43,7 +43,7 @@ // remember redirected URLs // FIXME huh? -std::map<std::vector<zypp::RepoInfo>::size_type, std::map<unsigned, std::string> > redirect_map; +std::map<zypp::Url, std::map<unsigned, std::string> > redirect_map; /////////////////////////////////////////////////////////////////// namespace ZyppRecipients { @@ -993,7 +993,7 @@ { MediaChangeReceive( RecipientCtl & construct_r ) : Recipient( construct_r ) {} - virtual Action requestMedia(zypp::Repository source, unsigned mediumNr, zypp::media::MediaChangeReport::Error error, const std::string &description) + virtual Action requestMedia(zypp::Url &url, unsigned int mediumNr, zypp::media::MediaChangeReport::Error error, const std::string &description) { if ( _silent_probing == MEDIA_CHANGE_DISABLE ) return zypp::media::MediaChangeReport::ABORT; @@ -1009,7 +1009,7 @@ callback.addStr( description ); // search URL in the redirection map - std::map<std::vector<zypp::RepoInfo>::size_type, std::map<unsigned, std::string> >::const_iterator source_it = redirect_map.find(source.numericId()); + std::map<zypp::Url, std::map<unsigned, std::string> >::const_iterator source_it = redirect_map.find(url); bool found = false; std::string report_url; @@ -1025,13 +1025,7 @@ // report the redirected URL report_url = (*media_it).second; - std::string original_url; - if (source.info().baseUrlsBegin() != source.info().baseUrlsEnd()) - { - original_url = source.info().baseUrlsBegin()->asString(); - } - - y2milestone("Using redirected URL %s, original URL: %s", report_url.c_str(), original_url.c_str()); + y2milestone("Using redirected URL %s, original URL: %s", report_url.c_str(), url.asString().c_str()); } } @@ -1039,17 +1033,14 @@ { // the source has not been redirected // use URL of the source - if (source.info().baseUrlsBegin() != source.info().baseUrlsEnd()) - { - report_url = source.info().baseUrlsBegin()->asString(); - } + report_url = url.asString(); } // current URL callback.addStr( report_url ); // current product name (use the alias, see #214886) - callback.addStr( source.info().alias() ); + callback.addStr( std::string() /*FIXME*/ ); // current medium, -1 means enable [Ignore] callback.addInt( 0 ); @@ -1086,15 +1077,16 @@ // otherwise change media URL // try/catch to catch invalid URLs try { + // FIXME set the new URL zypp::Url ret_url (ret); #warning FIXME: MediaChange callback - redirection is missing! y2internal("Source redirection is not yet implemented in yast2-pkg-bindings"); //source.redirect( mediumNr, ret_url ); // remember the redirection - std::map<unsigned, std::string> source_redir = redirect_map[source.numericId()]; + std::map<unsigned, std::string> source_redir = redirect_map[url]; source_redir[mediumNr] = ret; - redirect_map[source.numericId()] = source_redir; + redirect_map[url] = source_redir; y2milestone("Source redirected to %s", ret.c_str()); @@ -1108,7 +1100,7 @@ } // return default value from the parent class - return zypp::media::MediaChangeReport::requestMedia(source, mediumNr, error, description); + return zypp::media::MediaChangeReport::requestMedia(url, mediumNr, error, description); } }; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org