From 7724d170751b3dc1717ba7a08881437cf7151996 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 19 May 2025 14:17:23 +0200 Subject: Introduce apt why, apt why-not These are implemented somewhat differently from aptitudes why and why-not commands: They produce the actual solver trace for why a particular decision has been taken. For the why-not case, we need to explicitly discover our specified package, as if nothing else depends on it in our graph, it would otherwise always be undiscovered and conflicts not detected (see e.g. level-3 in the test). --- test/integration/test-apt-cli-why | 71 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 test/integration/test-apt-cli-why (limited to 'test/integration/test-apt-cli-why') diff --git a/test/integration/test-apt-cli-why b/test/integration/test-apt-cli-why new file mode 100755 index 000000000..8a4c94b30 --- /dev/null +++ b/test/integration/test-apt-cli-why @@ -0,0 +1,71 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'root' 'all' '1' 'Depends: level-1' +insertinstalledpackage 'level-1' 'all' '1' 'Depends: level-2' +insertinstalledpackage 'level-2' 'all' '1' 'Depends: level-2' +insertpackage 'unstable' 'other-level-2' 'all' '1' 'Conflicts: level-2 +Provides: level-2' +insertpackage 'unstable' 'almost-level-2' 'all' '1' 'Conflicts: level-2' +insertpackage 'unstable' 'level-3' 'all' '1' 'Conflicts: level-3' +setupaptarchive + +testsuccess aptmark auto level-1 level-2 + + +testsuccessequal "level-2:amd64=1 is selected for install because: +1. root:amd64 is selected for install +2. root:amd64 Depends level-1 +3. level-1:amd64 Depends level-2 + [selected level-1:amd64] +For context, additional choices that could not be installed: +* In level-1:amd64 Depends level-2: + - other-level-2:amd64=1 -> | other-level-2:amd64 + but none of the choices are installable: + - other-level-2:amd64 is not selected for install because: + 1-3. level-2:amd64=1 is selected for install as above + 4. other-level-2:amd64 Conflicts level-2 + For context, additional choices that could not be installed: + * In level-1:amd64 Depends level-2: + - other-level-2:amd64=1 is not selected for install as above" apt why level-2 + + +testsuccessequal "other-level-2:amd64 is not actually marked for install" apt why other-level-2 +testsuccessequal "other-level-2:amd64 is not selected for install because: +1. root:amd64 is selected for install +2. root:amd64 Depends level-1 +3. level-1:amd64 Depends level-2 + [selected level-2:amd64=1 for install] +4. other-level-2:amd64 Conflicts level-2 +For context, additional choices that could not be installed: +* In level-1:amd64 Depends level-2: + - other-level-2:amd64=1 -> | other-level-2:amd64 + but none of the choices are installable: + - other-level-2:amd64 is not selected for install as above" apt why-not other-level-2 + +testsuccessequal "almost-level-2:amd64 is not actually marked for install" apt why almost-level-2 +testsuccessequal "almost-level-2:amd64 is not selected for install because: +1. root:amd64 is selected for install +2. root:amd64 Depends level-1 +3. level-1:amd64 Depends level-2 + [selected level-2:amd64=1 for install] +4. almost-level-2:amd64 Conflicts level-2 + [selected level-2:amd64=1] +For context, additional choices that could not be installed: +* In level-1:amd64 Depends level-2: + - other-level-2:amd64=1 -> | other-level-2:amd64 + but none of the choices are installable: + - other-level-2:amd64 is not selected for install because: + 1-3. level-2:amd64=1 is selected for install as above + 4. other-level-2:amd64 Conflicts level-2 + For context, additional choices that could not be installed: + * In level-1:amd64 Depends level-2: + - other-level-2:amd64=1 is not selected for install as above" apt why-not almost-level-2 + + +testsuccessequal "level-3:amd64 is undecided" apt why level-3 -- cgit v1.2.3-70-g09d2