Author: jreidinger Date: Tue Apr 8 13:17:18 2008 New Revision: 9454 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9454&view=rev Log: give better hint if zypper cannot download file from out of date repository. (bnc #377137). Modified: trunk/zypper/src/zypper-misc.cc Modified: trunk/zypper/src/zypper-misc.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-misc.cc?rev=9454&r1=9453&r2=9454&view=diff ============================================================================== --- trunk/zypper/src/zypper-misc.cc (original) +++ trunk/zypper/src/zypper-misc.cc Tue Apr 8 13:17:18 2008 @@ -1820,11 +1820,37 @@ zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); return; } - catch ( const zypp::repo::RepoException & e ) { + catch ( zypp::repo::RepoException & e ) { ZYPP_CAUGHT(e); + + RepoManager manager(zypper.globalOpts().rm_options ); + + bool refresh_needed = false; + for(RepoInfo::urls_const_iterator it = e.info().baseUrlsBegin(); + it != e.info().baseUrlsEnd(); ++it) + { + RepoManager::RefreshCheckStatus stat = manager. + checkIfToRefreshMetadata(e.info(), *it, + RepoManager::RefreshForced ); + if ( stat == RepoManager::REFRESH_NEEDED ) + { + refresh_needed = true; + break; + } + } + + std::string hint = _("Please see the above error message for a hint."); + if (refresh_needed) + { + hint = boost::str(format( + // translators: the first %s is 'zypper refresh' and the second + // is repo allias + _("Repository '%s' is out of date. Running '%s' might help.")) % + e.info().alias() % "zypper refresh" ); + } zypper.out().error(e, _("Problem downloading the package file from the repository:"), - _("Please see the above error message for a hint.")); + hint); zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); return; } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org