From 2a884c612b10b27f4be2cc6dd689bfe448d9361a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 17 Aug 2014 12:30:21 +0200 Subject: fix progress output for (dist-)upgrade calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, we had a start and a done of the calculation printed by higher-level code, but this got intermixed by progress reporting from an external solver or the output of autoremove codeā€¦ The higherlevel code is now only responsible for instantiating a progress object of its choosing (if it wants progress after all) and the rest will be handled by the upgrade code. Either it is used to show the progress of the external solver or the internal solver will give some hints about its overall progress. The later isn't really a proper progress as it will jump forward after each substep, but that is at least a bit better than before without any progress indication. Fixes also the 'strange' non-display of this progress line in -q=1, while all others are shown, which is reflected by all testcase changes. --- apt-pkg/algorithms.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 608ec7fce..71b5ac2c1 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -640,13 +640,11 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg) // ProblemResolver::Resolve - calls a resolver to fix the situation /*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgProblemResolver::Resolve(bool BrokenFix) +bool pkgProblemResolver::Resolve(bool BrokenFix, OpProgress * const Progress) { std::string const solver = _config->Find("APT::Solver", "internal"); - if (solver != "internal") { - OpTextProgress Prog(*_config); - return EDSP::ResolveExternal(solver.c_str(), Cache, false, false, false, &Prog); - } + if (solver != "internal") + return EDSP::ResolveExternal(solver.c_str(), Cache, false, false, false, Progress); return ResolveInternal(BrokenFix); } /*}}}*/ @@ -1140,13 +1138,11 @@ bool pkgProblemResolver::InstOrNewPolicyBroken(pkgCache::PkgIterator I) /* This is the work horse of the soft upgrade routine. It is very gental in that it does not install or remove any packages. It is assumed that the system was non-broken previously. */ -bool pkgProblemResolver::ResolveByKeep() +bool pkgProblemResolver::ResolveByKeep(OpProgress * const Progress) { std::string const solver = _config->Find("APT::Solver", "internal"); - if (solver != "internal") { - OpTextProgress Prog(*_config); - return EDSP::ResolveExternal(solver.c_str(), Cache, true, false, false, &Prog); - } + if (solver != "internal") + return EDSP::ResolveExternal(solver.c_str(), Cache, true, false, false, Progress); return ResolveByKeepInternal(); } /*}}}*/ -- cgit v1.2.3