From: Jan Kupec Date: Mon, 29 Sep 2008 10:08:06 +0000 (+0000) Subject: - show in 'lu' what will 'up' actually propose to install (bnc #395480) X-Git-Tag: BASE-SuSE-Code-11-Branch~113 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd9bf791e71e66b697022245d5e46932716b1e9c;p=platform%2Fupstream%2Fzypper.git - show in 'lu' what will 'up' actually propose to install (bnc #395480) - new --all/-a option for 'lu' to show the original raw list of packages for which newer versions exist --- diff --git a/src/Zypper.cc b/src/Zypper.cc index 400ab88..d1c6813 100644 --- a/src/Zypper.cc +++ b/src/Zypper.cc @@ -1400,7 +1400,8 @@ void Zypper::processCommandOptions() // rug compatibility option, we have --repo {"catalog", required_argument, 0, 'c'}, {"type", required_argument, 0, 't'}, - {"best-effort", no_argument, 0, 0 }, + {"all", no_argument, 0, 'a'}, + {"best-effort", no_argument, 0, 0 }, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; @@ -1413,13 +1414,16 @@ void Zypper::processCommandOptions() "List all available updates.\n" "\n" " Command options:\n" - "-t, --type Type of package (%s).\n" - " Default: %s.\n" - "-r, --repo List only updates from the specified repository.\n" - " --best-effort Do a 'best effort' approach to update. Updates\n" - " to a lower than the latest version are\n" - " also acceptable.\n" - ), "package, patch, pattern, product", "patch"); + "-t, --type Type of package (%s).\n" + " Default: %s.\n" + "-r, --repo List only updates from the specified repository.\n" + " --best-effort Do a 'best effort' approach to update. Updates\n" + " to a lower than the latest version are\n" + " also acceptable.\n" + "-a, --all List all packages for which newer versions are\n" + " available, regardless whether they are\n" + " installable or not.\n" + ), "package, patch, pattern, product", "package"); break; } diff --git a/src/update.cc b/src/update.cc index bb3adb3..ff69dcf 100755 --- a/src/update.cc +++ b/src/update.cc @@ -261,10 +261,24 @@ static void find_updates( const ResKind & kind, Candidates & candidates ) { const zypp::ResPool& pool = God->pool(); + DBG << "Looking for update candidates of kind " << kind << endl; + + // package updates + if (kind == ResKind::package && !Zypper::instance()->cOpts().count("all")) + { + God->resolver()->doUpdate(); + ResPool::const_iterator + it = God->pool().begin(), + e = God->pool().end(); + for (; it != e; ++it) + if (it->status().isToBeInstalled()) + candidates.insert(*it); + return; + } + ResPool::byKind_iterator it = pool.byKindBegin (kind), e = pool.byKindEnd (kind); - DBG << "Looking for update candidates of kind " << kind << endl; for (; it != e; ++it) { if (it->status().isUninstalled())