diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2021-05-17 10:25:28 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2021-05-17 10:25:28 +0200 |
commit | 81eb944c76d99f34b57d7c3efd283c3ffb6e4c1f (patch) | |
tree | 84a1eeb4daaa400ec06c46b03b5d51478fd50e7d | |
parent | 1be9dc63719f3a73df5ee7dea3119fab13a55239 (diff) |
policy: Apply phasing to uninstalled packages too
If a package is not installed yet, we do need to apply
phasing as we otherwise get into weird situations when
installing packages:
In the launchpad bug below, ubuntu-release-upgrader-core
was installed, and hence the phasing for the upgrade to it
was applied. However, ubuntu-release-upgrader-gtk was about
to be installed - and hence the phasing did not apply, causing
a version mismatch, because ubuntu-release-upgrader-gtk from
-updates was used, but -core from release pocket. Sigh.
An alternative approach to dealing with this issue could be to
apply phasing to all packages within the same source package,
which would work in most cases. However, there might be unforeseen
side effects and it is of course possible to have = depends between
source packages, such as -signed packages on the unsigned ones for
bootloaders.
This problem does not occur in the update-manager implementation
of phased updates as update-manager only deals with upgrading packages,
but does not install new packages and thus does not see that issue. APT
however, has to apply phasing more broadly, as you can and often do
install additional packages during upgrade, or upgrade packages during
install commands, as both accept package list arguments and have the
same code in the backend.
LP: #1925745
-rw-r--r-- | apt-pkg/policy.cc | 2 | ||||
-rwxr-xr-x | test/integration/test-phased-updates | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index 39879f754..1179f422d 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -310,7 +310,7 @@ static inline bool ExcludePhased(std::string machineID, pkgCache::VerIterator co } APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver, bool ConsiderFiles) { - if (Ver.ParentPkg()->CurrentVer && Ver.PhasedUpdatePercentage() != 100) + if (Ver.PhasedUpdatePercentage() != 100) { if (ExcludePhased(d->machineID, Ver)) return 1; diff --git a/test/integration/test-phased-updates b/test/integration/test-phased-updates index 50f151f79..c06d6f5a1 100755 --- a/test/integration/test-phased-updates +++ b/test/integration/test-phased-updates @@ -59,7 +59,7 @@ phased3: 500 file:${TMPWORKINGDIRECTORY}/aptarchive unstable/main all Packages 50 500 (phased 50%) 500 file:${TMPWORKINGDIRECTORY}/aptarchive unstable/main all Packages - 10 500 (phased 10%) + 10 1 (phased 10%) 500 file:${TMPWORKINGDIRECTORY}/aptarchive unstable/main all Packages" aptcache policy phased1 phased2 phased3 msgmsg "Test for always-include-phased-updates" @@ -132,9 +132,9 @@ phased3: Version table: 100 500 500 file:${TMPWORKINGDIRECTORY}/aptarchive unstable/main all Packages - 50 500 (phased 50%) + 50 1 (phased 50%) 500 file:${TMPWORKINGDIRECTORY}/aptarchive unstable/main all Packages - 10 500 (phased 10%) + 10 1 (phased 10%) 500 file:${TMPWORKINGDIRECTORY}/aptarchive unstable/main all Packages" aptcache policy phased1 phased2 phased3 -o $never=true done |