summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2023-07-03 11:13:00 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2023-07-05 10:57:26 +0200
commit89dd48bdea93849246fc33b447d6d7ad52bb1c4b (patch)
tree2705a34ef10a350a436318b787d5c26c265479fc /test
parent9ef79abd2f7942c4c5d789fd29b83f493626e440 (diff)
dist-upgrade: Revert phased updates using keeps only
In the bug, mutter was kept back due to phasing and the new gnome-shell depended on that, and was therefore kept back as well, however, gnome-shell-common was not broken, and apt decided to continue upgrading it by removing gnome-shell and the ubuntu desktop meta packages. This is potentially a regression of LP#1990586 where we added keep back calls to the start of the dist-upgrade to ensure that we do not mark stuff for upgrade in the first place that depends on phasing updates, however it was generally allowed by the resolver to also do those removals. To fix this, we need to resolve the update normally and then use ResolveByKeepInternal to keep back any changes broken by held back packages. However, doing so breaks test-bug-591882-conkeror because ResolveByKeep keeps back packages for broken Recommends as well, which is not something we generally want to do in a dist-upgrade after we already decided to upgrade it. To circumvent that issue, extend the pkgProblemResolver to allow a package to be policy broken, and mark all packages that already were already going to be policy broken to be allowed to be that, such that we don't try to undo their installs. LP: #2025462
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-ubuntu-bug-2025462-phased-dist-upgrade50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/integration/test-ubuntu-bug-2025462-phased-dist-upgrade b/test/integration/test-ubuntu-bug-2025462-phased-dist-upgrade
new file mode 100755
index 000000000..eecadcda3
--- /dev/null
+++ b/test/integration/test-ubuntu-bug-2025462-phased-dist-upgrade
@@ -0,0 +1,50 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+echo 'Debug::Phasing "1";' > rootdir/etc/apt/apt.conf.d/debug-phasing
+configarchitecture 'i386'
+
+insertinstalledpackage 'gnome-shell' 'all' '1' 'Depends: mutter (>= 1), gnome-shell-common (= 1)'
+insertinstalledpackage 'gnome-shell-common' 'all' '1'
+insertinstalledpackage 'mutter' 'all' '1'
+
+insertpackage 'unstable-updates' 'gnome-shell-common' 'all' '2' 'Phased-Update-Percentage: 100'
+insertpackage 'unstable-updates' 'gnome-shell' 'all' '2' 'Phased-Update-Percentage: 100
+Depends: mutter (>= 2), gnome-shell-common (= 2)'
+insertpackage 'unstable-updates' 'mutter' 'all' '2' 'Phased-Update-Percentage: 0'
+
+setupaptarchive
+
+# This is the broken test case:
+#
+# The following packages will be REMOVED:
+# gnome-shell
+# The following packages have been kept back:
+# mutter
+# The following packages will be upgraded:
+# gnome-shell-common
+# 1 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages have been kept back:
+ gnome-shell gnome-shell-common mutter
+0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded." aptget dist-upgrade -s -q
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be upgraded:
+ gnome-shell gnome-shell-common mutter
+3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst mutter [1] (2 unstable-updates [all])
+Inst gnome-shell [1] (2 unstable-updates [all]) []
+Inst gnome-shell-common [1] (2 unstable-updates [all])
+Conf mutter (2 unstable-updates [all])
+Conf gnome-shell (2 unstable-updates [all])
+Conf gnome-shell-common (2 unstable-updates [all])" aptget dist-upgrade -s -q -o APT::Get::Always-Include-Phased-Updates=1