From 30fa50e8d593556553147478a2d5ea7a550f9e16 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 8 May 2020 12:38:02 +0200 Subject: Allow aptitude to MarkInstall broken packages via FromUser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit apt marks packages coming from the commandline among others as protected to ensure the various resolver parts do not fiddle with the state of these packages. aptitude (and potentially others) do not so the state is modified (to a Keep which for uninstalled means it is not going to be installed) due to being uninstallable before the call fails – basically reverting at least some state changes the call made before it realized it has to fail, which is usually a good idea, except if users expect you to not do it. They do set the FromUser option though which has beside controlling autobit also gained the notion of "the user is always right" over time and can be used for this one here as well preventing the state revert. References: 0de399391372450d0162b5a09bfca554b2d27c3d Reported-By: Jessica Clarke on IRC --- .../test-explore-or-groups-in-markinstall | 54 ++++++++++++++++++++-- 1 file changed, 50 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/integration/test-explore-or-groups-in-markinstall b/test/integration/test-explore-or-groups-in-markinstall index 5669e47b3..763852fa5 100755 --- a/test/integration/test-explore-or-groups-in-markinstall +++ b/test/integration/test-explore-or-groups-in-markinstall @@ -41,16 +41,24 @@ insertfoos 'r' 'Recommends' setupaptarchive -testsuccessheadequal() { - msggroup 'testsuccessheadequal' +_testsuccessheadtailequal() { + local TYPE="$1" + shift + msggroup "testsuccess${TYPE}equal" 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" + cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess${TYPE}equal.output" + testsuccessequal "$CMP" "${TYPE}" -n "$HEADLINES" "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess${TYPE}equal.output" msggroup } +testsuccessheadequal() { + _testsuccessheadtailequal 'head' "$@" +} +testsuccesstailequal() { + _testsuccessheadtailequal 'tail' "$@" +} checkfoos() { msgmsg 'Install checks with foos dependency type' "$2" for level in 0 1 2; do @@ -82,3 +90,41 @@ The following NEW packages will be installed: } checkfoos 'd' 'Depends' checkfoos 'r' 'Recommends' + +TEST_WITH_APTITUDE=false +msgtest 'Check if aptitude is available for additional tests' +if dpkg-checkbuilddeps -d 'aptitude' /dev/null >/dev/null 2>&1; then + TEST_WITH_APTITUDE=true + # we don't document aptitude config options + sed -i -e '/^#x-apt-configure-index/ d' "$(getaptconfig)" + msgpass +else + msgskip 'not installed' +fi + +if $TEST_WITH_APTITUDE; then + OKAYAPTITUDE='0 packages upgraded, 2 newly installed, 0 to remove and 3 not upgraded. +Need to get 0 B of archives. After unpacking 86.0 kB will be used. +Would download/install/remove packages.' + testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-d-level2 -sy + testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-r-level2 -sy + testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-d-conflict -sy + testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-r-conflict -sy +fi + +testfailure apt install bad-upgrade-level1 -s +testfailure apt install bad-conflict-level2 -s + +if $TEST_WITH_APTITUDE; then + testsuccesstailequal 6 'The following packages have been kept back: + bad-upgrade-level1 +No packages will be installed, upgraded, or removed. +0 packages upgraded, 0 newly installed, 0 to remove and 2 not upgraded. +Need to get 0 B of archives. After unpacking 0 B will be used. +Would download/install/remove packages.' aptitude install bad-upgrade-level1 -sy + # aptitude does not show the kept back message in this case… + testsuccesstailequal 4 'No packages will be installed, upgraded, or removed. +0 packages upgraded, 0 newly installed, 0 to remove and 3 not upgraded. +Need to get 0 B of archives. After unpacking 0 B will be used. +Would download/install/remove packages.' aptitude install bad-conflict-level2 -sy +fi -- cgit v1.2.3