Skip to content

Commit

Permalink
policy: Apply phasing to uninstalled packages too
Browse files Browse the repository at this point in the history
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
  • Loading branch information
julian-klode committed May 17, 2021
1 parent 1be9dc6 commit 81eb944
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apt-pkg/policy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions test/integration/test-phased-updates
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 81eb944

Please sign in to comment.