Author: jkupec Date: Mon Apr 28 15:35:22 2008 New Revision: 9862 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9862&view=rev Log: - fixed update (bnc #381908) - fixed dist-upgrade (don't call solver after doUpgrade()) Modified: trunk/zypper/src/zypper-misc.cc trunk/zypper/src/zypper.cc trunk/zypper/src/zypper.h Modified: trunk/zypper/src/zypper-misc.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-misc.cc?rev=9862&r1=9861&r2=9862&view=diff ============================================================================== --- trunk/zypper/src/zypper-misc.cc (original) +++ trunk/zypper/src/zypper-misc.cc Mon Apr 28 15:35:22 2008 @@ -1888,6 +1888,7 @@ } // may be useful as a functor +/* static bool mark_item_install (const PoolItem & pi) { @@ -1896,7 +1897,7 @@ ERR << "Marking " << pi << "for installation failed" << endl; return result; } - +*/ // ---------------------------------------------------------------------------- // best-effort update @@ -1977,7 +1978,7 @@ } } - +/* static bool mark_patch_update(const PoolItem & pi, bool skip_interactive, bool ignore_affects_pm) { @@ -2007,9 +2008,9 @@ return false; } - +*/ // ---------------------------------------------------------------------------- - +/* static void mark_patch_updates( Zypper & zypper, bool skip_interactive ) { @@ -2063,24 +2064,21 @@ } } } - +*/ // ---------------------------------------------------------------------------- void mark_updates(Zypper & zypper, const ResKindSet & kinds, bool skip_interactive, bool best_effort ) { ResKindSet localkinds = kinds; - ResKindSet::iterator it; - it = localkinds.find(ResKind::patch); - if(it != localkinds.end()) // patches wanted - { - mark_patch_updates(zypper, skip_interactive); - localkinds.erase(it); - } - if (zypper.arguments().empty() || zypper.globalOpts().is_rug_compatible) { - God->resolver()->doUpdate(); //! \todo what about patch updates? + // this will do a complete pppp update as far as possible + God->resolver()->doUpdate(); + // no need to call Resolver::resolvePool() afterwards + zypper.runtimeData().solve_before_commit = false; + + //! \todo update specified types only. Or should we drop this option? /* Candidates candidates; @@ -2160,23 +2158,36 @@ bool commit_done = false; do { - MIL << "solving..." << endl; - - while (true) + if (zypper.runtimeData().solve_before_commit) // doUpdate was called, no need for solving { - bool success; - if (zypper.command() == ZypperCommand::VERIFY) - success = verify(zypper); - else - success = resolve(zypper); - if (success) - break; + MIL << "solving..." << endl; - success = show_problems(zypper); - if (! success) { - // TODO cancel transaction? - zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); // #242736 - return; + while (true) + { + bool success; + if (zypper.command() == ZypperCommand::VERIFY) + success = verify(zypper); + else if (zypper.command() == ZypperCommand::DIST_UPGRADE) + { + zypp::UpgradeStatistics opt_stats; + //! \todo set success to doUpgrade return value if there are problems + success = false; + God->resolver()->doUpgrade(opt_stats); + //! \todo remove this hack once the doUpgrade returns bool + if (God->resolver()->problems().empty()) + break; + } + else + success = resolve(zypper); + if (success) + break; + + success = show_problems(zypper); + if (! success) { + // TODO cancel transaction? + zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP); // #242736 + return; + } } } Modified: trunk/zypper/src/zypper.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.cc?rev=9862&r1=9861&r2=9862&view=diff ============================================================================== --- trunk/zypper/src/zypper.cc (original) +++ trunk/zypper/src/zypper.cc Mon Apr 28 15:35:22 2008 @@ -2898,12 +2898,10 @@ if (exitCode() != ZYPPER_EXIT_OK) return; load_resolvables(*this); - zypp::UpgradeStatistics opt_stats; - God->resolver()->doUpgrade(opt_stats); solve_and_commit(*this); - break; + break; } // -----------------------------( info )------------------------------------ Modified: trunk/zypper/src/zypper.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.h?rev=9862&r1=9861&r2=9862&view=diff ============================================================================== --- trunk/zypper/src/zypper.h (original) +++ trunk/zypper/src/zypper.h Mon Apr 28 15:35:22 2008 @@ -85,6 +85,7 @@ : patches_count(0), security_patches_count(0) , show_media_progress_hack(false) , force_resolution(zypp::indeterminate) + , solve_before_commit(true) {} std::listzypp::RepoInfo repos; @@ -110,6 +111,12 @@ /** Used to override the command line option */ zypp::TriBool force_resolution; + + /** + * Set to <tt>false</tt> to avoid calling of the solver + * in \ref solve_and_commit(). Needed after Resolver::doUpdate() + */ + bool solve_before_commit; }; class Zypper : private zypp::base::NonCopyable -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org