Author: lslezak Date: Mon Sep 3 13:04:14 2007 New Revision: 40689 URL: http://svn.opensuse.org/viewcvs/yast?rev=40689&view=rev Log: - reimplemented media redirection in media change callback (#294481) - 2.15.49 Modified: trunk/pkg-bindings/VERSION trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/Callbacks.cc Modified: trunk/pkg-bindings/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/VERSION?rev=40689&r1=40688&r2=40689&view=diff ============================================================================== --- trunk/pkg-bindings/VERSION (original) +++ trunk/pkg-bindings/VERSION Mon Sep 3 13:04:14 2007 @@ -1 +1 @@ -2.15.48 +2.15.49 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=40689&r1=40688&r2=40689&view=diff ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Mon Sep 3 13:04:14 2007 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Sep 3 13:01:12 CEST 2007 - lslezak@suse.cz + +- reimplemented media redirection in media change callback + (#294481) +- 2.15.49 + +------------------------------------------------------------------- Fri Aug 31 11:28:08 CEST 2007 - lslezak@suse.cz - fixed inverted result of PkgAvailable() and PkgInstalled() Modified: trunk/pkg-bindings/src/Callbacks.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Callbacks.cc?rev=40689&r1=40688&r2=40689&view=diff ============================================================================== --- trunk/pkg-bindings/src/Callbacks.cc (original) +++ trunk/pkg-bindings/src/Callbacks.cc Mon Sep 3 13:04:14 2007 @@ -43,7 +43,11 @@ // remember redirected URLs // FIXME huh? -std::map<zypp::Url, std::map<unsigned, std::string> > redirect_map; + +typedef std::map<unsigned, zypp::Url> MediaMap; +typedef std::map<zypp::Url, MediaMap> RedirectMap; + +RedirectMap redirect_map; /////////////////////////////////////////////////////////////////// namespace ZyppRecipients { @@ -1009,14 +1013,14 @@ callback.addStr( description ); // search URL in the redirection map - std::map<zypp::Url, std::map<unsigned, std::string> >::const_iterator source_it = redirect_map.find(url); + RedirectMap::const_iterator source_it = redirect_map.find(url); bool found = false; - std::string report_url; + zypp::Url report_url; if (source_it != redirect_map.end()) { // search medium in the redirection map - std::map<unsigned, std::string>::const_iterator media_it = (*source_it).second.find(mediumNr); + MediaMap::const_iterator media_it = (*source_it).second.find(mediumNr); if (media_it != (*source_it).second.end()) { @@ -1025,7 +1029,7 @@ // report the redirected URL report_url = (*media_it).second; - y2milestone("Using redirected URL %s, original URL: %s", report_url.c_str(), url.asString().c_str()); + y2milestone("Using redirected URL %s, original URL: %s", report_url.asString().c_str(), url.asString().c_str()); } } @@ -1033,11 +1037,11 @@ { // the source has not been redirected // use URL of the source - report_url = url.asString(); + report_url = url; } // current URL - callback.addStr( report_url ); + callback.addStr( report_url.asString() ); // current product name (use the alias, see #214886) callback.addStr( std::string() /*FIXME*/ ); @@ -1077,15 +1081,12 @@ // 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 ); + // set the new URL + url = zypp::Url(ret); // remember the redirection - std::map<unsigned, std::string> source_redir = redirect_map[url]; - source_redir[mediumNr] = ret; + MediaMap source_redir = redirect_map[url]; + source_redir[mediumNr] = url; redirect_map[url] = source_redir; y2milestone("Source redirected to %s", ret.c_str()); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org