X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/9777639ef84917f37b0c225a99676e3f0f85421a..dfd863ea50c0fcf9b9ac4dfb5ae0e64c529bd767:/test/integration/test-apt-get-autoremove?ds=inline diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove index 455079cf1..17dba9aec 100755 --- a/test/integration/test-apt-get-autoremove +++ b/test/integration/test-apt-get-autoremove @@ -1,8 +1,8 @@ #!/bin/sh set -e -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" setupenvironment configarchitecture 'i386' @@ -19,6 +19,10 @@ testsuccess aptget remove debhelper -y testdpkgnotinstalled 'debhelper' testdpkginstalled 'po-debconf' 'unrelated' +AUTOREMOVE='apt autoremove' +if [ -n "$SUDO_USER" ]; then + AUTOREMOVE="sudo $AUTOREMOVE" +fi echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove testsuccessequal 'Reading package lists... Building dependency tree... @@ -32,13 +36,13 @@ Building dependency tree... Reading state information... The following package was automatically installed and is no longer required: po-debconf -Use 'apt-get autoremove' to remove it. +Use '$AUTOREMOVE' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s testequal "Reading package lists... Building dependency tree... Reading state information... 1 package was automatically installed and is no longer required. -Use 'apt-get autoremove' to remove it. +Use '$AUTOREMOVE' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small testdpkginstalled 'po-debconf' @@ -55,7 +59,10 @@ testsuccess aptget autoremove -y testdpkgnotinstalled 'po-debconf' testmarkedauto -sed rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e 's#), #)\nInstall: #g' | sort -u > apt-history.log +sed rootdir/var/log/apt/history.log -e '/^Commandline: / d' \ + -e '/^Start-Date: / d' -e '/^End-Date: / d' \ + -e '/^Requested-By: / d' \ + -e 's#), #)\nInstall: #g' | sort -u > apt-history.log testfileequal 'apt-history.log' ' Install: debhelper:i386 (8.0.0) Install: po-debconf:i386 (1.0.16, automatic) @@ -81,13 +88,13 @@ Building dependency tree... Reading state information... The following packages were automatically installed and are no longer required: debhelper po-debconf -Use 'apt-get autoremove' to remove them. +Use '$AUTOREMOVE' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s testequal "Reading package lists... Building dependency tree... Reading state information... 2 packages were automatically installed and are no longer required. -Use 'apt-get autoremove' to remove them. +Use '$AUTOREMOVE' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small testsuccess aptmark hold debhelper @@ -101,3 +108,39 @@ testdpkgnotinstalled 'po-debconf' 'debhelper' testmarkedauto testsuccess aptget install debhelper --solver apt -y -o Debug::pkgDepCache::Marker=1 testmarkedauto 'po-debconf' + +insertinstalledpackage 'bar' 'all' '1' 'Depends: foo-provider' +insertinstalledpackage 'foo-multi1-1' 'all' '1' 'Provides: foo-provider +Source: foo-multi (1)' +insertinstalledpackage 'foo-multi1-2' 'all' '1' 'Provides: foo-provider +Source: foo-multi (2)' +insertinstalledpackage 'foo-multi1-3' 'all' '1' 'Provides: foo-provider +Source: foo-multi (3)' +insertinstalledpackage 'foo-multi2-1' 'all' '1' 'Provides: foo-provider +Source: foo-multi (1)' +insertinstalledpackage 'foo-multi2-2' 'all' '1' 'Provides: foo-provider +Source: foo-multi (2)' +insertinstalledpackage 'foo-multi2-3' 'all' '1' 'Provides: foo-provider +Source: foo-multi (3)' +insertinstalledpackage 'foo-plus-1' 'all' '1' 'Provides: foo-provider +Source: foo-plus (1)' +insertinstalledpackage 'foo-plus-2' 'all' '1' 'Provides: foo-provider +Source: foo-plus (2)' +insertinstalledpackage 'foo-plus-3' 'all' '1' 'Provides: foo-provider +Source: foo-plus (3)' +insertinstalledpackage 'foo-single-1' 'all' '1' 'Provides: foo-provider' +insertinstalledpackage 'foo-single-2' 'all' '1' 'Provides: foo-provider' + +testsuccess aptmark auto 'foo-*' +testsuccessequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + foo-multi1-1 foo-multi1-2 foo-multi2-1 foo-multi2-2 foo-plus-1 foo-plus-2 +0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded. +Remv foo-multi1-1 [1] +Remv foo-multi1-2 [1] +Remv foo-multi2-1 [1] +Remv foo-multi2-2 [1] +Remv foo-plus-1 [1] +Remv foo-plus-2 [1]' apt autoremove -s