summaryrefslogtreecommitdiff
path: root/apt-private
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-02-13 12:54:07 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2024-02-13 15:08:57 +0100
commit1a0882558da05eaf471c2b4049ae27305e7c70ec (patch)
treefe7dfd0ab95faafa015de14cd7e3de948e53f853 /apt-private
parent82f4cfc971ef6a2e56b34227d9e0b1a594dc2265 (diff)
Show a separate list of upgrades deferred due to phasing
This introduces a new line: The following upgrades have been deferred due to phasing This is any kept back package that is also phasing. This may not be 100% accurate as we have kept it back due to other reasons in an install command, for example, but we don't track for which packages we applied phasing in reality. If additional packages are kept back that are not phasing, show a a notice "N: Some packages may have been kept back due to phasing." LP: #1988819
Diffstat (limited to 'apt-private')
-rw-r--r--apt-private/private-install.cc17
-rw-r--r--apt-private/private-output.cc10
-rw-r--r--apt-private/private-output.h1
3 files changed, 27 insertions, 1 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index 2f254ca27..dbcba8fd1 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -210,11 +210,26 @@ bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, boo
return false;
}
+ APT::PackageVector PhasingPackages;
+ APT::PackageVector NotPhasingHeldBackPackages;
+ for (auto const &Pkg : HeldBackPackages)
+ {
+ if (Cache->PhasingApplied(Pkg))
+ PhasingPackages.push_back(Pkg);
+ else
+ NotPhasingHeldBackPackages.push_back(Pkg);
+ }
+
// Show all the various warning indicators
ShowDel(c1out,Cache);
ShowNew(c1out,Cache);
if (ShwKept == true)
- ShowKept(c1out,Cache, HeldBackPackages);
+ {
+ ShowPhasing(c1out, Cache, PhasingPackages);
+ ShowKept(c1out, Cache, NotPhasingHeldBackPackages);
+ if (not PhasingPackages.empty() && not NotPhasingHeldBackPackages.empty())
+ _error->Notice("Some packages may have been kept back due to phasing.");
+ }
bool const Hold = not ShowHold(c1out,Cache);
if (_config->FindB("APT::Get::Show-Upgraded",true) == true)
ShowUpgraded(c1out,Cache);
diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc
index 03fbe47e1..c73d5229b 100644
--- a/apt-private/private-output.cc
+++ b/apt-private/private-output.cc
@@ -490,6 +490,16 @@ void ShowDel(ostream &out,CacheFile &Cache)
CandidateVersion(&Cache));
}
/*}}}*/
+// ShowPhasing - Show packages kept due to phasing /*{{{*/
+void ShowPhasing(ostream &out, CacheFile &Cache, APT::PackageVector const &HeldBackPackages)
+{
+ SortedPackageUniverse Universe(Cache);
+ ShowList(out, _("The following upgrades have been deferred due to phasing:"), HeldBackPackages,
+ &AlwaysTrue,
+ &PrettyFullName,
+ CurrentToCandidateVersion(&Cache));
+}
+ /*}}}*/
// ShowKept - Show kept packages /*{{{*/
void ShowKept(ostream &out,CacheFile &Cache, APT::PackageVector const &HeldBackPackages)
{
diff --git a/apt-private/private-output.h b/apt-private/private-output.h
index d6f25e1ec..c3e73d592 100644
--- a/apt-private/private-output.h
+++ b/apt-private/private-output.h
@@ -93,6 +93,7 @@ template<class Container, class PredicateC, class DisplayP, class DisplayV> bool
void ShowNew(std::ostream &out,CacheFile &Cache);
void ShowDel(std::ostream &out,CacheFile &Cache);
void ShowKept(std::ostream &out,CacheFile &Cache, APT::PackageVector const &HeldBackPackages);
+void ShowPhasing(std::ostream &out, CacheFile &Cache, APT::PackageVector const &HeldBackPackages);
void ShowUpgraded(std::ostream &out,CacheFile &Cache);
bool ShowDowngraded(std::ostream &out,CacheFile &Cache);
bool ShowHold(std::ostream &out,CacheFile &Cache);