From a0c19a217ca2ed38ae0ecb4b8d2d4f8c4e53289f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 12 Jul 2015 13:41:12 +0200 Subject: implement a more generic ShowList method apt-get is displaying various lists of package names, which until now it was building as a string before passing it to ShowList, which inserted linebreaks at fitting points and showed a title if needed, but it never really understood what it was working with. With the help of C++11 the new generic knows not only what it works with, but generates the list on the fly rather than asking for it and potentially discarding parts of the input (= the non-default verbose display). It also doubles as a test for how usable the CacheSets are with C++11. (Not all callers are adapted yet.) Git-Dch: Ignore --- test/integration/test-apt-get-autoremove | 26 ++++++++++++++++++++++ .../test-bug-596498-trusted-unsigned-repo | 9 ++++++++ .../integration/test-bug-604222-new-and-autoremove | 26 ++++++++++++++++++++++ .../test-bug-613420-new-garbage-dependency | 16 +++++++++++++ .../test-bug-675449-essential-are-protected | 14 ++++++++++++ test/integration/test-kernel-helper-autoremove | 16 +++++++++++++ 6 files changed, 107 insertions(+) (limited to 'test/integration') diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove index a0e4d3c24..454b47976 100755 --- a/test/integration/test-apt-get-autoremove +++ b/test/integration/test-apt-get-autoremove @@ -27,6 +27,19 @@ The following packages will be REMOVED: po-debconf 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. Remv po-debconf [1.0.16]' aptget autoremove -s +testequal "Reading package lists... +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. +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. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small testdpkginstalled 'po-debconf' echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove @@ -63,6 +76,19 @@ The following packages will be REMOVED: 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. Remv debhelper [8.0.0] Remv po-debconf [1.0.16]' aptget autoremove -s +testequal "Reading package lists... +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. +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. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small testsuccess aptmark hold debhelper testsuccessequal 'Reading package lists... diff --git a/test/integration/test-bug-596498-trusted-unsigned-repo b/test/integration/test-bug-596498-trusted-unsigned-repo index c515837a3..94f280b81 100755 --- a/test/integration/test-bug-596498-trusted-unsigned-repo +++ b/test/integration/test-bug-596498-trusted-unsigned-repo @@ -37,6 +37,15 @@ WARNING: The following packages cannot be authenticated! Install these packages without verification? [y/N] N E: Some packages could not be authenticated" aptget install cool --assume-no -d +configarchitecture 'amd64' 'i386' +testequal "$(echo "$PKGTEXT" | sed 's#cool$#cool:i386#g') +WARNING: The following packages cannot be authenticated! + cool:i386 +Authentication warning overridden. +$DOWNLOG +Download complete and in download only mode" aptget install cool:i386 --assume-no -d --allow-unauthenticated +configarchitecture 'i386' + find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete sed -i -e 's#\(deb\(-src\)\?\) \[trusted=no\] #\1 #' $DEBFILE aptgetupdate diff --git a/test/integration/test-bug-604222-new-and-autoremove b/test/integration/test-bug-604222-new-and-autoremove index 52992680b..3b5fa20c4 100755 --- a/test/integration/test-bug-604222-new-and-autoremove +++ b/test/integration/test-bug-604222-new-and-autoremove @@ -23,6 +23,17 @@ The following NEW packages will be installed: Inst libavcodec52 (4:0.5.2-6 localhost [i386]) Conf libavcodec52 (4:0.5.2-6 localhost [i386])" aptget install libavcodec52 -s +testsuccessequal "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. +The following NEW packages will be installed: + libavcodec52 +0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst libavcodec52 (4:0.5.2-6 localhost [i386]) +Conf libavcodec52 (4:0.5.2-6 localhost [i386])" aptget install libavcodec52 -s -o APT::Get::HideAutoRemove=small + testfailureequal "Reading package lists... Building dependency tree... Reading state information... @@ -39,6 +50,21 @@ The following packages will be upgraded: Need to get 0 B/19.4 MB of archives. After this operation, 17.3 MB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install dummy-archive --trivial-only +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. +The following extra packages will be installed: + libavcodec52 libopenal-dev libvtk5.4 +The following NEW packages will be installed: + dummy-archive libavcodec52 libopenal-dev +The following packages will be upgraded: + libvtk5.4 +1 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. +Need to get 0 B/19.4 MB of archives. +After this operation, 17.3 MB of additional disk space will be used. +E: Trivial Only specified but this is not a trivial operation." aptget install dummy-archive --trivial-only -o APT::Get::HideAutoRemove=small echo -n > rootdir/var/lib/dpkg/status rm rootdir/var/lib/apt/extended_states diff --git a/test/integration/test-bug-613420-new-garbage-dependency b/test/integration/test-bug-613420-new-garbage-dependency index 5839f8798..18eab79c2 100755 --- a/test/integration/test-bug-613420-new-garbage-dependency +++ b/test/integration/test-bug-613420-new-garbage-dependency @@ -35,3 +35,19 @@ The following packages will be upgraded: 1 upgraded, 3 newly installed, 1 to remove and 0 not upgraded. After this operation, 126 MB disk space will be freed. E: Trivial Only specified but this is not a trivial operation." aptget install libreoffice --trivial-only +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. +The following extra packages will be installed: + libreoffice-core libreoffice-officebean openoffice.org-officebean +The following packages will be REMOVED: + openoffice.org-core +The following NEW packages will be installed: + libreoffice libreoffice-core libreoffice-officebean +The following packages will be upgraded: + openoffice.org-officebean +1 upgraded, 3 newly installed, 1 to remove and 0 not upgraded. +After this operation, 126 MB disk space will be freed. +E: Trivial Only specified but this is not a trivial operation." aptget install libreoffice --trivial-only -o APT::Get::HideAutoRemove=small diff --git a/test/integration/test-bug-675449-essential-are-protected b/test/integration/test-bug-675449-essential-are-protected index f50507532..e62add938 100755 --- a/test/integration/test-bug-675449-essential-are-protected +++ b/test/integration/test-bug-675449-essential-are-protected @@ -87,3 +87,17 @@ Inst pkg-none-native [1] (2 unstable [amd64]) Conf pkg-none-native (2 unstable [amd64]) Inst pkg-none-new (2 unstable [amd64]) Conf pkg-none-new (2 unstable [amd64])' aptget dist-upgrade -s + +insertinstalledpackage 'foo' 'amd64' '1' 'Depends: libfoo +Essential: yes' +insertinstalledpackage 'libfoo' 'amd64' '1' +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + foo* libfoo* +WARNING: The following essential packages will be removed. +This should NOT be done unless you know exactly what you are doing! + foo libfoo (due to foo) +0 upgraded, 0 newly installed, 2 to remove and 4 not upgraded. +Purg foo [1] +Purg libfoo [1]' aptget purge libfoo -s diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index c2fc37ee7..2b020ceca 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -58,6 +58,22 @@ testprotected() { testsuccessequal "Reading package lists... Building dependency tree... Reading state information... +The following packages were automatically installed and are no longer required: + linux-headers-1000000-1-generic (100.0.0-1) + linux-image-1.0.0-2-generic (1.0.0-2) + linux-image-100.0.0-1-generic (100.0.0-1) + $CURRENTKERNEL (1) +Use 'apt-get autoremove' to remove them. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -sV +testequal "Reading package lists... +Building dependency tree... +Reading state information... +4 packages were automatically installed and are no longer required. +Use 'apt-get autoremove' to remove them. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small +testequal "Reading package lists... +Building dependency tree... +Reading state information... The following packages will be REMOVED: linux-headers-1000000-1-generic (100.0.0-1) linux-image-1.0.0-2-generic (1.0.0-2) -- cgit v1.2.3