From 3cbeed985254de7e8d186ebebb69a659727eaeb0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 3 Aug 2015 07:00:33 +0200 Subject: mark again deps of pkgs in APT::Never-MarkAuto-Sections as manual MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In 50ef3344c3afaaf9943142906b2f976a0337d264 (and similar for other branches), while 'fixing' the edgecase of a package being in multiple sections (e.g. moved from libs to oldlibs in newer releases) I accidently broke the feature itself completely by operating on the package itself and no longer on its dependencies… The behaviour isn't ideal in multiple ways, which we are hopefully able to fix with new ideas as mentioned in the buglog, but until then the functionality of this "hack" should be restored. Reported-By: Raphaël Hertzog Tested-By: Adam Conrad Closes: 793360 LP: 1479207 Thanks: Raphaël Hertzog and Adam Conrad for detailed reports and initial patches --- test/integration/test-apt-never-markauto-sections | 106 ++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100755 test/integration/test-apt-never-markauto-sections (limited to 'test/integration/test-apt-never-markauto-sections') diff --git a/test/integration/test-apt-never-markauto-sections b/test/integration/test-apt-never-markauto-sections new file mode 100755 index 000000000..6c88c69fa --- /dev/null +++ b/test/integration/test-apt-never-markauto-sections @@ -0,0 +1,106 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +aptconfig dump --no-empty --format '%v%n' APT::Never-MarkAuto-Sections > nevermarkauto.sections +testsuccess grep '^metapackages$' nevermarkauto.sections + +# this is a very crude regression test, not a "this is how it should be" test: +# In theory mydesktop-core and texteditor should be marked as manual, but +# texteditor is installed as a dependency of bad-texteditor, not of +# mydesktop-core and mydesktop-core is removed while bad-texteditor is +# installed losing the manual bit as the problem resolver will later decide to +# drop bad-texteditor and re-instate mydesktop-core which is considered an +# auto-install at that point (in theory the never-auto handling should be +# copied to this place – as to the many other places dependencies are resolved +# 'by hand' instead of via MarkInstall AutoInst… +# +# Both could be fixed if apt would figure out early that installing +# bad-texteditor is a bad idea and eventually it should (as mydesktop-core is +# a direct descendant of mydesktop which was a user-request mydesktop-core should +# be as protected from removal as mydesktop is), but this is hard in the general case +# as with more or-groups and provides you can produce 'legal' examples for this. + +buildsimplenativepackage 'mydesktop' 'all' '1' 'unstable' 'Depends: mydesktop-core, foreignpkg +Recommends: notavailable' '' 'metapackages' +buildsimplenativepackage 'mydesktop-core' 'amd64' '1' 'unstable' 'Depends: bad-texteditor | texteditor, browser (>= 42), nosection, foreignpkg +Recommends: notavailable +Multi-Arch: foreign' '' 'metapackages' +buildsimplenativepackage 'browser' 'amd64' '41' 'stable' +buildsimplenativepackage 'browser' 'amd64' '42' 'unstable' +buildsimplenativepackage 'texteditor' 'amd64' '1' 'stable' +buildsimplenativepackage 'bad-texteditor' 'amd64' '1' 'stable' 'Depends: texteditor +Conflicts: mydesktop-core' +buildsimplenativepackage 'nosection' 'amd64' '1' 'stable' '' '' '' +buildsimplenativepackage 'foreignpkg' 'i386' '1' 'stable' 'Multi-Arch: foreign' +setupaptarchive + +testsuccess aptcache show nosection +testfailure grep 'Section' rootdir/tmp/testsuccess.output +testequal 'dpkg' aptmark showmanual + +testsuccess aptget install mydesktop -y -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 + +testequal 'browser +dpkg +foreignpkg:i386 +mydesktop +nosection' aptmark showmanual +testmarkedauto 'mydesktop-core' 'texteditor' + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + mydesktop mydesktop-core texteditor +0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. +Remv mydesktop [1] +Remv mydesktop-core [1] +Remv texteditor [1]' aptget autoremove mydesktop -s + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + mydesktop mydesktop-core texteditor +0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. +Remv mydesktop [1] +Remv mydesktop-core [1] +Remv texteditor [1]' aptget autoremove texteditor -s +testsuccess aptget autoremove texteditor -y + +testdpkgnotinstalled mydesktop mydesktop-core texteditor +testdpkginstalled browser + +testequal 'browser +dpkg +foreignpkg:i386 +nosection' aptmark showmanual +testmarkedauto + +# test that installed/upgraded auto-pkgs are not set to manual + +testsuccess aptget install browser=41 -y --force-yes + +testequal 'browser +dpkg +foreignpkg:i386 +nosection' aptmark showmanual +testmarkedauto +testsuccess aptmark auto browser +testmarkedauto 'browser' +testsuccess aptmark auto nosection +testmarkedauto 'browser' 'nosection' +testequal 'dpkg +foreignpkg:i386' aptmark showmanual + +testsuccess aptget install mydesktop -y + +testequal 'dpkg +foreignpkg:i386 +mydesktop' aptmark showmanual +testmarkedauto 'browser' 'nosection' 'mydesktop-core' 'texteditor' -- cgit v1.2.3 From 7c2cc4a7bc999c8e07fba607354bfaa3b09118f9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 10 Aug 2015 14:44:14 +0200 Subject: move APT::Never-MarkAuto-Sections handling to MarkDelete Having the handling in MarkInstall means that it just effects installation of the metapackage, but if the dependencies change the new dependencies aren't protected (and the old dependencies are still protected for no 'reason'). Having it in MarkDelete means that if a metapackage is sheduled for removal all its currently installed dependencies are marked as manual, which helps against both as in this case there is no new/old and additionally if a user decides the installation of a metapackage was wrong he can just remove it explicitely avoid the manual marking entirely. --- test/integration/test-apt-never-markauto-sections | 60 ++++++++--------------- 1 file changed, 20 insertions(+), 40 deletions(-) (limited to 'test/integration/test-apt-never-markauto-sections') diff --git a/test/integration/test-apt-never-markauto-sections b/test/integration/test-apt-never-markauto-sections index 6c88c69fa..a469b4c15 100755 --- a/test/integration/test-apt-never-markauto-sections +++ b/test/integration/test-apt-never-markauto-sections @@ -9,22 +9,6 @@ configarchitecture 'amd64' 'i386' aptconfig dump --no-empty --format '%v%n' APT::Never-MarkAuto-Sections > nevermarkauto.sections testsuccess grep '^metapackages$' nevermarkauto.sections -# this is a very crude regression test, not a "this is how it should be" test: -# In theory mydesktop-core and texteditor should be marked as manual, but -# texteditor is installed as a dependency of bad-texteditor, not of -# mydesktop-core and mydesktop-core is removed while bad-texteditor is -# installed losing the manual bit as the problem resolver will later decide to -# drop bad-texteditor and re-instate mydesktop-core which is considered an -# auto-install at that point (in theory the never-auto handling should be -# copied to this place – as to the many other places dependencies are resolved -# 'by hand' instead of via MarkInstall AutoInst… -# -# Both could be fixed if apt would figure out early that installing -# bad-texteditor is a bad idea and eventually it should (as mydesktop-core is -# a direct descendant of mydesktop which was a user-request mydesktop-core should -# be as protected from removal as mydesktop is), but this is hard in the general case -# as with more or-groups and provides you can produce 'legal' examples for this. - buildsimplenativepackage 'mydesktop' 'all' '1' 'unstable' 'Depends: mydesktop-core, foreignpkg Recommends: notavailable' '' 'metapackages' buildsimplenativepackage 'mydesktop-core' 'amd64' '1' 'unstable' 'Depends: bad-texteditor | texteditor, browser (>= 42), nosection, foreignpkg @@ -45,21 +29,21 @@ testequal 'dpkg' aptmark showmanual testsuccess aptget install mydesktop -y -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 -testequal 'browser -dpkg -foreignpkg:i386 -mydesktop -nosection' aptmark showmanual -testmarkedauto 'mydesktop-core' 'texteditor' +testmarkedmanual 'dpkg' 'mydesktop' +testmarkedauto 'mydesktop-core' 'foreignpkg:i386' 'texteditor' 'browser' 'nosection' +# if the remove is from a user, don't do manual-bit passing testequal 'Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: - mydesktop mydesktop-core texteditor -0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. + browser foreignpkg:i386 mydesktop mydesktop-core nosection texteditor +0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded. Remv mydesktop [1] Remv mydesktop-core [1] +Remv browser [42] +Remv foreignpkg:i386 [1] +Remv nosection [1] Remv texteditor [1]' aptget autoremove mydesktop -s testequal 'Reading package lists... @@ -70,37 +54,33 @@ The following packages will be REMOVED: 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. Remv mydesktop [1] Remv mydesktop-core [1] -Remv texteditor [1]' aptget autoremove texteditor -s +Remv texteditor [1]' aptget autoremove texteditor -s #-o Debug::pkgDepCache::AutoInstall=1 -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 testsuccess aptget autoremove texteditor -y testdpkgnotinstalled mydesktop mydesktop-core texteditor testdpkginstalled browser -testequal 'browser -dpkg -foreignpkg:i386 -nosection' aptmark showmanual +testmarkedmanual 'browser' 'dpkg' 'foreignpkg:i386' 'nosection' testmarkedauto # test that installed/upgraded auto-pkgs are not set to manual testsuccess aptget install browser=41 -y --force-yes -testequal 'browser -dpkg -foreignpkg:i386 -nosection' aptmark showmanual +testmarkedmanual 'browser' 'dpkg' 'foreignpkg:i386' 'nosection' testmarkedauto testsuccess aptmark auto browser testmarkedauto 'browser' testsuccess aptmark auto nosection testmarkedauto 'browser' 'nosection' -testequal 'dpkg -foreignpkg:i386' aptmark showmanual +testmarkedmanual 'dpkg' 'foreignpkg:i386' + +# nosection should be auto, not manual, but is marked as such by the resolver +# removing mydesktop-core temporally… the resolver should be figuring out here +# that there is no point of removing mydesktop-core as its an unavoidable +# dependency of the user-requested mydesktop -testsuccess aptget install mydesktop -y +testsuccess aptget install mydesktop -y -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 -o Debug::pkgDepCache::AutoInstall=1 -testequal 'dpkg -foreignpkg:i386 -mydesktop' aptmark showmanual -testmarkedauto 'browser' 'nosection' 'mydesktop-core' 'texteditor' +testmarkedmanual 'dpkg' 'foreignpkg:i386' 'mydesktop' 'nosection' +testmarkedauto 'browser' 'mydesktop-core' 'texteditor' -- cgit v1.2.3 From b381a482eab0fc7b65b63cf0512ef1f97d775e34 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 14 Aug 2015 11:49:45 +0200 Subject: Replace --force-yes by various options starting with --allow This enables more fine grained control over such exceptions. --- test/integration/test-apt-never-markauto-sections | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/integration/test-apt-never-markauto-sections') diff --git a/test/integration/test-apt-never-markauto-sections b/test/integration/test-apt-never-markauto-sections index a469b4c15..9f490a1bd 100755 --- a/test/integration/test-apt-never-markauto-sections +++ b/test/integration/test-apt-never-markauto-sections @@ -65,7 +65,7 @@ testmarkedauto # test that installed/upgraded auto-pkgs are not set to manual -testsuccess aptget install browser=41 -y --force-yes +testsuccess aptget install browser=41 -y --allow-downgrades testmarkedmanual 'browser' 'dpkg' 'foreignpkg:i386' 'nosection' testmarkedauto -- cgit v1.2.3