]> git.saurik.com Git - apt.git/blobdiff - test/integration/test-ubuntu-bug-761175-remove-purge
add apt-key support for armored GPG key files (*.asc)
[apt.git] / test / integration / test-ubuntu-bug-761175-remove-purge
index f55c6e90967ca2dd406052c4444d95e1c27070d2..6ae1a04e85738224a498a0c18b7bf9f389d93baa 100755 (executable)
@@ -1,38 +1,88 @@
 #!/bin/sh
 set -e
 
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
 setupenvironment
-configarchitecture 'native'
+configarchitecture 'amd64' 'i386'
 
-setupsimplenativepackage 'compiz-core' 'native' '1.0' 'unstable'
-BUILDDIR='incoming/compiz-core-1.0'
-mkdir -p ${BUILDDIR}/debian/compiz-core/etc
-echo 'foo=bar;' > ${BUILDDIR}/compiz.conf
-echo 'compiz.conf      /etc/compiz.conf' >> ${BUILDDIR}/debian/install
-buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
-rm -rf "$BUILDDIR"
+buildcompizpkg() {
+       setupsimplenativepackage "compiz-core-$1" "$2" "$3" "$4"
+       BUILDDIR="incoming/compiz-core-$1-$3"
+       mkdir -p ${BUILDDIR}/debian/compiz-core/etc
+       echo 'foo=bar;' > ${BUILDDIR}/compiz.conf
+       echo 'compiz.conf       /etc/compiz.conf' >> ${BUILDDIR}/debian/install
+       buildpackage "$BUILDDIR" "$4" 'main' "$2"
+       rm -rf "$BUILDDIR"
+}
+buildcompizpkg 'native' 'all' '1.0' 'stable'
+buildcompizpkg 'all' 'native' '1.0' 'stable'
+buildcompizpkg 'native' 'native' '2.0' 'unstable'
+buildcompizpkg 'all' 'all' '2.0' 'unstable'
 
 setupaptarchive
 
+runtests() {
+       local PKG="$1"
+       local RELEASE="${2}"
+       shift 2
+       testdpkgnotinstalled compiz-core-${PKG}
+       testsuccess aptget install compiz-core-${PKG} -t "${RELEASE}" "$@"
+       testdpkginstalled compiz-core-${PKG}
 
-testdpkgnotinstalled compiz-core
-msgtest 'Install package' 'compiz-core'
-aptget install compiz-core -qq 2>&1 >/dev/null && msgpass || msgfail
-testdpkginstalled compiz-core
+       testsuccess aptget remove compiz-core-${PKG} -y "$@" -o Debug::pkgDpkgPm=1
+       testfailure grep -- '--force-remove-essential' rootdir/tmp/testsuccess.output
+       testsuccess aptget remove compiz-core-${PKG} -y "$@"
+       testdpkgnotinstalled compiz-core-${PKG}
+       testdpkgstatus 'rc' '1' "compiz-core-${PKG}"
 
-msgtest 'Remove package' 'compiz-core'
-aptget remove compiz-core -y -qq 2>&1 >/dev/null && msgpass || msgfail
-testdpkgnotinstalled compiz-core
-
-msgtest 'Check that conffiles are still around for' 'compiz-core'
-dpkg -l compiz-core | grep -q '^rc' && msgpass || msgfail
+       if [ -z "$1" ]; then
+               testsuccessequal "Reading package lists...
+Building dependency tree...
+Reading state information...
+The following packages will be REMOVED:
+  compiz-core-${PKG}*
+0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
+Purg compiz-core-${PKG}" aptget purge compiz-core-${PKG} -s "$@"
+       else
+               # check that the rc-version isn't passed to the external resolver if its only in dpkg/status
+               export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/dump-${PKG}.edsp"
+               testfailure aptget purge compiz-core-${PKG} -y "$@" -s --solver dump
+               testsuccessequal '2' grep -c "^Package: compiz-core-${PKG}\$" "$APT_EDSP_DUMP_FILENAME"
+               mv rootdir/etc/apt/sources.list.d/apt-test-stable-deb.list rootdir/etc/apt/sources.list.d/apt-test-stable-deb.disabled
+               testfailure aptget purge compiz-core-${PKG} -y "$@" -s --solver dump
+               testsuccessequal '1' grep -c "^Package: compiz-core-${PKG}\$" "$APT_EDSP_DUMP_FILENAME"
+               mv rootdir/etc/apt/sources.list.d/apt-test-stable-deb.disabled rootdir/etc/apt/sources.list.d/apt-test-stable-deb.list
 
-testequal 'Reading package lists...
+               testsuccessequal "Reading package lists...
 Building dependency tree...
 Reading state information...
+Execute external solver...
 The following packages will be REMOVED:
-  compiz-core*
+  compiz-core-${PKG}*
 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
-Purg compiz-core' aptget purge compiz-core -s
+Purg compiz-core-${PKG}" aptget purge compiz-core-${PKG} -s "$@"
+       fi
+       testsuccess aptget purge compiz-core-${PKG} -y "$@" -o Debug::pkgDpkgPm=1
+       testfailure grep -- '--force-remove-essential' rootdir/tmp/testsuccess.output
+       testsuccess aptget purge compiz-core-${PKG} -y "$@"
+       echo -n '' > rootdir/var/lib/dpkg/available # dpkg -l < 1.16.2 reads the available file by default, where the package can be found
+       testequalor2 "dpkg-query: no packages found matching compiz-core-${PKG}" "No packages found matching compiz-core-${PKG}." dpkg -l compiz-core-${PKG}
+}
+runtestround() {
+       runtests 'native' 'unstable' "$@"
+       runtests 'all' 'unstable' "$@"
+       runtests 'native' 'stable' "$@"
+       runtests 'all' 'stable' "$@"
+}
+testround() {
+       msgmsg 'Test in multi arch environment' "$@"
+       configarchitecture 'amd64' 'i386'
+       runtestround "$@"
+
+       msgmsg 'Test in single arch environment' "$@"
+       configarchitecture 'amd64'
+       runtestround "$@"
+}
+testround
+testround --solver apt