From ff4555c72df967e40590d9e8c6ce83e9df4c46ea Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 25 Apr 2020 11:28:47 +0200 Subject: Explore or-groups for Recommends further than first MarkInstall only looks at the first alternative in an or-group which has a fighting chance of being satisfiable (= the package itself satisfies the dependency, if it is installable itself is not considered). This is "hidden" for Depends by the problem resolver who will try another member of the or-group later, but Recommends are not a problem for it, so for them the alternatives are never further explored. Exploring the or-group in MarkInstall seems like the better choice for both types as that frees the problem resolver to deal with the hard things like package conflicts. --- .../test-explore-or-groups-in-markinstall | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 test/integration/test-explore-or-groups-in-markinstall (limited to 'test') diff --git a/test/integration/test-explore-or-groups-in-markinstall b/test/integration/test-explore-or-groups-in-markinstall new file mode 100755 index 000000000..f5898cfca --- /dev/null +++ b/test/integration/test-explore-or-groups-in-markinstall @@ -0,0 +1,47 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' + +insertpackage 'unstable' 'okay' 'all' '1' +insertpackage 'unstable' 'unneeded' 'all' '1' +insertpackage 'unstable' 'later' 'all' '1' + +insertpackage 'unstable' 'bad-level0' 'all' '1' 'Depends: unneeded, unknown' + +insertfoos() { + insertpackage 'unstable' "foo-${1}-level0" 'all' '1' "${2}: unknown | okay | later" + insertpackage 'unstable' "foo-${1}-level1" 'all' '1' "${2}: bad-level0 | okay | later" +} +insertfoos 'd' 'Depends' +insertfoos 'r' 'Recommends' + +setupaptarchive + +testsuccessheadequal() { + msggroup 'testsuccessheadequal' + local HEADLINES="$1" + local CMP="$2" + shift 2 + testsuccesswithglobalerror 'testsuccess' 'EW' "$@" + cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccessheadequal.output" + testsuccessequal "$CMP" head -n "$HEADLINES" "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccessheadequal.output" + msggroup +} +checkfoos() { + msgmsg 'Install checks with foos dependency type' "$2" + for i in 0 1; do + testsuccessheadequal 7 "Reading package lists... +Building dependency tree... +The following additional packages will be installed: + okay +The following NEW packages will be installed: + foo-${1}-level${i} okay +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded." apt install foo-${1}-level${i} -s + done +} +checkfoos 'd' 'Depends' +checkfoos 'r' 'Recommends' -- cgit v1.2.3