From cfefaf6c4a27bbd5bfdad67e482f4b01506f5bd5 Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Thu, 28 Aug 2014 15:04:20 -0700 Subject: The following command otherwise yields many blank lines: apt list -o APT::Cmd::use-format=true -o APT::Cmd::format=\${Package} And even worse when adding "-o APT::Cmd::All-Versions=true". Signed-off-by: Andreas Oberritter --- apt-private/private-list.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index b69002103..f98456576 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -93,7 +93,6 @@ static void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,/*{{{*/ Ver.end() == false; ++Ver) { ListSingleVersion(CacheFile, records, Ver, outs, include_summary); - outs << "\n"; } } /*}}}*/ @@ -149,7 +148,7 @@ bool DoList(CommandLine &Cmd) // FIXME: SORT! and make sorting flexible (alphabetic, by pkg status) // output the sorted map for (K = output_map.begin(); K != output_map.end(); ++K) - std::cout << (*K).second << std::endl; + std::cout << (*K).second; // be nice and tell the user if there is more to see -- cgit v1.2.3 From 6763aaec8ddded31057733f53c63f15e6b949bd9 Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Tue, 2 Sep 2014 16:34:05 +0200 Subject: Avoid yielding blank lines with APT::Cmd::use-format=true --- apt-private/private-list.cc | 3 ++- apt-private/private-output.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index f98456576..b69002103 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -93,6 +93,7 @@ static void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,/*{{{*/ Ver.end() == false; ++Ver) { ListSingleVersion(CacheFile, records, Ver, outs, include_summary); + outs << "\n"; } } /*}}}*/ @@ -148,7 +149,7 @@ bool DoList(CommandLine &Cmd) // FIXME: SORT! and make sorting flexible (alphabetic, by pkg status) // output the sorted map for (K = output_map.begin(); K != output_map.end(); ++K) - std::cout << (*K).second; + std::cout << (*K).second << std::endl; // be nice and tell the user if there is more to see diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 7f8922138..8f1fb886e 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -220,7 +220,7 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ output = SubstVar(output, "${Version}", GetVersion(CacheFile, V)); output = SubstVar(output, "${Description}", GetShortDescription(CacheFile, records, P)); output = SubstVar(output, "${Origin}", GetArchiveSuite(CacheFile, V)); - out << output << std::endl; + out << output; } else { // raring/linux-kernel version [upradable: new-version] // description -- cgit v1.2.3 From d059cc2668f284a7db77a15d1d742326d464e963 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 5 Sep 2014 12:03:28 +0200 Subject: Fix incorrect upgradable listing in "apt list" (thanks to Michael Musenbrock) The "apt list" command was using only the pkgDepCache but not the pkgPolicy to figure out if a package is upgradable. This lead to incorrect display of upgradable package when the user used the policy to pin-down packages. Thanks to Michael Musenbrock for the initial patch. Closes: #753297 --- apt-private/private-cacheset.cc | 5 ++++- apt-private/private-output.cc | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc index e37e7b227..159e1d8f1 100644 --- a/apt-private/private-cacheset.cc +++ b/apt-private/private-cacheset.cc @@ -55,7 +55,10 @@ bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile, } else if (_config->FindB("APT::Cmd::Upgradable") == true) { - if(P.CurrentVer() && state.Upgradable()) + pkgPolicy *policy = CacheFile.GetPolicy(); + if(P.CurrentVer() && + state.Upgradable() && + policy->GetCandidateVer(P) != P.CurrentVer()) { pkgPolicy *policy = CacheFile.GetPolicy(); output_set.insert(policy->GetCandidateVer(P)); diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 8f1fb886e..2120b7a83 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -229,7 +229,10 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ std::string CandidateVerStr = GetCandidateVersion(CacheFile, P); std::string InstalledVerStr = GetInstalledVersion(CacheFile, P); std::string StatusStr; - if(P.CurrentVer() == V && state.Upgradable() && state.CandidateVer != NULL) + if(P.CurrentVer() == V && + state.Upgradable() && + state.CandidateVer != NULL && + policy->GetCandidateVer(P) != P.CurrentVer()) { strprintf(StatusStr, _("[installed,upgradable to: %s]"), CandidateVerStr.c_str()); -- cgit v1.2.3 From 592d06b6f3c2ef2ae47c38005ae3c4e96a0841f2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 5 Sep 2014 12:50:15 +0200 Subject: Ensure we have a Policy in CacheFile.BuildDepCache() This partly reverts d059cc2 and fixes bug #753297 in a more general way by ensuring that CacheFile.BuildDepCache() builds a pkgPolicy if there isn't one already. --- apt-private/private-cacheset.cc | 5 +---- apt-private/private-output.cc | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc index 159e1d8f1..e37e7b227 100644 --- a/apt-private/private-cacheset.cc +++ b/apt-private/private-cacheset.cc @@ -55,10 +55,7 @@ bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile, } else if (_config->FindB("APT::Cmd::Upgradable") == true) { - pkgPolicy *policy = CacheFile.GetPolicy(); - if(P.CurrentVer() && - state.Upgradable() && - policy->GetCandidateVer(P) != P.CurrentVer()) + if(P.CurrentVer() && state.Upgradable()) { pkgPolicy *policy = CacheFile.GetPolicy(); output_set.insert(policy->GetCandidateVer(P)); diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 2120b7a83..522f7682d 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -229,10 +229,7 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ std::string CandidateVerStr = GetCandidateVersion(CacheFile, P); std::string InstalledVerStr = GetInstalledVersion(CacheFile, P); std::string StatusStr; - if(P.CurrentVer() == V && - state.Upgradable() && - state.CandidateVer != NULL && - policy->GetCandidateVer(P) != P.CurrentVer()) + if(P.CurrentVer() == V && state.Upgradable()) { strprintf(StatusStr, _("[installed,upgradable to: %s]"), CandidateVerStr.c_str()); -- cgit v1.2.3