From db78e2f8eafb1009bd47e488fc39d8b420f4c749 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 22 Jul 2025 19:58:14 +0200 Subject: solver3: Sort dependency targets against current alternative Instead of inadvertently sorting dependency targets against the first alternative in an or group, sort them against the current alternative as we should. Otherwise we ended up sorting gnome-shell | notification-daemon With Package: notification-daemon Package: awesome Provides: notification-daemon into gnome-shell | awesome | notification-daemon <-we sorted this part wrongly-> This fixes a minor difference in test-release-candidate-switching in one case, but not the other where the difference was actually caused by the loss of install argument ordering information in the new solver, so just flip the arguments so both solvers produce the same outcome. --- test/integration/test-release-candidate-switching | 18 +++---- .../integration/test-resolver-prefers-real-package | 58 ++++++++++++++++++++++ 2 files changed, 66 insertions(+), 10 deletions(-) create mode 100755 test/integration/test-resolver-prefers-real-package (limited to 'test') diff --git a/test/integration/test-release-candidate-switching b/test/integration/test-release-candidate-switching index 52d3e5a12..18396252f 100755 --- a/test/integration/test-release-candidate-switching +++ b/test/integration/test-release-candidate-switching @@ -117,8 +117,6 @@ Need to get 0 B/252 B of archives. After this operation, 258 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok/experimental --trivial-only -V -phonon_backend_default="phonon-backend-null (4:4.20.0+sid)" -[ "$APT_SOLVER" != "3.0" ] || phonon_backend_default="phonon-backend-xine (4:4.6.0really4.4.2-1+sid)" testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null' @@ -129,14 +127,14 @@ The following additional packages will be installed: amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) libmtp8 (0.3.1+sid) - $phonon_backend_default + phonon-backend-null (4:4.20.0+sid) The following NEW packages will be installed: amarok-common (2.3.2-2+exp) amarok-null (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) libmtp8 (0.3.1+sid) - $phonon_backend_default + phonon-backend-null (4:4.20.0+sid) 0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/252 B of archives. After this operation, 258 kB of additional disk space will be used. @@ -145,16 +143,16 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a # do not select the same version multiple times testfailureequal "Reading package lists... Building dependency tree... -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok' -Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-null' +Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-null' +Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok' The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) libmtp8 (0.3.1+sid) - phonon-backend-xine (4:4.6.0really4.4.2-1+sid) + phonon-backend-null (4:4.20.0+sid) The following NEW packages will be installed: amarok (2.3.2-2+exp) amarok-common (2.3.2-2+exp) @@ -162,11 +160,11 @@ The following NEW packages will be installed: amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) libmtp8 (0.3.1+sid) - phonon-backend-xine (4:4.6.0really4.4.2-1+sid) + phonon-backend-null (4:4.20.0+sid) 0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/294 B of archives. After this operation, 301 kB of additional disk space will be used. -E: Trivial Only specified but this is not a trivial operation." aptget install amarok/experimental amarok-null/experimental --trivial-only -V +E: Trivial Only specified but this is not a trivial operation." aptget install amarok-null/experimental amarok/experimental --trivial-only -V # … but thighten the version if needed # in theory, the second line is wrong, but printing the right version is too much of a hassle diff --git a/test/integration/test-resolver-prefers-real-package b/test/integration/test-resolver-prefers-real-package new file mode 100755 index 000000000..d692eb0be --- /dev/null +++ b/test/integration/test-resolver-prefers-real-package @@ -0,0 +1,58 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' + +insertpackage 'unstable' 'update-notifier' 'all' '1' 'Depends: gnome-shell | notification-daemon' +insertpackage 'unstable' 'gnome-shell' 'all' '1' 'Provides: notification-daemon' + +# The classic solver prefers the last entry in the Packages file, whereas solver3 goes alphabetically +insertpackage 'unstable' 'cinnamon' 'all' '1' 'Provides: notification-daemon' +insertpackage 'unstable' 'awesome' 'all' '1' 'Provides: notification-daemon' +insertpackage 'unstable' 'notification-daemon' 'all' '1' + +setupaptarchive + +# Forbid more and more preferred choices to inspect the ordering the solver chooses + +testsuccessequal "Reading package lists... +Building dependency tree... +The following additional packages will be installed: + gnome-shell +The following NEW packages will be installed: + gnome-shell update-notifier +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst gnome-shell (1 unstable [all]) +Inst update-notifier (1 unstable [all]) +Conf gnome-shell (1 unstable [all]) +Conf update-notifier (1 unstable [all])" apt install update-notifier -s + +testsuccessequal "Reading package lists... +Building dependency tree... +Package 'gnome-shell' is not installed, so not removed +The following additional packages will be installed: + notification-daemon +The following NEW packages will be installed: + notification-daemon update-notifier +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst notification-daemon (1 unstable [all]) +Inst update-notifier (1 unstable [all]) +Conf notification-daemon (1 unstable [all]) +Conf update-notifier (1 unstable [all])" apt install update-notifier gnome-shell- -s + +testsuccessequal "Reading package lists... +Building dependency tree... +Package 'gnome-shell' is not installed, so not removed +Package 'notification-daemon' is not installed, so not removed +The following additional packages will be installed: + awesome +The following NEW packages will be installed: + awesome update-notifier +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst awesome (1 unstable [all]) +Inst update-notifier (1 unstable [all]) +Conf awesome (1 unstable [all]) +Conf update-notifier (1 unstable [all])" apt install update-notifier gnome-shell- notification-daemon- -s -- cgit v1.2.3-70-g09d2